Lorixen.
Back to all guides

Cloudflare Workers

Create, run locally and deploy your first Cloudflare Worker

A way to run small server-side JavaScript programs on Cloudflare. Start with a Hello World Worker and a preview address.

Based on the tool's official documentation.

Written from the tool's official pages, listed under Official sources at the end of this guide. Check them for current features, limits and terms.

Try it (opens in a new tab)

Steps to try

  1. Create a Cloudflare account and check the docs' prerequisites, including a current Node.js, before starting.
  2. In an empty folder, run npm create cloudflare@latest and follow the prompts to generate a project from a template.
  3. Run npx wrangler dev and open the local address it prints; it may ask you to log in through the browser the first time.
  4. Edit src/index.js to change the Response text, save, reload, and confirm the output changed.
  5. Run npx wrangler deploy. Setting a workers.dev subdomain is optional; a custom domain is a separate decision you can skip for a first test.
  6. Keep the project in Git and put no API keys in code; use the docs' pages on secrets and environment variables.

Limitations

A Hello World Worker is not a production site. If you see 523 errors on a brand-new workers.dev address the docs say to wait a minute. Bindings, storage, testing and limits need their own reading.

Pricing

The docs point to a separate limits and pricing page. Free allowances, paid plans and limits change, so read the current Cloudflare terms before relying on a deployment.

Privacy and data

Deploying publishes code to a public address and links the project to your Cloudflare account. Do not commit secrets or customer data, and check what each logged-in command can change before running it.

About the sources

Based on the vendor's published documentation, not hands-on testing. Bindings, storage and limits are not covered.

Alternatives

Other static and serverless hosts exist. Static assets, Pages migration and framework guides on the same docs may fit a plain website better than a Worker script.

Official sources

The official pages this guide was written from. Read them for current features, limits and terms.

Guides by role

Related guides

Back to all guides
WhatsAppLet’s talk