A ready-to-deploy wrangler.toml
Cloudflare Workers read their entire deploy configuration from wrangler.toml: the entry point, the runtime compatibility date, routes, and resource bindings. Getting the TOML syntax and binding shapes right by hand is error-prone, so this builder generates a valid file from simple inputs.
How it works
The tool writes top-level keys — name, main, optional account_id, and compatibility_date — then appends TOML table arrays for anything you enable. A route becomes a [[routes]] table with a pattern and optional zone_name. KV, R2, and D1 each get their correct array-of-tables form: [[kv_namespaces]] with binding + id, [[r2_buckets]] with binding + bucket_name, and [[d1_databases]] with binding, database_name, and database_id. String values are TOML-quoted and escaped so special characters do not break parsing. An optional [env.staging] block adds a named environment with its own name and a vars table.
Example and notes
A minimal Worker needs only name, main, and compatibility_date. Add a route like example.com/api/* to serve a path on your own domain, and add bindings as you adopt storage. Binding variable names are what you reference in code via env.MY_KV, so keep them descriptive. After copying the file, run wrangler deploy (or wrangler deploy --env staging) to ship.