Master Claude Code & Cloudflare Deployment

A practical guide for students โ€” from AI-assisted coding to live deployment

Claude Code

Claude Code is an AI coding assistant that lives in your terminal. It reads your codebase, writes code, runs commands, and helps you ship faster.

๐Ÿค–

AI in your terminal

Talk to Claude directly from your project folder using the claude command.

๐Ÿ“‚

Understands your codebase

Claude reads your files, understands context, and makes changes across multiple files at once.

โšก

Runs commands for you

Claude can run terminal commands, install packages, run tests, and fix errors automatically.

Getting Started

  1. Install Claude Code
    npm install -g @anthropic-ai/claude-code
  2. Authenticate (first run โ€” opens browser)
    claude
  3. Start a session inside your project folder
    cd your-project
    claude

Key Commands

claudeStart interactive session
/helpShow all commands
/clearClear conversation
/compactSummarise context
claude "fix this bug"One-shot task

Cloudflare Pages

Cloudflare Pages is a free hosting platform that deploys your site to a global CDN in seconds โ€” connected directly to your GitHub repo.

๐Ÿ†“

Free hosting

Unlimited free deployments, custom domains, and HTTPS included at no cost.

๐ŸŒ

Global CDN

Your site is served from 300+ data centres worldwide โ€” blazing fast everywhere.

๐Ÿ”—

Git-connected deploys

Push to GitHub and your site deploys automatically. Every PR gets a preview URL.

Setup Steps

  1. Create a Cloudflare account at dash.cloudflare.com
  2. Connect your GitHub repo โ€” go to Workers & Pages โ†’ Create โ†’ Pages โ†’ Connect to Git
  3. Set build settings โ€” Build command: (leave empty), Output directory: /
  4. Deploy โ€” Cloudflare builds and gives you a live *.pages.dev URL instantly

Config File

wrangler.toml
name = "ebrightv2"
compatibility_date = "2024-01-01"
pages_build_output_dir = "."

CI/CD Pipeline

Automate your deploy workflow so every commit, push, and PR triggers a live preview โ€” and merging to main updates production automatically.

Commit
โ†’
Push Branch
โ†’
Open PR
โ†’
Preview Deploy
โ†’
Merge to main
โ†’
Production Deploy

Step-by-Step Walkthrough

  1. Make changes locally and commit
    git add .
    git commit -m "feat: add new section"
  2. Push your branch
    git push origin your-branch-name
  3. Open a Pull Request on GitHub โ€” click "Compare & pull request"
  4. GitHub Actions triggers โ€” a preview URL is automatically posted as a PR comment
  5. Review, approve, and merge โ€” production deploys to ebrightv2-askbard.pages.dev automatically

GitHub Actions Workflow

wrangler.toml
name = "ebrightv2"
compatibility_date = "2024-01-01"
pages_build_output_dir = "."
.github/workflows/deploy.yml
name: Deploy to Cloudflare Pages

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
      - name: Deploy to Cloudflare Pages
        uses: cloudflare/pages-action@v1
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          projectName: ebrightv2
          directory: .
          gitHubToken: ${{ secrets.GITHUB_TOKEN }}
Required GitHub Secrets:
  • CLOUDFLARE_API_TOKEN โ€” create at dash.cloudflare.com โ†’ My Profile โ†’ API Tokens โ†’ Create Token โ†’ "Edit Cloudflare Workers" template
  • CLOUDFLARE_ACCOUNT_ID โ€” found on the right sidebar of your Cloudflare dashboard home

Resources

Official documentation and guides to go deeper.