OpenNext for Cloudflare

CCCOpen source

Infra · Build

The adapter that runs a full Next.js app on Cloudflare Workers with the Node.js runtime.

What it is

OpenNext is an open-source project that takes the build output of Next.js and repackages it for hosts other than Vercel. The @opennextjs/cloudflare adapter targets Cloudflare Workers and uses the Workers Node.js compatibility layer rather than the restricted Edge runtime, so server components, route handlers, middleware, ISR and image optimization work as they do locally. The build produces a Worker plus static assets that wrangler serves and deploys; caching backends (KV, R2, D1) are pluggable through a small config file.

The site's one-line start for a new app is npm create cloudflare@latest -- my-next-app --framework=next --platform=workers; existing apps add the adapter, an open-next.config.ts and a wrangler.toml, then run opennextjs-cloudflare build and opennextjs-cloudflare deploy.

Where it fits in the AI OS

Build, the web layer. It lets the website live on the same platform as the API worker, the database and the storage, which keeps the whole company on one bill, one CLI and one CI pipeline. For agents it means a deploy is a deterministic command, not a dashboard.

Insider notes

members

How Serge's stack uses it

apps/web, the membership site, is Next.js built with OpenNext and deployed as a Worker; CI runs opennextjs-cloudflare build with the commit SHA as the build id. The question "does OpenNext on Cloudflare hold up in production" was closed when the team found the live bulaev.ai and dozens of sibling sites already running on Next.js 15 + OpenNext + Workers + D1 + R2 through the Co.Actor Scale platform.

Setup in 5 minutes

  1. In an existing Next.js project: npm i -D @opennextjs/cloudflare wrangler.
  2. Add open-next.config.ts with the default export from the docs and a wrangler.toml with main = ".open-next/worker.js", assets and nodejs_compat.
  3. Add scripts: "preview": "opennextjs-cloudflare build && opennextjs-cloudflare preview", "deploy": "... deploy".
  4. npm run preview to run the Worker locally with your routes.
  5. Add .open-next to .gitignore, then npm run deploy.

Alternatives

  • Vercel — zero-config hosting from the framework's authors; costs scale with traffic and functions.
  • Cloudflare Pages with next-on-pages — the older path, Edge runtime only; being superseded by the Workers adapter.
  • Astro / SvelteKit on Workers — if you do not need Next.js, their Cloudflare adapters are simpler.
  • Self-hosted next start in a container — Fly.io, Railway or a VPS.