miniflare
TLDR
Start local worker
$ miniflare [worker.js]
Specify port$ miniflare [worker.js] --port [8787]
With KV namespace$ miniflare [worker.js] --kv [NAMESPACE]
With D1 database$ miniflare [worker.js] --d1 [DB]
With environment variables$ miniflare [worker.js] --env [.env]
Watch for changes$ miniflare [worker.js] --watch
SYNOPSIS
miniflare [options] [script]
DESCRIPTION
Miniflare is a simulator for Cloudflare Workers. It runs Workers locally with full support for KV, Durable Objects, R2, D1, and other Cloudflare services.
Miniflare enables local development and testing without deploying to Cloudflare.
PARAMETERS
--port port
HTTP port.--host host
Bind address.--kv namespace
KV namespace.--d1 database
D1 database.--r2 bucket
R2 bucket.--env file
Environment file.--watch
Watch for changes.--wrangler-config file
Wrangler config.
FEATURES
$ - KV storage
- Durable Objects
- R2 buckets
- D1 databases
- Cache API
- Scheduled events
- Durable Objects
- R2 buckets
- D1 databases
- Cache API
- Scheduled events
CAVEATS
Behavior may differ from production. Storage is local/temporary. Some features require configuration. Now integrated into Wrangler.
HISTORY
Miniflare was created by Brendan Coll in 2021 to enable local Cloudflare Workers development. It was later officially adopted by Cloudflare.
SEE ALSO
wrangler(1), workerd(1), cloudflared(1)


