Miniflare
A local simulator for Cloudflare Workers that runs your code in the real workerd runtime and fakes the platform around it: KV, R2, D1, Durable Objects, Queues, the Cache API and more.
- What it is
- Local cloud emulators
- Type
- Open source
- Made by
- Cloudflare, Inc.
- License
- MIT
- Facts checked
- 12 October 2026
What it is
Since version 3, Miniflare does not reimplement the Workers runtime. It writes a workerd configuration for your Worker, starts a workerd process, and talks to it. workerd supplies the JavaScript engine and the binding APIs; what it does not include is the storage behind them, so Miniflare provides simulators for KV, R2, D1, Queues, Durable Objects, Workflows, static assets and the Cache API, storing data in SQLite plus a separate blob store. Data is kept in a temporary directory by default, or persisted to disk if you ask. One instance can run several Workers at once.
Miniflare is a library, not a command: it is the engine under wrangler dev, the Cloudflare Vite plugin and the Workers Vitest integration, and most people use it through those. Tool authors call it directly: create a Miniflare instance with options such as kvNamespaces or d1Databases, send requests with dispatchFetch(), read bindings from Node with getBindings(), then dispose(). You can point it at your own workerd build with MINIFLARE_WORKERD_PATH.
Why teams pick it
- Runs on the production runtime, so request-context rules and the latest V8 features behave as they do on Cloudflare, which Miniflare 2’s JavaScript reimplementation could not guarantee
- Fully offline and free: no account, no network, no billed KV or R2 operations, and paid features like Durable Objects can be tried locally
- Powers isolated per-test-file storage in the Vitest integration by stacking SQLite snapshots, so tests don’t leak state into each other
- Open source under MIT, in the same repository as Wrangler
Watch out for
- A low-level API for tool builders; Cloudflare tells most users to use Wrangler or the Vite plugin instead
- No CLI since v3: projects that ran
npx miniflarehad to move towrangler dev - Local resources start empty and are simulations, so production data, latency and quotas are not reproduced
- Not everything is simulated: Workers AI always calls the real service, and the README lists Analytics Engine, Vectorize and Workers for Platforms as not yet supported
Alternatives
What all local cloud emulators have in common →
FlociOpen sourceA young, MIT-licensed family of local emulators for AWS, Azure, Google Cloud and Oracle Cloud, built as a free drop-in for LocalStack and pitched at AI coding agents.
LocalStackCommercialThe best-known AWS emulator: one Docker container that answers more than 100 AWS APIs on localhost:4566, now free only for non-commercial use.How it fits with other technologies
What Miniflare uses
What uses Miniflare
Drive a Worker with a local KV namespace from Node.js · ts
import { Miniflare } from "miniflare";
const mf = new Miniflare({
modules: true,
compatibilityDate: "2026-10-01",
script: `export default {
async fetch(request, env) {
await env.CACHE.put("greeting", "Hello Miniflare!");
return new Response(await env.CACHE.get("greeting"));
},
};`,
kvNamespaces: ["CACHE"], // simulated locally, starts empty
});
const res = await mf.dispatchFetch("http://localhost:8787/");
console.log(await res.text()); // Hello Miniflare!
await mf.dispose(); // stops workerd, drops temporary dataSee it in a real stack
No architecture uses Miniflare yet. Drop it into the playground and wire it up yourself.Open playground →Where it came from2021–2024
At the end of 2020 Brendan Coll started building a Workers app and found that wrangler dev, which ran code on Cloudflare’s network, took a few seconds to reflect each change. Existing local simulators such as cloudflare-worker-local and cloudworker lacked newer features. What began as a pull request to cloudflare-worker-local became Miniflare 1.0, launched on the Workers Discord in July 2021 with near-instant reloads, source maps and a debugger.
Miniflare then became an official Cloudflare project. Miniflare 2.0 (January 2022) split each product into its own package, cut the install from 122 packages and 88.3 MB to 23 packages and 6 MB, added Jest support, and powered the local mode of wrangler 2.0. But it reimplemented the runtime in JavaScript on Node.js, and subtle mismatches, such as I/O shared across requests that works locally and fails in production, were hard to catch.
After Cloudflare open-sourced workerd, Coll announced Miniflare 3 in November 2022, rebuilt to run Workers inside it. It shipped as the engine of Wrangler v3’s local-by-default wrangler dev in May 2023, without its own CLI and with SQLite-backed storage, and in March 2024 it became the basis of a Vitest integration whose tests run inside workerd itself.
Why it’s built this way
- Run the real runtime instead of imitating it
- Miniflare 2’s JavaScript reimplementation drifted from production in ways developers could not see locally; running
workerdremoves that class of bug. - SQLite for every simulator
- Miniflare 2 used a custom key-value store; SQLite with a separate blob store allows richer queries and future storage products, and lets the Vitest integration snapshot and restore state per test.
- Drop the standalone CLI
- With
wrangler devrunning Miniflare locally by default, one command was enough, and Miniflare became an API for tools.
Timeline
- 2021
Miniflare 1.0 launches in July on the Workers Discord
- 2022
Miniflare 2.0 in January, built into wrangler 2.0’s local mode
- 2022
Miniflare 3, running on
workerd, announced in November - 2023
Wrangler v3 runs Miniflare 3 by default from May 17
- 2024
Workers Vitest integration, running tests inside
workerd, launches in March
- Cloudflare Blog: Miniflare 2.0, fully-local development and testing for Workers (Jan 2022)
- Cloudflare Blog: Doubling down on local development with Workers, Miniflare meets workerd (Nov 2022)
- Cloudflare Blog: Improved local development with wrangler and workerd (May 2023)
- Cloudflare Blog: Improved Cloudflare Workers testing via Vitest and workerd (Mar 2024)
Sources6 · facts checked 12 October 2026
- Cloudflare Workers docs: Miniflare
- Miniflare README in workers-sdk (options, bindings, persistence, MINIFLARE_WORKERD_PATH)
- Cloudflare Workers docs: Local development (Miniflare under wrangler dev and Vite, remote bindings)
- Cloudflare Workers docs: Vitest integration
- Cloudflare Blog: Improved local development with wrangler and workerd (May 2023), simulators and SQLite storage
- workers-sdk on GitHub (README)