OptionalAICloudflare AI binding. Provides access to AI models for language processing or other AI tasks.
OptionalAI_Cloudflare AI Search binding, scoped to one instance. Managed retrieval over an indexed corpus — ask it a question in words and it answers with passages, or with prose grounded in them.
Declare it under ai_search in wrangler.json to enable it. That entry
also names the instance_name, which must exist at deploy time.
OptionalAI_Cloudflare AI Search binding, scoped to a namespace. Opens every instance in one namespace, so a request can name the instance rather than the deployment fixing it — a corpus per tenant, created as tenants arrive.
Declare it under ai_search_namespaces in wrangler.json to enable it.
OptionalBROWSERCloudflare Browser Rendering binding. A headless browser, reached through a browser automation library.
Declare it under browser in wrangler.json to enable it.
OptionalBUCKETCloudflare R2 binding. Object storage used for files and blobs.
Declare it under r2_buckets in wrangler.json to enable it.
OptionalDBCloudflare D1 binding. Serverless SQL database used for relational data.
Declare it under d1_databases in wrangler.json to enable it.
OptionalDOCloudflare Durable Object namespace binding. Provides strongly consistent, stateful coordination.
Declare it under durable_objects.bindings in wrangler.json to enable it.
OptionalFLAGSCloudflare Flagship binding.
Evaluates a feature flag at request time, so a value that would otherwise
be a vars entry can be moved by a targeting rule instead of a deploy.
Declare it under flagship in wrangler.json to enable it. That entry
also names the app_id the flags are read from, so a Worker reading two
apps declares two bindings.
OptionalHYPERDRIVECloudflare Hyperdrive binding. Pools and caches connections to an external SQL database.
Declare it under hyperdrive in wrangler.json to enable it.
OptionalKVCloudflare KV binding. Used for storing and retrieving key-value data.
OptionalLOG_Which ambient fields a log line carries, as a comma-separated list.
Overrides logging.fields from cloudflareDefaults, which already narrows
the line to what Cloudflare does not record on its own. Set it when this
Worker needs a different answer:
{
"vars": { "LOG_FIELDS": "requestId,method,path,ip,status,service" }
}
A deployment whose lines leave the Workers Logs console — Logpush, an OTel
export, a file — should add service. One investigating where traffic
lands should add colo and country. * keeps every field; "" keeps
none, leaving the level, the event and the message.
Names ambient fields only. What a call site passes to a single log call is always emitted, because someone chose to log it.
OptionalLOG_Severity threshold for this deployment, from vars in wrangler.json.
One of the two members here that are not bindings, and both earn the
exception by being what this package's own code reads. Anything in src/
that logs — the request middleware, an accessor reporting a degraded
resource — hands the Env it was given straight to Logger.fromEnv, and
the kernel asks for exactly this shape. Leaving each Worker to redeclare
them would make that call un-typeable from a generic
E extends CloudflareEnv.
Absent or unrecognised leaves the configured threshold in force, so a Worker that never sets it behaves as it did before.
OptionalPIPELINECloudflare Pipelines binding. Takes structured records and lands them in R2 as batched files, on a schedule and in a format configured on the pipeline rather than by the Worker sending to it.
Declare it under pipelines in wrangler.json to enable it.
OptionalQUEUECloudflare Queues producer binding. Used to enqueue messages for asynchronous processing.
Declare it under queues.producers in wrangler.json to enable it.
OptionalRATE_Cloudflare rate limiting binding. Counts requests against a key and reports whether one is within the rate.
The rate and window are fixed in wrangler.json rather than passed at
runtime, so a Worker needing two different rates declares two bindings.
Enforced per Cloudflare location and eventually consistent — an abuse
control, never an accounting record.
Declare it under ratelimits in wrangler.json to enable it.
OptionalSERVICE_Name stamped on every log line this Worker writes, from vars in
wrangler.json.
Declared beside the Worker's own name in the same file, on purpose: the
risk of a name in two places is that they drift, and keeping both in
wrangler.json means a rename that misses one is visible in the same diff.
{
"name": "example-worker",
"vars": { "SERVICE_NAME": "example-worker", "LOG_LEVEL": "info" }
}
Cloudflare records the script name on every log record itself, so the
default field list leaves service off the line — see LOG_FIELDS. This
still supplies the value whenever it is asked for, and it is what a line
carries once it leaves the Workers Logs console.
Absent, Logger falls back to logging.service on the configuration
surface, and then to unknown.
OptionalTELEMETRYCloudflare Analytics Engine binding. Used to log analytics data such as usage metrics or custom events.
OptionalVECTORIZECloudflare Vectorize binding. Vector index used for embeddings and similarity search.
Declare it under vectorize in wrangler.json to enable it.
OptionalVPC_Cloudflare Workers VPC binding, scoped to a private network.
Reaches anything on the bound Cloudflare Tunnel or Cloudflare Mesh, with
each call naming its own destination — so prefer VPC_SERVICE wherever a
single endpoint will do.
Declare it under vpc_networks in wrangler.json to enable it.
OptionalVPC_Cloudflare Workers VPC binding, scoped to one private service. Reaches a single host and port on a private network through a Cloudflare Tunnel, with nothing exposed to the internet.
Declare it under vpc_services in wrangler.json to enable it. That entry
names the service_id, which fixes the destination at deploy time.
OptionalWORKFLOWCloudflare Workflows binding. Durable execution — a run of steps that survives restarts and retries a failed step without replaying the ones before it.
Declare it under workflows in wrangler.json to enable it. That entry
also names the exported WorkflowEntrypoint class the instances run, the
same way a Durable Object binding names its class_name.
The Cloudflare half of a Worker environment: one member per platform resource that can be bound to a Worker.
Remarks
Everything here is a Cloudflare type from
@cloudflare/workers-types, bound by declaring the resource inwrangler.json. The names are the conventional ones this package defaults to; the types are the platform's.A consuming Worker extends this with its own variables and secrets:
This was an ambient global
interface Envwhile it lived in the boilerplate, merged into by declaring the same name. That works in one repository and not across a package boundary — a published package cannot reliably merge into a consumer's global scope, and two packages trying it would collide. Extending an exported interface gives the same combined type without any of that.Every member is optional, widened from the boilerplate's required
TELEMETRY,AI, andKV. A library cannot know which resources a Worker provisioned, and every accessor already looks its binding up by configured name and reports absence throughisBound. Requiring anything here would reject legitimate Workers without making a single lookup safer.A Worker binding a resource under a non-conventional name still satisfies this, and points the configuration layer at its own name.
Author
Bayu Dwiyan Satria
Version
1.0.0
Since
1.0.0