Worker Project Creation: C3 CLI, Templates, Frameworks, and Pages Platform
How to scaffold Cloudflare Workers and Pages apps with create-cloudflare (C3): commands, CLI flags, templates, frameworks, and what gets generated.
This page summarizes Cloudflare developer documentation on C3 (create-cloudflare, also called create-cloudflare-cli): the usual first step before tutorials for Workers, Pages, AI Search, Durable Objects, and framework guides. C3 scaffolds a directory, installs dependencies (including Wrangler), and optionally deploys.
What is C3 and when do you use it?
Section titled “What is C3 and when do you use it?”C3 is the command-line entry point most Cloudflare guides use to create a new Worker or Pages project instead of hand-writing wrangler.jsonc and an entry script from scratch.
C3 (create-cloudflare CLI) is a command-line tool designed to help you set up and deploy new applications to Cloudflare. In addition to speed, it leverages officially developed templates for Workers and framework-specific setup guides to ensure each new application that you set up follows Cloudflare and any third-party best practices for deployment on the Cloudflare network.
— Cloudflare, C3 & Wrangler
Cloudflare provides a CLI command for creating new Workers and Pages projects — npm create cloudflare, powered by the create-cloudflare package ↗︎.
— Cloudflare, C3 CLI
Use C3 when you are starting a tutorial (Hello World Worker, AI agent, RAG sample, framework on Pages/Workers), when you want a remote GitHub template (--template), or when you need non-interactive flags for CI. After scaffolding, day-to-day work is typically npx wrangler dev and npx wrangler deploy, as in guides such as Bring your own generation model and Deploy Astro on Workers.
npm create cloudflare: basic command and interactive wizard
Section titled “npm create cloudflare: basic command and interactive wizard”Open a terminal and run C3 with a project directory name after -- (npm requires the extra -- before arguments).
npm create cloudflare@latest -- my-first-workerEquivalent package managers:
yarn create cloudflare my-first-workerpnpm create cloudflare@latest my-first-workerThe wizard asks what to build. A pattern repeated across dozens of tutorials (for example Workers get started, First Worker, and Agents SDK) is:
| Prompt | Typical choice for a minimal Worker tutorial |
|---|---|
| What would you like to start with? | Hello World example |
| Which template would you like to use? | Worker only (or Worker + Durable Objects, Static site, SSR / full-stack app when the guide says so) |
| Which language do you want to use? | TypeScript or JavaScript |
| Do you want to use git? | Yes |
Do you want to add an AGENTS.md file? |
Yes (optional; helps AI coding tools with Cloudflare APIs) |
| Do you want to deploy your application? | No if the guide says you will edit code first; Yes when you want an immediate *.workers.dev URL |
Then change into the project folder (cd my-first-worker).
What files C3 creates for a Hello World Worker
Section titled “What files C3 creates for a Hello World Worker”After a standard Hello World flow, Workers get started and Build a RAG AI describe output along these lines:
wrangler.jsonc— Wrangler configuration (bindings, compatibility date, triggers).src/index.jsorsrc/index.ts— Worker entry with afetchhandler (ES modules).package.json, lockfile, andnode_modulesafter install.
The default handler illustrates the request/response model:
export default { async fetch(request, env, ctx) { return new Response("Hello World!"); },};From Build a todo list Jamstack application: incoming HTTP requests hit the fetch() handler; the Worker returns a response from Cloudflare’s edge rather than forwarding to a traditional origin for that logic.
Workers vs Cloudflare Pages: --platform=pages
Section titled “Workers vs Cloudflare Pages: --platform=pages”By default, C3 targets Workers. For Pages, you must pass --platform=pages or C3 always creates a Workers project:
To create a Pages project you must now specify the –platform=pages arg, otherwise C3 will always create a Workers project.
— Cloudflare, C3 CLI
Example for a Pages app without a named framework yet:
npm create cloudflare@latest -- --platform=pagesFramework + Pages examples from the cluster:
npm create cloudflare@latest -- my-react-app --framework=react --platform=pagesnpm create cloudflare@latest -- my-astro-app --framework=astro --platform=pagesFor the same framework on Workers (often with static assets and npm run deploy), guides use --framework= without --platform=pages, for example Astro on Workers:
npm create cloudflare@latest -- my-astro-app --framework=astroC3 then runs the framework’s official setup tool, adds adapters (for example @astrojs/cloudflare), and may offer instant deploy—see Deploy an Astro site on Pages.
C3 CLI arguments: skip prompts for CI and automation
Section titled “C3 CLI arguments: skip prompts for CI and automation”C3 can take choices on the command line so prompts are skipped—required for non-interactive CI:
C3 collects any required input through a series of interactive prompts. You may also specify your choices via command line arguments, which will skip these prompts. To use C3 in a non-interactive context such as CI, you must specify all required arguments via the command line.
— Cloudflare, C3 CLI
General invocation shape:
npm create cloudflare@latest -- --platform=pages [<DIRECTORY>] [OPTIONS] [-- <NESTED ARGS...>]Important options (from C3 CLI):
| Flag | Role |
|---|---|
DIRECTORY |
Folder name; also becomes the app name |
--category |
hello-world, web-framework, demo, remote-template |
--type |
Worker archetype: hello-world, hello-world-durable-object, scheduled, queues, openapi, etc. |
--framework |
Web framework (astro, next, nuxt, react, hono, vue, …); when set, --type is ignored |
--template |
Remote git template (user/repo, branch #canary, subdirectory paths) |
--lang |
ts, js, or python |
--deploy |
Deploy after create (default true; use false in tutorials) |
--git / --no-git |
Initialize git |
--no-deploy |
Same as negated deploy |
-y, --accept-defaults |
Accept defaults (overridable per flag) |
Examples from tutorials:
Hello World without deploy (Postmark / Resend email Workers):
npm create cloudflare@latest email-with-postmark -- --type=hello-world --ts=false --git=true --deploy=falseGradual deployments (type shorthand):
npm create cloudflare@latest my-worker -- --type=hello-worldSandbox SDK minimal template:
npm create cloudflare@latest -- analyze-data --template=cloudflare/sandbox-sdk/examples/minimal#v0Workflows starter from Cloudflare docs-examples:
npm create cloudflare@latest workflows-starter -- --template "cloudflare/workflows-starter"Pre-set flags (code interpreter):
npm create cloudflare@latest sandbox-code-interpreter --category=hello-world --type=hello-world --lang=ts --no-deploy --no-git --no-agentsNon-interactive CI (Vectorize intro):
CI=true npm create cloudflare@latest vectorize-tutorial --type=simple --git --ts --deploy=falseBoolean flags accept --open, --open true, or --no-open for negation (C3 CLI).
-- NESTED ARGS pass through to third-party CLIs when C3 invokes framework tools (C3 CLI).
--framework and --template: two ways to start
Section titled “--framework and --template: two ways to start”Official framework integration
Section titled “Official framework integration”With --framework=<name>, C3 creates the directory, runs the framework’s installer, and wires Cloudflare adapters. Supported frameworks listed in C3 CLI include angular, astro, next, nuxt, react, svelte, vue, hono, remix, qwik, and others.
Next.js on Workers documents that C3 configures vinext, installs dependencies, and offers deploy; local dev uses npm run dev, and production deployment uses npm run deploy.
Hono on Workers can use a Cloudflare Vite + React template:
npm create cloudflare@latest my-hono-app --template=cloudflare/templates/vite-react-templateSome guides use Framework Starter in the wizard instead of --framework, for example Build a Slackbot (Hono) and Localize a website with HTMLRewriter (React).
Remote templates from Git
Section titled “Remote templates from Git”From an existing repo (Workers get started):
npm create cloudflare@latest -- --template <SOURCE><SOURCE> can be user/repo, a branch user/repo#canary, a commit hash, or GitLab/Bitbucket forms. Templates must include at minimum package.json, a Wrangler config file, and src/ with the Worker script referenced from Wrangler (C3 CLI).
npm create cloudflare@latest -- my-mcp-client --template=cloudflare/ai/demos/hello-worldTemplate and type choices beyond Hello World
Section titled “Template and type choices beyond Hello World”Guides pick different C3 templates or types depending on the product:
| Goal | C3 choice | Example doc |
|---|---|---|
| Durable Objects + SQLite seat booking | Worker + Durable Objects | Seat booking app |
| Durable Object starter | Same template | Durable Objects get started |
| Static front-end only | Static site | Static assets get started |
| Full-stack on Workers | SSR / full-stack app | Static assets (dynamic site), D1 e-commerce |
| Scheduled cron Worker | Worker only + configure triggers.crons in Wrangler |
BGP anomalies |
| Sandbox / Agents tutorials | --template=cloudflare/sandbox-sdk/... |
Analyze data with AI |
After creation, product-specific steps add bindings in wrangler.jsonc (AI, R2, D1, KV, Queues, etc.)—C3 only provides the skeleton.
Deploy and develop after C3
Section titled “Deploy and develop after C3”If you answered No to deploy during setup, deploy later with Wrangler (Bring your own generation model):
npx wrangler loginnpx wrangler devnpx wrangler deployFramework projects scaffolded by C3 often expose npm run dev and npm run deploy (Astro on Workers, React Router).
Initial C3 deploy to Pages is a Direct Upload; Git-based Pages flows are documented separately in framework guides such as Nuxt on Pages.
Common mistakes
Section titled “Common mistakes”- Expecting a Pages project without
--platform=pages— you get a Worker instead (C3 CLI). - Running CI without all required flags — the wizard hangs or fails; set
CI=trueand pass--type,--lang,--deploy, etc. (Vectorize intro). - Assuming
wrangler init --from-dashstays in sync with dashboard edits — CLI and dashboard can diverge (Wranglerinit). - Wrong template for the tutorial — e.g. choosing Worker only when the guide requires Worker + Durable Objects (Durable Objects get started).
- Deploying before bindings — many AI and Sandbox guides say No to initial deploy until
wrangler.jsoncincludes AI, Loader, or Sandbox bindings (Build an AI code interpreter).
How to check this on your site
Section titled “How to check this on your site”-
Run
npm create cloudflare@latest -- test-c3-check(or your package manager equivalent) and complete or flag the same options as your target tutorial from Workers get started. -
Confirm the new directory contains
wrangler.jsoncandsrc/index.tsorsrc/index.jsas described in First Worker. -
From that directory, run
npx wrangler devand open the local URL (commonly port8787) to see the Hello World response, matching Using BigQuery with Workers AI. -
If you used
--platform=pagesor a framework flag, runnpm run devwhen the scaffoldedpackage.jsonprovides it, per React on Pages. -
You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page does not match your C3 output or a linked Cloudflare doc, email yimasynthetic@gmail.com with the page URL and the exact sentence you think is wrong so it can be corrected.