Scaffold a project, including boilerplate for a Rust library and a Cloudflare Worker. You can pass a name and template to this command optionally.
All of the arguments and flags to this command are optional:
name: defaults to
template: defaults to the
type: defaults to “webpack”
Creates a skeleton
wrangler.toml in an existing directory. This can be used as an alternative to
generate if you prefer to clone a repository yourself.
All of the arguments and flags to this command are options:
name: defaults to the name of your working directory
type: defaults to “webpack”.
Build your project. This command looks at your
wrangler.toml file and runs the build steps associated
"type" declared there.
Additionally, you can build different environments. This is useful if you have different builds for different environments, but typically isn’t needed. For more information see the environments documentation.
Configure your global Cloudflare user. This is an interactive command that will prompt you for your email and API key:
wrangler config Enter email: firstname.lastname@example.org Enter api key: ...
You can also use environment variables to configure these values.
Publish your Worker to Cloudflare. Several keys in your
wrangler.toml determine whether you are publishing to a workers.dev subdomain or your own registered domain, proxied through Cloudflare.
To use this command, the following fields are required in your
|name||the name of your worker||
|account_id||your Cloudflare account ID, this can be found in the Cloudflare dashboard||
From here, you have two options, you can choose to publish to your own domain or you can choose to publish to <your-worker>.<your-subdomain>.workers.dev.
wrangler subdomain <name>
After you have registered a subdomain, add
workers_dev to your
If you would like to publish to your own domain, you will need to specify these three fields in your
|route||The route you would like to publish to||
|zone_id||Your Cloudflare zone ID, this can be found in the Cloudflare dashboard||
If you would like to be able to publish your code to multiple places, please see the documentation for environments.
Preview your project using the Cloudflare Workers preview service.
wrangler preview will only bundle your project a single time. To enable live preview,
where Wrangler will continually update the preview service with the newest version of your project,
wrangler preview --watch
You can optionally pass
post and a
body to this command. This will send a request to your
worker on the preview service and return the response in your terminal. For example:
GET requests can be sent with
wrangler preview get
POST requests can be sent with
wrangler preview post hello=hello
Additionally, you can preview different environments. This is useful if you have different builds for different environments (like staging vs. production), but typically isn’t needed. For more information see the environments documentation.
Interact with your Cloudflare Workers KV store. Check out the docs.