> deploy & domains
Shipping Workers and Pages to Cloudflare and wiring them to the URLs that serve them. From one-command production deploys to per-environment deploys, custom domains, route patterns, and static-asset sites. Rule of thumb: `wrangler deploy` ships a Worker, `wrangler pages deploy` ships a Pages project.
// deploy & domains
11 commands$ wrangler deploy$ wrangler deploy --env production$ wrangler deploy -c wrangler.staging.jsonc$ wrangler deploy --dry-run --outdir dist$ wrangler deploy --domain api.example.com$ wrangler deploy --route "example.com/api/*"$ wrangler deploy --assets ./dist$ wrangler deploy --compatibility-date 2025-01-01$ wrangler deploy --triggers "*/5 * * * *"$ wrangler pages deploy ./dist --project-name my-site$ wrangler pages deploy ./dist --project-name my-site --branch preview// faq
What's the difference between a custom domain and a route?
A custom domain (--domain) creates a dedicated DNS record and points the whole hostname at your Worker, with TLS provisioned automatically — use it when the Worker IS the site at that hostname. A route (--route) matches a URL pattern inside a zone you already run through Cloudflare, so the Worker intercepts only some paths while the rest hit your origin.
How do I deploy to staging vs production?
Define [env.staging] / [env.production] blocks in your wrangler config and pass --env production (or -e). Each env gets its own name, vars, routes, and bindings, and --env also selects the matching .env / .dev.vars file. If prod and staging live in separate config files instead, pick one with -c wrangler.prod.jsonc.
Does wrangler deploy build my code first?
Yes — deploy bundles your entry point with esbuild and then uploads. Use --dry-run --outdir dist to run the build and inspect the output bundle without shipping, or --no-bundle to skip bundling when you've already built the Worker yourself.