OpenNext for Cloudflare is Cloudflare specific adapter that enables deployment of Next.js applications to Cloudflare.
This monorepo includes a package for adapting a Next.js application built via next build (in standalone mode) to run in the Cloudflare workerd runtime using the Workers Node.js compatibility layer.
Follow instructions at @opennextjs/cloudflare.
The repository contains two directories:
packagescontaining a cloudflare package that can be used to build Cloudflare workers compatible output from Next.js applicationsexamplescontaining Next.js applications that use the above mentioned cloudflare.
Install the dependencies:
pnpm ibuild the worker with:
pnpm --filter cloudflare buildor in watch mode with:
pnpm --filter cloudflare build:watchbuild and preview the worker for the api application:
pnpm --filter api preview:workerYou can skip building the next app when it has not been modified:
SKIP_NEXT_APP_BUILD=true pnpm --filter api preview:worker