Skip to main content
Start a local development server for your Worker with hot reloading and live debugging.
wrangler dev [script] [options]

Arguments

script
string
The path to an entry point for your Worker

Options

Basic Options

--name
string
Name of the Worker
--compatibility-date
string
Date to use for compatibility checks
--compatibility-flags
string[]
Flags to use for compatibility checksAlias: --compatibility-flag
--latest
boolean
Use the latest version of the Workers runtimeDefault: true
--assets
string
Static assets to be served. Replaces Workers Sites.

Build Options

--no-bundle
boolean
Skip internal build steps and directly deploy scriptDefault: false
--minify
boolean
Minify the script
--jsx-factory
string
The function that is called for each JSX element
--jsx-fragment
string
The function that is called for each JSX fragment
--tsconfig
string
Path to a custom tsconfig.json file

Server Options

--ip
string
IP address to listen on
--port
number
Port to listen on
--inspector-port
number
Port for devtools to connect to
--inspector-ip
string
IP address for devtools to connect to
--local-protocol
string
Protocol to listen to requests on, defaults to httpChoices: http, https
--https-key-path
string
Path to a custom certificate key
--https-cert-path
string
Path to a custom certificate

Routing Options

--routes
string[]
Routes to uploadAlias: --route
--host
string
Host to forward requests to, defaults to the zone of project
--local-upstream
string
Host to act as origin in local mode, defaults to dev.host or route
--upstream-protocol
string
Protocol to forward requests to host on, defaults to httpsChoices: http, https

Environment Options

--var
string[]
A key-value pair to be injected into the script as a variable
--define
string[]
A key-value pair to be substituted in the script
--alias
string[]
A module pair to be substituted in the script

Mode Options

--remote
boolean
Run on the global Cloudflare network with access to production resourcesDefault: falseAlias: -r
--local
boolean
Run locally with remote bindings disabledAlias: -l

Advanced Options

--persist-to
string
Specify directory to use for local persistence (defaults to .wrangler/state)
--live-reload
boolean
Auto reload HTML pages when change is detected in local mode
--test-scheduled
boolean
Test scheduled events by visiting /__scheduled in browserDefault: false
--log-level
string
Specify logging levelChoices: debug, info, log, warn, error, none
--show-interactive-dev-session
boolean
Show interactive dev session (defaults to true if the terminal supports interactivity)
--types
boolean
Generate types from your Worker configuration

Examples

Start local development server

wrangler dev

Develop with specific entry point

wrangler dev src/index.ts

Run in remote mode

wrangler dev --remote

Specify custom port

wrangler dev --port 8080

Inject environment variables

wrangler dev --var API_KEY:secret123 --var ENV:development

Enable live reload

wrangler dev --live-reload

Test scheduled events

wrangler dev --test-scheduled
Visit http://localhost:8787/__scheduled in your browser to trigger a scheduled event.

Local vs Remote Mode

Local Mode (default)

Runs your Worker locally using Miniflare, which simulates the Workers runtime. This is faster and doesn’t count against your request limits, but some bindings may not work exactly as they would in production.

Remote Mode

Runs your Worker on Cloudflare’s global network with access to production resources. Use this when you need to test with real bindings or production-like behavior.
wrangler dev --remote

Build docs developers (and LLMs) love