interface CloudflarePluginOptions
Since 0.2.0

Options for CloudflarePlugin.

Examples

Bindings only

import { env, waitUntil } from 'cloudflare:workers';

app.register(CloudflarePlugin({ env, waitUntil }));

Also serving cache and storage from the platform

app.register(CloudflarePlugin({
  env,
  waitUntil,
  cache: { binding: 'CACHE_KV', prefix: 'cache:' },
  storage: { binding: 'UPLOADS' },
  requireBindings: ['CACHE_KV', 'UPLOADS', 'SESSIONS'],
}));

Properties

The Worker's env, from import { env } from 'cloudflare:workers'.

Passed in rather than imported by this package: cloudflare:workers is unresolvable outside a Worker toolchain, so importing it here would break type-checking on every other runtime.

readonly
optional
waitUntil: WaitUntilHost

The platform's background-work sink, from import { waitUntil } from 'cloudflare:workers' (available from compatibility date 2025-08-08).

Omitting it leaves bindings.waitUntil() running the promise without extending the invocation — correct off Cloudflare Workers, and a silent truncation risk on it, so pass it whenever deploying to Workers.

readonly
optional
requireBindings: readonly string[]

Bindings that must be present. register() throws naming every absent one, so a missing wrangler.toml stanza fails at startup instead of on the first request that needs it.

readonly
optional
cache: KvCacheOptions

Serve CAPABILITIES.CACHE from a KV namespace. Omitted registers nothing.

readonly
optional
storage: R2StorageArm

Serve CAPABILITIES.STORAGE from an R2 bucket. Omitted registers nothing.

readonly
optional
queue: WorkersQueueArm

Serve CAPABILITIES.QUEUE from a Queues producer binding. Omitted registers nothing.

readonly
optional
messaging: WorkersMessagingArm

Serve CAPABILITIES.MESSAGING from a Queues producer binding. Omitted registers nothing.

Serve CAPABILITIES.REALTIME_BACKPLANE from a Durable Object namespace. Omitted registers nothing.

Usage

import { type CloudflarePluginOptions } from "cloudflare-plugin/src/index.ts";