Miniflare accepts a comprehensive set of options for configuring Workers, bindings, and runtime behavior.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/cloudflare/workers-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Worker Options
These options configure the Worker script and module system.name
Unique identifier for the worker. Required when using multiple workers.
script
Worker script contents as a string. Mutually exclusive with
scriptPath.scriptPath
Path to the worker script file. Mutually exclusive with
script.modules
Whether the worker uses ES modules format (vs. service worker format).
modulesRoot
Root directory for resolving module imports.
modulesRules
Rules for importing non-JavaScript files.
Runtime Options
compatibilityDate
Compatibility date in YYYY-MM-DD format.
compatibilityFlags
Compatibility flags to enable.
routes
Route patterns this worker handles.
upstream
Upstream URL for fetch requests that don’t match routes.
Server Options
host
Host to bind the HTTP server to.
port
Port for the HTTP server. Use 0 for a random available port.
inspectorPort
Port for the Chrome DevTools inspector.
Logging Options
log
Custom logger instance.
verbose
Enable verbose logging.
Binding Options
bindings
Simple environment variables and bindings.
kvNamespaces
KV namespace bindings. Map of binding names to namespace IDs.
durableObjects
Durable Object bindings.
r2Buckets
R2 bucket bindings. Map of binding names to bucket names.
d1Databases
D1 database bindings. Map of binding names to database IDs.
serviceBindings
Service bindings to other workers.
queueProducers
Queue producer bindings.
queueConsumers
Queue consumer configuration. Map of queue names to options.
analyticsEngineDatasets
Analytics Engine dataset bindings.
Persistence Options
defaultPersistRoot
Default root directory for all persisted data.
kvPersist
Enable KV persistence.
true uses default path, or specify directory.durableObjectsPersist
Enable Durable Objects persistence.
r2Persist
Enable R2 persistence.
d1Persist
Enable D1 persistence.
cachePersist
Enable Cache API persistence.
Multi-Worker Options
For running multiple workers in the same Miniflare instance:workers
Array of worker configurations. Each worker has all the options listed above plus a required
name.Advanced Options
cf
Custom
request.cf object properties.unsafeEvalBinding
Binding name for unsafe eval functionality (for REPL-like use cases).
liveReload
Inject live reload script into HTML responses.
mounts
Mount other Miniflare instances at specific routes.