Cloudflare binding
Add a supported binding to an existing Cloudflare Worker
When to use it
Add a supported binding to an existing Cloudflare Worker. Use this when you want to add the corresponding files or task to your workspace.
Usage
npm exec -- nx generate @megamono/nx-cloudflare:binding --project="<project>" --type="service" --binding="<binding>" --dry-runReplace angle-bracket placeholders with reviewed values. Nx's --dry-run previews generator writes; remove it only after reviewing the plan. Examples use npm; use your workspace's package manager if it differs.
Options
Use these options with @megamono/nx-cloudflare:binding. Nx uses the camelCase names shown here; the CLI reference describes command-line aliases. Some options are required only for particular choices.
| Option | Required | Type | Default | Description |
|---|---|---|---|---|
project | Yes | string | — | Existing Nx Worker project name. |
type | Yes | string | — | — Allowed: "service", "kv", "r2", "d1", "hyperdrive", "queue-producer", "queue-consumer", "vectorize", "ai", "ai-search", "workflow", "analytics-engine", "browser", "images", "mtls", "dispatch-namespace", "assets". |
binding | Yes | string | — | Worker-visible binding name. |
resource | No | string | — | Cloudflare resource or Worker identity referenced by the binding. |
scriptName | No | string | — | Optional defining Worker for a Workflow binding. |
remote | No | boolean | — | Use the remote Cloudflare resource during local development. |
experimental | No | boolean | — | Record an experimental binding declaration. |
configPath | No | string | — | Explicit Wrangler config when the project contains more than one. |
dryRun | No | boolean | false | Print the deterministic plan without mutation. |
Next steps
Review changed files and run the affected project's checks. For options that accept structured values, run the generator's --help or consult the schema in the installed package.