# Cloudflare worker

Create a convention-aligned Cloudflare Worker


## When to use it

Create a convention-aligned Cloudflare Worker. Use this when you want to add the corresponding files or task to your workspace.

## Usage

```sh
npm exec -- nx generate @megamono/nx-cloudflare:worker --name="<name>" --dry-run
```

Replace 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:worker`. Nx uses the camelCase names shown here; the [CLI reference](/docs/cli) describes command-line aliases. Some options are required only for particular choices.

| Option | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | Yes | string | — | Nx project name. |
| `directory` | No | string | — | Workspace-relative application directory. |
| `workerName` | No | string | — | Cloudflare Worker binding identity; defaults to the project name. |
| `scope` | No | string | "shared" | Megamono scope tag. |
| `tags` | No | string | — | Additional comma-separated Nx tags. |
| `pages` | No | boolean | false | Reserved Pages selection; rejected by the v1 Worker generator. |
| `skipFormat` | No | boolean | false | Compatibility option for composing the generator inside a larger formatter transaction. |
| `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.

- [All generators](/docs/generators)
- [CLI overview](/docs/cli)
- [Adopt an existing workspace](/docs/workflows/adoption)
