Skip to content

Nx Cloudflare 7.0.0

Nx Cloudflare 7.0.0 is the biggest release yet. It moves Worker lifecycle tasks from hand-written executors to targets inferred from your Wrangler config, adds a binding generator for KV/R2/D1/Durable Objects/Queues/Workflows/RPC, leans on Cloudflare’s own create-cloudflare (C3) scaffolder, and removes the Next.js + webpack subsystem. Two migrations — one automatic, one prompt-based — handle the upgrade.

Worker tasks are no longer scaffolded as @naxodev/nx-cloudflare:serve / :deploy / :publish executors. Instead, every project with a Wrangler config automatically gets a set of targets that shell out to the Wrangler CLI:

TargetRunsWhat it does
servewrangler devLocal dev server (continuous; waits for “Ready on …”).
deploywrangler deployPublish the Worker to Cloudflare’s edge.
typegenwrangler typesGenerate worker-configuration.d.ts (Env + runtime).
version-uploadwrangler versionsUpload a new version without deploying it.
tailwrangler tailStream live production logs.

Target names are configurable via the plugin options, and you forward raw Wrangler flags after --:

bunx nx serve my-worker -- --remote
bunx nx deploy my-worker -- --dry-run

Because configuration now lives where Wrangler reads it natively, options that used to be executor settings (port, vars, routes, compatibility flags) move into your wrangler.jsonc/.toml. See the inferred targets reference.

Wiring a resource into a Worker is now a one-liner. The binding generator edits wrangler.jsonc, stubs any required code and migrations, emits a matching test, and refreshes the generated Env types:

# A KV namespace
bunx nx g @naxodev/nx-cloudflare:binding --project=my-worker --type=kv --binding=CACHE --id=abc123

# A Durable Object (adds the class stub + migration tag)
bunx nx g @naxodev/nx-cloudflare:binding --project=my-worker --type=do --binding=COUNTER --name=Counter

# Provision an R2 bucket as you add it
bunx nx g @naxodev/nx-cloudflare:binding --project=my-worker --type=r2 --binding=ASSETS --create

Supported types: kv, r2, d1, do (Durable Object), queue, workflow, and service (RPC to another Worker). See the binding generator guide.

The application generator now wraps Cloudflare’s own create-cloudflare (C3) CLI and then makes the result Nx-ready, so generated Workers match Cloudflare’s current templates and frameworks:

bunx nx g @naxodev/nx-cloudflare:application my-worker --framework=hono

Worker templates (--type), frameworks (--framework), and language (--lang) are forwarded straight to C3. See the application generator guide.

  • wrangler.jsonc by default. New Workers get a JSONC config (comments + trailing commas), with a configFormat option to opt back into TOML.
  • worker-configuration.d.ts is a generated artifact. It’s produced by the cached typegen target and git-ignored, rather than checked in.
  • Inferred Vitest test target. Generated Workers get a test target via @nx/vitest automatically.
  • Executors removed. serve, deploy, publish, and next-build executors are gone; their tasks are re-provided as inferred targets. Custom executor options must move into your Wrangler config or onto the inferred target’s command line.
  • Next.js + webpack subsystem removed. The plugin no longer ships withNx, composePlugins, or the next-build executor. For Next.js on Cloudflare, use @opennextjs/cloudflare (OpenNext) or Cloudflare Pages. Non-Next.js Workers are unaffected.
  • Nx 23 + Wrangler v4.98 are now required.

Run the migration — it generates a migrations.json, applies the deterministic inference migration automatically, and prints prompt-based instructions for removing Next.js references:

bunx nx migrate @naxodev/nx-cloudflare
bunx nx migrate --run-migrations

Then confirm the inferred targets resolve for each Worker:

bunx nx show project my-worker

The migration guide walks through both migrations in full, including what to do with dropped executor options.