cloudflare-nextjs
Installation
SKILL.md
OpenNext Cloudflare Adapter — Next.js on Workers
Deploy Next.js applications to Cloudflare Workers using the OpenNext adapter (@opennextjs/cloudflare). The adapter takes a standard Next.js build, runs package.json build script, then transforms the output to run on the Workers runtime using the Node.js compatibility layer (nodejs_compat) — not the Edge runtime.
Critical Requirements (get these wrong and the build/runtime fails)
| Requirement | Value | Why |
|---|---|---|
| Runtime | Node.js (default). Remove every export const runtime = "edge"; |
Edge runtime is unsupported; OpenNext uses nodejs_compat. |
compatibility_flags |
["nodejs_compat", "global_fetch_strictly_public"] |
Node APIs + allow fetch() in app code. |
compatibility_date |
≥ 2024-09-23; ≥ 2025-05-05 recommended (FinalizationRegistry) |
Older dates break FinalizationRegistry, DOs, and more. |
| Wrangler | ≥ 3.99.0 to deploy; ≥ 4.13.0 for keep_names; ≥ 4.36.0 for stable remote bindings |
Feature gates in the docs. |
| Next.js | v16 all minors/patches supported; latest minors of v14 and v15; v14 dropped Q1 2026 | Stated on the overview page. |
| Worker size (gzip) | 3 MiB Free / 10 MiB Paid (compressed only) | Hard Cloudflare limits. |
Windows: not fully guaranteed (Next.js tooling issues). Use WSL, a Linux VM, or Linux/macOS CI. See known issue #1305.