Skip to main content
Configure your Worker using wrangler.json or wrangler.toml. Wrangler supports both formats.
This documentation uses wrangler.json (JSONC format with comments). All examples can be converted to TOML format.

Configuration File

Location

Wrangler looks for configuration in:
  1. wrangler.json or wrangler.jsonc (JSON with comments)
  2. wrangler.toml
  3. Custom path: wrangler dev --config path/to/config.json

Basic Configuration

wrangler.json

Core Options

name

The name of your Worker (required for deployment):

main

Entry point for your Worker:
Supported formats:
  • *.ts - TypeScript
  • *.js - JavaScript
  • *.mjs - ES modules
  • *.tsx / *.jsx - JSX

compatibility_date

The compatibility date for the Workers runtime:
This locks your Worker to specific runtime behaviors. Always use the latest date when creating new Workers.

compatibility_flags

Enable experimental or backward-compatible features:
Common flags:
  • nodejs_compat - Node.js built-in modules and APIs
  • nodejs_als - Node.js AsyncLocalStorage
  • streams_enable_constructors - Writable/Transform stream constructors
  • transformstream_enable_standard_constructor - Standard TransformStream
See Compatibility Dates for all flags.

account_id

Your Cloudflare account ID:
Find your account ID in the Cloudflare dashboard URL or run wrangler whoami.

workers_dev

Deploy to *.workers.dev subdomain:
Set to false to only deploy to routes/custom domains.

Routes and Triggers

routes

Route patterns that trigger your Worker:
Or with zone configuration:

route (single)

Define a single route:

triggers.crons

Scheduled events (Cron Triggers):
Cron syntax:
  • 0 0 * * * - Daily at midnight UTC
  • */15 * * * * - Every 15 minutes
  • 0 */4 * * * - Every 4 hours
  • 0 9 * * MON-FRI - Weekdays at 9am UTC
Minimum interval: 1 minute on paid plans, 30 seconds on Enterprise.

Bindings

Bindings expose resources to your Worker via the env parameter.

KV Namespaces

Access in your Worker:

R2 Buckets

D1 Databases

Local development uses SQLite:

Durable Objects

Queues

Service Bindings

Bind to other Workers:
Use RPC for type-safe service bindings:

AI Bindings

Vectorize

Hyperdrive

Local connection string is only used in development.

Environment Variables

Define plain text variables:
For secrets, use .dev.vars in development and wrangler secret put for production.

Build Configuration

no_bundle

Skip the build step:
Use for pre-built Workers or when using an external bundler.

minify

Minify the bundled Worker:

keep_names

Preserve function and class names:

build.command

Custom build command:

rules

Module rules for non-JS files:
Rule types:
  • CompiledWasm - WebAssembly modules
  • Text - Text files
  • Data - Binary data as ArrayBuffer
  • ESModule - ES modules
  • CommonJS - CommonJS modules

tsconfig

Custom TypeScript configuration:

Development Configuration

dev

Development-specific settings:

dev.ip

Bind address for the dev server:

dev.port

Port for the dev server:

dev.local_protocol

Protocol for the dev server:

dev.persist_to

Persistence directory:

Environments

Define environment-specific configurations:
Use environments:

Assets

Workers Sites (Legacy)

Workers Sites is deprecated. Use Workers Assets instead.

Advanced Options

unsafe

Unsafe bindings for advanced use cases:

limits

Resource limits (Enterprise only):

logpush

Enable Logpush:

tail_consumers

Tail consumers for real-time logging:

placement

Smart Placement:

TypeScript Types

Generate TypeScript types from your configuration:
This creates worker-configuration.d.ts with type definitions for your bindings:
Use in your Worker:

Configuration Validation

Wrangler validates your configuration and shows helpful error messages:

Full Example

wrangler.json

See Also

Local Development

Run Workers locally with wrangler dev

Bindings

Learn about all available bindings

Environments

Manage multiple environments