Skip to content
AnswerWell geo Documentation

Research · 6 min read · Answerwell

Edge Worker Lifecycle: C3, Wrangler, Local Development, and Deploy

How to create a Worker with C3 or the dashboard, develop locally with Wrangler or Vite, deploy globally, and connect bindings.

This page summarizes Cloudflare Workers documentation on how Worker projects are organized, how code runs on the network, and how you move from a first script to a deployed application using C3, Wrangler, and the dashboard.

Cloudflare Workers concepts: how request to response runs on the edge

Section titled “Cloudflare Workers concepts: how request to response runs on the edge”

A Worker is JavaScript (or WebAssembly) that handles HTTP traffic close to users. After you read Workers concepts, you should understand project layout, execution on the Cloudflare network, and the request-to-response path.

By reading this page, you have learned:

  • The basics of how Worker projects are organized.
  • The fundamentals of how Workers execute on the Cloudflare network.
  • How the request to response flow executes.

— Cloudflare, Cloudflare Workers

A minimal entry point exports a fetch handler. The Vite plugin get started example shows what local and deployed runs return:

export default {
fetch() {
return new Response(`Running in ${navigator.userAgent}!`);
},
};

A request to this Worker will return Running in Cloudflare-Workers!, which confirms the code is running inside the Workers runtime.

Deploy your first Worker: C3, Wrangler, and the dashboard

Section titled “Deploy your first Worker: C3, Wrangler, and the dashboard”

People often ask whether they need a CLI, a scaffold tool, or only the web UI. Cloudflare documents three overlapping paths with different jobs.

C3 (create-cloudflare) vs Wrangler: what each tool is for

Section titled “C3 (create-cloudflare) vs Wrangler: what each tool is for”

C3 and Wrangler split creation from day-to-day project work:

By reading this page, you have learned:

  • How to use C3 to create new Workers and Pages projects.
  • How to use Wrangler to develop, configure, and delete your projects.

— Cloudflare, C3 & Wrangler

The Deploy your first Worker module states that you will learn the difference between C3 and Wrangler, how to use the dashboard to manage Workers, and how to create and deploy your first Worker.

After a first deploy, First Worker summarizes that you can create and deploy using the dashboard or programmatically from the terminal.

Dashboard-created Workers: Git clone and Wrangler deploy

Section titled “Dashboard-created Workers: Git clone and Wrangler deploy”

Dashboard starters are wired for Git. Continue development in the dashboard guide:

  1. Clone the repository locally: git clone <git repo URL>
  2. Move to the project root: cd <directory>
  3. Preview and test locally with Wrangler in your local development environment.
  4. When ready to deploy: git add ., git commit -m "your message", git push origin main

The same page notes you can visit the Cloudflare dashboard for simpler editing, and points to examples, bindings, testing, and Workers limits and pricing.

Local development: wrangler dev, vite dev, and DevTools

Section titled “Local development: wrangler dev, vite dev, and DevTools”

Local preview is the usual step before wrangler deploy or CI deploys.

DevTools documents the classic loop:

Run your Worker locally, by running wrangler dev
Press the D key from your terminal to open DevTools in a browser tab

— Cloudflare, DevTools

For programmatic tests, the Wrangler API exposes unstable_dev(script, options) to start a local Worker instance from Node.

Several changelog entries (and the Containers + Vite post) describe starting a local dev server with:

vite dev

Use this path when your project uses the Cloudflare Vite plugin or the React + Vite SPA tutorial, which deploys static assets and an API Worker together.

Deploy globally and typical next steps after the first Worker

Section titled “Deploy globally and typical next steps after the first Worker”

Once local behavior looks right, deployment publishes triggers on Cloudflare’s network. The BigQuery + Workers AI tutorial shows the deploy command and outcome:

npx wrangler deploy

That produces upload size lines, deployed trigger URLs such as https://<your_public_worker_endpoint>, and a current version ID. The tutorial warns that this creates a public endpoint—use access controls when production data is involved.

The CLI get started guide lists what teams usually do next:

To do more:

  • Push your project to an Artifacts, GitHub, or GitLab repository, then connect to builds to enable automatic builds and deployments.
  • Visit the Cloudflare dashboard ↗︎ for simpler editing.
  • Review our Examples and Tutorials for inspiration.
  • Set up bindings to allow your Worker to interact with other resources and unlock new functionality.
  • Learn how to test and debug your Workers.
  • Read about Workers limits and pricing.

— Cloudflare, CLI

Next steps in the content strategy docs give a concrete pattern: add a custom domain or explore Workers KV after the first deploy.

Direction What you add Example in docs
Persistent key–value data KV binding Get started with KV (create namespace, read/write, deploy globally)
SQL at the edge D1 + Worker API Staff directory
Strong consistency / rooms Durable Objects Seat booking (SQLite in DOs)
Models on platform Workers AI binding BigQuery tutorial (env.AI.run(...))
Static UI + API Static assets + Worker React SPA tutorial

Web sites and web apps use cases describe a common static-plus-dynamic layout: Workers serve HTML/CSS/JS and handle forms and API calls; KV holds form data and preferences; R2 holds uploads.

Bindings: connect Workers to KV, D1, AI, and other resources

Section titled “Bindings: connect Workers to KV, D1, AI, and other resources”

Bindings are how a Worker script reaches platform resources without hard-coding account IDs in source. Tutorials repeat the same pattern: declare a binding in Wrangler config, access it on env in fetch.

Workers AI requires an AI binding. From Using BigQuery with Workers AI:

{
"ai": {
"binding": "AI"
}
}

Or in TOML:

[ai]
binding = "AI"

After enabling the binding, restart the local Worker; Wrangler may prompt you to log in and grant temporary account access when using Worker AI locally.

Use KV API (embedded function calling) states that interacting with persistent storage enables powerful use cases and shows KV accessed from Workers AI function calling in a few lines of code.

For D1 from a Worker, the D1 Worker API page points you through the get-started tutorial (JavaScript) before API reference work.

Learning paths and tutorials: what to build after basics

Section titled “Learning paths and tutorials: what to build after basics”

Documentation steers beginners through Deploy your first Worker then optional courses. First application adds Hono, local development, and Workers AI integration via video.

Hands-on tutorials cover narrow problems; summaries in the cluster include:

Treat these as recipes after you can create, run locally, and deploy a minimal Worker.

  • Deploying before local preview: use wrangler dev or vite dev first.
  • Forgetting bindings after copying tutorial code: AI, KV, and D1 fail at runtime if wrangler.jsonc / wrangler.toml does not match the tutorial.
  • Exposing data on first npx wrangler deploy: public URLs need auth or secrets for production datasets (BigQuery tutorial deployment note).
  • Assuming dashboard and CLI projects stay in sync without Git: dashboard apps expect git push; local-only changes do not deploy until you push or run Wrangler deploy from CI.
  1. Create or open a Worker via C3 & Wrangler or the dashboard guide, and confirm the project contains a fetch handler as in the Vite plugin get started example.
  2. Run local preview with wrangler dev per DevTools (press D for DevTools) or vite dev if your template uses the Vite changelog workflow.
  3. Deploy with npx wrangler deploy and open the published https://<your_public_worker_endpoint> URL; compare behavior to localhost.
  4. In the Cloudflare dashboard (linked from the CLI guide), confirm the active version matches your latest deploy and review Workers limits and pricing if traffic grows.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about so it can be corrected.