Sites that do things. Not just show them.

The moment your site needs to keep a secret or remember something - an AI feature, a form that saves, a page only your clients see - it needs code on a server. This template gives you one: a React app and its API on a single Cloudflare Worker, set up with Claude Code and running on the free plan.

Showing versus doing - pick a request

Worker examples/ai/simple-claude-chat

{
  "answer": "Here are three subject lines for your launch email..."
}

Your Worker calls Claude with a key stored as a Cloudflare secret. The browser only ever sees the answer.

Which do you need?

Most sites don't need this template. Here's how to tell.

  1. Your site shows things

    A portfolio, a brochure site, a landing page, docs. Nothing to save, nothing to hide.

    Skip this. Deploy plain files with Workers static assets, or use Astro.

  2. Your site lives on search

    A blog, a content-led shop, anything where Google ranking and link previews come first.

    Render on the server with Astro, React Router or TanStack Start.

  3. Your site does things

    It calls an AI model with your key, saves what people send, or shows each client their own data.

    This template.

Built for one person shipping an app

Things people build with it

  • A paid AI tool - your Claude or Workers AI key never reaches the browser
  • A booking, enquiry or waitlist form that saves to a database
  • A portal where each client sees only their own projects or files
  • A dashboard or internal tool for you or your team

It suits you if

  • You work alone or in a small team, and you build with Claude Code
  • You want a live URL, deploys and tests in place before you write a feature
  • You'd rather pay nothing until real traffic arrives
  • A long-running Node.js server isn't a requirement - Workers run per request

Why not the official starter?

Fair question. pnpm create cloudflare (create-cloudflare) gives you the same React and Worker starting point in one command, and if you're happy wiring up the rest yourself, use it. This template is that starting point plus the parts a solo builder otherwise spends their first week on:

Guided setup
/start asks what you're building, then takes you through Cloudflare credentials, GitHub secrets, a custom domain and the first deploy
A safety net
CI tests every pull request and only deploys main once lint, types, tests and build pass - useful when you're your own reviewer
The hard parts, done once
Working examples for exactly what makes a site need a server: AI calls with hidden keys, forms saved to D1, sessions in KV
An agent that knows the project
AGENTS.md, slash commands and guides written for Claude Code, so it adds a database or an AI feature the same careful way every time

Sign-in isn't built in. The sessions example covers the cookie side; for a client portal, putting Cloudflare Access (which has a free plan) in front is the quickest route.

What's included

CI that guards main

One GitHub Actions workflow. Every pull request and push installs from the lockfile, checks the generated Worker types are current, then lints, tests and builds. Pushes to main deploy only after that passes. Two secrets, CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID, are all it needs.

Claude Code commands

Slash commands that do the Cloudflare plumbing with you, step by step. The Cloudflare API MCP server is configured in .mcp.json.

/start
Project name, Cloudflare credentials, GitHub secrets, an optional custom domain and the first deploy
/add-binding
R2, Queues, Durable Objects and other bindings, wired into config and types
/setup-database
D1 or KV, with migrations, types and example queries
/add-ai-feature
Chat or streaming with the Claude API, Workers AI or AI Gateway
/setup-sandbox
Cloudflare Sandbox SDK for running untrusted code in isolation
/generate-prp
A written implementation plan for a feature
/execute-prp
Builds the feature from that plan

Examples that run

Each one pairs a React component with its Worker endpoint, types and a README. Copy what you need into src/ and worker/.

  • D1 contact form with parameterised SQL
  • KV sessions with secure cookies
  • Claude API chat
  • Streaming chat over server-sent events
  • Workers AI chat on Cloudflare's models
  • AI Gateway caching and analytics in front of any model

The stack

React
19
Vite
8
TypeScript
6
Wrangler
4
Node
24
pnpm
12

Sensible defaults

Security headers and a /api/health endpoint in the Worker, Vitest with Testing Library, ESLint, exact dependency pins with a three-day release cooldown, and VS Code settings that stay out of the way.

Quick start

You need Node.js 24, a free Cloudflare account and pnpm. No pnpm yet? Run this once, then open a new terminal - the project picks its own pnpm version from there:

npx get-pnpm
  1. Create your copy

    Click Use this template on GitHub.

  2. Clone, install and run

    git clone https://github.com/you/your-app.git && cd your-app && pnpm install && pnpm dev

    Swap in your repository's URL and folder name. React and the Worker run together on localhost:5173 - leave this terminal running.

  3. Open Claude Code

    cd your-app && claude

    In a second terminal, open the project folder in Claude Code the way you usually do - the claude command shown here, the desktop app or your editor's extension.

  4. Run the setup

    /start

    Type it into Claude Code. It asks what you're building, then walks you through Cloudflare credentials, GitHub secrets and the first deploy.

  5. Ship changes

    git push

    CI tests every push and deploys main. To deploy from your machine instead, run pnpm run deploy.

Runs on the free plan

Everything in the template fits Cloudflare's free allowances. Figures from Cloudflare's pricing pages, checked 2026-10-04.

ProductFree allowance
Workers100,000 requests a day, 10 ms CPU per request
D15 GB storage, 5 million rows read and 100,000 rows written a day
KV1 GB storage, 100,000 reads and 1,000 writes a day
R210 GB storage, 1 million writes and 10 million reads a month, no egress fees
Workers AI10,000 Neurons a day

Sources: Workers, R2, Workers AI.

Your app, live today. Features tomorrow.