wrangler.toml Generator
Generate wrangler.toml configuration for Cloudflare Workers, Pages Functions, environments, routes, compatibility dates, assets, and bindings.
Basic Configuration
Choose a date no later than your deployment date. Newer dates enable newer runtime features.
Specify custom route patterns for the Worker.
Bindings
File Location
Where to place your wrangler.toml
wrangler.tomlwrangler.toml- •Place wrangler.toml at the root of your project repository.
- •Do not commit sensitive secrets directly in wrangler.toml; use Wrangler secrets instead.
- The selected compatibility_date is over 6 months old. Consider updating it to use newer V8 features and bug fixes.
wrangler.toml file. Use npx wrangler secret put instead.name = "my-worker" main = "src/index.ts" compatibility_date = "2025-07-01" [vars] ENVIRONMENT = "production" API_URL = "https://api.example.com"
Quick Summary
What is this tool?
The wrangler.toml file is the heart of any Cloudflare Workers project. It tells Cloudflare's infrastructure exactly how to run your code, what resources it has access to, and what its routing rules are.
It supports configuring multiple environments, connecting to databases (D1), object storage (R2), key-value stores (KV), and defining static asset directories.
How to Use This Tool
- Select if you are configuring a Worker or Pages deployment.
- Enter your project name and compatibility date.
- Configure your environments (Production, Preview).
- Add any necessary bindings for KV, R2, or D1.
- Copy the generated
wrangler.tomlto your project root.
What This Tool Generates
wrangler.toml— The primary configuration file for Wrangler CLI.
Best Practices
- Always set a compatibility_date. This ensures your Worker won't break if Cloudflare updates their runtime behavior.
- Use [env.production] blocks to cleanly separate your local/preview configurations from your live production settings.
- Keep your wrangler.toml checked into version control.
Common Mistakes
- Putting secrets directly in the [vars] section of wrangler.toml. They will be exposed in your git repository.
- Forgetting to update the compatibility_date to access new V8 runtime features.
- Misconfiguring the main entry point (e.g., pointing to src/index.ts instead of dist/index.js if you are compiling manually).
Security Notes
- Use Wrangler Secrets for all sensitive environment variables.
- Review your bindings carefully; do not give a preview environment access to your production D1 database unless absolutely necessary.
Frequently Asked Questions
What is wrangler.toml?
How do I create wrangler.toml?
Where do I put wrangler.toml?
Should secrets go in wrangler.toml?
How do I configure Cloudflare Workers environments?
How We Keep Your Configs Safe & Valid
Built-in Error Checking
Every file is checked against official rules. We catch missing fields and bad syntax. YAML indentation errors are flagged right away. Kubernetes, Terraform, and Docker specs are all covered. API versions and labels are verified too. You get valid output every time you generate.
100% Private & Local
All tools run in your browser only. Your API keys never leave your machine. We do not use any tracking scripts. No data is sent to any server. Passwords and secrets stay on your device. Crypto operations use the Web Crypto API. Your privacy is fully protected at all times.
Secure Settings by Default
Configs use safe defaults out of the box. Containers run as non-root users. Root filesystems are set to read-only. Dangerous Linux capabilities are dropped. Network policies limit pod-to-pod traffic. TLS 1.3 is enabled for web servers. Security headers are added where needed.
Ready for CI/CD & Git
Output files are ready for your Git repo. Use them with ArgoCD, Flux, or GitHub Actions. Files use clear formatting and comments. Code review is easy for your team. Indentation and key order are consistent. Test in staging before going to production. Every file is clean and well-structured.
Infrastructure as Code
Store configs in Git alongside your code. Terraform modules include typed variables. Backend configs support remote state locking. Outputs work across multiple modules. Ansible playbooks use clear task steps. Chef and Puppet configs are also supported. Every file works with version control tools.
Monitoring & Tracing
Set up Prometheus with auto-discovery rules. Create Grafana dashboards with template variables. Add alerting rules with severity labels. Use OpenTelemetry for trace collection. Forward logs to Loki or Elasticsearch. Connect to Jaeger or Tempo for tracing. Monitor metrics, logs, and traces together.
Container & Docker Safety
Dockerfiles use multi-stage builds for small images. Base images are pinned to exact versions. Dev files are excluded from final images. Health checks are added for orchestrator use. Containers switch to non-root users. Docker Compose uses named volumes and networks. Resource limits are set in deploy configs.
Multiple Output Formats
Export as YAML, JSON, HCL, or TOML. Kubernetes uses YAML with proper separators. Terraform uses HCL with correct escaping. JSON output has consistent indentation. Copy to clipboard with one click. Preview output with syntax highlighting. Line numbers help you review quickly.