The @opennextjs/cloudflare package adapts Next.js standalone builds to run on Cloudflare Workers with the Node.js compatibility layer in workerd.
Overview
OpenNext for Cloudflare is an adapter that lets Next.js applications built with next build in standalone mode run on Cloudflare’s developer platform. It produces Workers-compatible output using the Workers Node.js compatibility layer in the workerd runtime, so apps can rely on the fuller Node.js runtime rather than the constrained Edge runtime.
Documentation contrasts this with older Cloudflare Next integrations that only supported the Edge runtime and therefore fewer Next.js features. Supported capabilities include App Router and Pages Router patterns, route handlers, dynamic routes, SSG, SSR, middleware, node middleware experiments, image optimization with Cloudflare Images, partial prerendering, ISR on Pages Router, composable caching, Turbopack builds, and related features across supported Next.js release lines.
Workflow: add the package, run npx @opennextjs/cloudflare, which builds via package.json scripts then transforms artifacts for local Wrangler runs and Cloudflare deployment. New projects can be scaffolded with create cloudflare using the Next framework on Workers. Windows is supported with caveats; WSL, Linux VMs, or Linux CI are recommended when native tooling is unreliable.
Worker upload size limits apply after build; Wrangler reports compressed size relevant to Cloudflare plan limits. The adapter is maintained as part of the broader OpenNext multi-platform effort alongside AWS and Netlify adapters.
Key features
- Standalone Next.js to Workers transform
- Node.js runtime on Cloudflare Workers
- Wrangler local run and deploy flow
- App Router and Pages Router support
- SSR, SSG, ISR, and middleware
- Image optimization integration path
- create cloudflare scaffolding option
- Prerelease npm builds from branches
Use cases
- Hosting Next.js on Cloudflare Workers
- Migrating existing Next apps to Cloudflare
- Needing Node APIs on edge infrastructure
- CI/CD Linux builds for Windows developers
- Multi-region Next.js at the edge