Cloudflare Docs
Workers
Visit Workers on GitHub
Set theme to dark (⇧+D)

Get started with Wrangler

Wrangler is a command-line tool for building Cloudflare Workers. To use it, you will need to have npm and Node.js installed. Wrangler requires a Node version of 16.13.0 or later.

To get started with Wrangler run:

$ npx wrangler init my-project

This will create new directory (my-project), and setup a new Workers project within it. To start developing your worker, run:

$ cd my-project && npm start

If you have not used Wrangler before, it will try to open your web browser to login with your Cloudflare account.

You will now be able to go to http://localhost:8787 to see your Worker running. Any changes you make to your code will trigger a rebuild, and reloading the page will show you the up-to-date output of your Worker.

When you are ready to deploy your Worker to Cloudflare’s edge network, run:

$ npm run deploy

For a detailed list of the commands that Wrangler supports, refer to Commands. To learn more about Wrangler’s configuration file, refer to Configuration.