Briefing

Deploy Next.js 14 to Cloudflare Workers with @opennextjs/cloudflare

hosting
by Md Tarikul Islam · Stripe Cloudflare Vercel

Deploy Next.js 14 to Cloudflare Workers by installing @opennextjs/cloudflare, configuring scripts, and using Wrangler to build and push; set up GitHub Actions for CI/CD.

What to do now

Patch your Next.js projects to include the Cloudflare adapter, configure scripts, and set up CI/CD; test locally with wrangler dev before deploying.

Summary

Next.js 14 (App Router) projects can now be deployed to Cloudflare Workers using the @opennextjs/cloudflare adapter. The guide shows how to install the adapter and Wrangler, configure scripts in package.json, and wire OpenNext into next dev for local environment support. It explains that Cloudflare Workers use a V8 isolate runtime, offering near-zero cold starts and 300+ global edge locations, which outperforms Vercel's Hobby tier in latency and bandwidth. The adapter compiles a standard Next.js application into a .open-next/ bundle that supports SSR, ISR, middleware, and the Image component without major code changes. Deployment steps include building with opennextjs-cloudflare build, previewing locally with wrangler dev, and pushing to production with wrangler deploy. Continuous deployment is set up via GitHub Actions, and secrets are pushed to the Worker using the adapter's upload command. The article also highlights trade‑offs such as missing Node.js APIs like fs and child_process in the V8 isolate, but notes that most modern stacks (Next.js + Supabase + Stripe + Resend) work fine. Overall, the guide provides a runbook that reduces the learning curve for teams moving from Vercel to Cloudflare Workers.

Key changes

  • Install @opennextjs/cloudflare and Wrangler.
  • Add cloudflare-build, preview, deploy scripts to package.json.
  • Wire initOpenNextCloudflareForDev in next.config.mjs for local env.
  • Build with opennextjs-cloudflare build and deploy via wrangler deploy.
  • Use .dev.vars for local environment variables.
  • Enable continuous deployment with GitHub Actions.
  • Cloudflare Workers provide near-zero cold starts and 300+ edge locations.
  • Supports SSR, ISR, middleware, Image component without code changes.

Affects

internal

Customer impact

Analyzing matches…

Ask about this story

Impact on an agency? Which customers? Compare historically Risks of waiting