Documentation

Cloudflare Workers

ready

Deploy unmodified Next.js 14, 15, and 16 (including native Turbopack) globally to your own Cloudflare account — Workers + R2 + D1 + KV + Hyperdrive + Queues + Vectorize + AI + Durable Objects, all configured from a single nextdeploy.yml.

Source reference: cli/internal/serverless/cloudflare*.go, shared/nextcompile/, docs/running-nextjs-16-turbopack-on-cloudflare-workers.md


Why Cloudflare Workers with NextDeploy

Works with the latest Next.js on day one — no adapter breakage. Unlike adapters such as OpenNext that try to shim Next.js into Cloudflare Workers by wrapping the webpack build output — and break when Next.js internals change (such as React vendoring in Next.js 16.4) — NextDeploy skips that entire layer. It takes the Turbopack standalone output directly and bundles its own Worker with a Go adapter (nextserver / nextcompile). No fragile JS shim, no webpack dependency, and no React version conflicts.

Deploy directly into your own Cloudflare account with zero per-seat markup, global edge execution, zero cold-start Node containers, and native bindings to R2, D1, KV, Hyperdrive, Queues, Vectorize, Workers AI, and Durable Objects — all declared in nextdeploy.yml and provisioned automatically via nextdeploy plan / nextdeploy ship.

This documentation site (https://nextdeploy.org) itself runs Next.js 16.4.6 + Turbopack + React 19.2.0 on Cloudflare Workers via NextDeploy's nextserver engine.

Production Capabilities Matrix

CapabilityStatusNotes
Next.js 14 / 15 / 16 & Native Turbopack✅ ReadyAuto-selects the nextserver engine for Turbopack builds (no --webpack workaround needed).
App Router & Pages Router SSR (ƒ)✅ ReadyExecuted by Next.js's own NextNodeServer inside workerd (nodejs_compat_v2).
Static & SSG (○, ●, generateStaticParams)✅ ReadyServed from R2 (env.ASSETS) for both HTML and client-side RSC Flight navigations (rsc: 1).
Progressive RSC Streaming (Suspense, loading.tsx)✅ ReadyZero-buffering Web ReadableStream ↔ Node ServerResponse HTTP bridge.
ISR & On-Demand Revalidation ("use cache")✅ ReadyR2 + KV CloudflareCacheHandler (entry + 16 MiB byte-budget LRU) registered for FetchCache, Default, and Remote on Symbol.for("@next/cache-handlers").
API Routes & Server Actions✅ ReadyFull App Router Route Handlers, mutations, revalidatePath, revalidateTag, cookies, and redirects.
Middleware & Proxy (proxy.ts)✅ ReadyRuns ahead of route rendering for auth, headers, redirects, and rewrites.
Custom not-found.tsx & error.tsx✅ ReadyPreserves true HTTP 404 / 500 status codes with custom error pages.
Edge Protection Guard✅ ReadyIPv4 & IPv6 CIDR allow/deny rules, KV or native Cloudflare ratelimit binding rate limiting, and HMAC session cookie auth ahead of Next.js.
Cron Triggers, Queues & Workflows✅ ReadyProtected internal triggers for /api/cron and /api/queue/[name] (granular { ack, retry } + DLQ), plus self-hosted Durable Objects & Workflows via extensions.
Multi-Environment Isolation & Canaries✅ ReadyPer-environment resource auto-suffixing (-e staging / -e pr-42), environments.* overrides, --canary <pct> gradual rollouts, nextdeploy promote, nextdeploy types, and nextdeploy dev.
Custom Domains, Static Assets & Atomic Releases✅ ReadyAutomatic custom domain attachment, versioned R2 releases with 5-build auto-GC, optional native workers_assets mode, and scoped edge cache purge.

Architecture at a Glance

next build (Turbopack or Webpack, output: "standalone")
  │
  ▼
nextcompile (Go) + in-process esbuild (~170 ms)
  ├── Virtual FS (vfs.mjs) — all .next/*.json manifests + BUILD_ID
  ├── Static Server Chunk Registry (chunks.mjs) — Turbopack/Webpack thunks
  ├── Streaming HTTP Bridge + CloudflareCacheHandler (R2 + KV)
  └── Single ESM Worker bundle (worker.mjs, ~1.60 MB gzipped)
  │
  ▼
nextdeploy ship
  ├── Auto-provisions R2, D1, KV, Queues, Hyperdrive (drift-checked via plan)
  ├── Syncs static & prerendered .html/.rsc assets to R2 (versioned keys)
  ├── Uploads Worker + secret bindings + custom domains via Cloudflare API
  └── Runs post-deploy SmokeVerify on live routes

How NextDeploy Compares to Wrangler / OpenNext

  • No wrangler.toml or Node adapter packages required: NextDeploy compiles .next/standalone directly in Go, bundles via in-process esbuild, uploads straight to the Cloudflare API, and reconciles bindings + secrets + custom domains from one nextdeploy.yml.
  • Unified multi-target workflow: Switch between VPS, AWS Lambda, and Cloudflare Workers using the same CLI (init, plan, build, ship, status, logs, rollback).

Where to Go Next

Related