# Next.js on Cloudflare Workers (OpenNext)

> Server-rendered Next.js without Vercel. The OpenNext adapter runs a normal Next.js build on Workers: SSR, ISR, server actions, middleware and image optimisation.

- Verdict: Use when it fits
- Vendor: OpenNext (open source), backed by Cloudflare
- Layer: [Edge](https://cloudlesslabs.com/stack/layers/edge.md). Job: Server-rendered Next.js
- Last reviewed: 20 October 2026, by Nicolas Dao (Cloudless Labs, Sydney)
- Web page: https://cloudlesslabs.com/stack/nextjs-on-workers/. The whole stack in one file: https://cloudlesslabs.com/stack/brief.md

**Warning:** Cloudflare now points new Next.js apps at vinext, its own rebuild of Next.js on Vite. vinext calls itself experimental: for production, I'd stay on OpenNext until that changes.

When a client needs server-rendered Next.js and I don't want to add Vercel to the bill, this is how I'd run it: a normal Next.js build, converted by the OpenNext adapter into a Worker. It sits on the same Cloudflare account as everything else, so there's one more Worker, not one more platform.

It's a translation layer, not Next.js's home. New features land on Vercel first and reach the adapter later, and a few aren't there yet. For most apps that doesn't matter. If it does, Vercel is the honest answer.

## Use it when

- A Next.js app that must render pages per request or per user: dashboards, personalised pages, logged-in areas.
- Lots of pages that change one at a time (a shop's products, a CMS): ISR rebuilds only the page that changed.
- You want Next.js on the stack you already run, not on another platform.

## Don't use it when

- A static site or SPA: Cloudflare static hosting is simpler and free.
- A content site you're starting fresh: Astro on Workers fits it better.
- You need every new Next.js feature on day one: Vercel builds Next.js, and the adapter follows. Node middleware (Next.js 15.2 and later) isn't supported yet.
- A heavy app: a Worker is capped at 10 MB compressed on the paid plan (3 MB free), so a big bundle needs trimming.

## Pricing

Workers pricing: Workers Paid is $5 a month with 10M requests and 30M CPU milliseconds included. ISR pages cache in R2.

## Gotchas, with fixes

- **Gotcha:** The build goes over the Worker size limit.
  **Fix:** Run `npx @opennextjs/cloudflare build` and read what's in the bundle; heavy server-only dependencies are the usual cause.
- **Gotcha:** ISR pages serve stale content longer than expected when the cache sits in Workers KV, which is eventually consistent.
  **Fix:** Use R2 for the incremental cache, as OpenNext's docs recommend (and D1 for the tag cache).

## Provisioning

Official Pulumi package · Official Terraform provider

The Worker, its R2 cache bucket and routes are ordinary Cloudflare resources. The build itself runs through the adapter's CLI (`opennextjs-cloudflare build`) before the deploy.

## Instead, consider

- [Astro on Cloudflare Workers](https://cloudlesslabs.com/stack/astro-on-workers/index.md): Content-heavy sites, or when you aren't tied to Next.js.
- [Vercel](https://cloudlesslabs.com/stack/vercel/index.md): A small team that wants Next.js with zero setup and every new feature first.
- [Cloudflare static hosting](https://cloudlesslabs.com/stack/cloudflare-static-hosting/index.md): Nothing needs rendering per request.

## Where it fits

- [A website, SPA or PWA](https://cloudlesslabs.com/stack/use-cases/website.md): pick 4. When it's a Next.js app that needs server rendering, without moving to Vercel.

## Sources

- [OpenNext: Cloudflare adapter](https://opennext.js.org/cloudflare)
- [Cloudflare Workers docs: OpenNext adapter](https://developers.cloudflare.com/workers/framework-guides/web-apps/opennext/)
- [OpenNext: caching on Cloudflare](https://opennext.js.org/cloudflare/caching)
- [vinext](https://vinext.dev/)

## Related

- [Edge](https://cloudlesslabs.com/stack/layers/edge.md): every tool in this layer, with its verdict
- [The whole stack in one file](https://cloudlesslabs.com/stack/brief.md): every use case and tool, for questions that span many
- [Map of every Markdown file on cloudlesslabs.com, with what each one answers](https://ask.cloudlesslabs.com)
