This is a Next.js 16 App Router site configured to deploy on Cloudflare Workers using @opennextjs/cloudflare.
Install dependencies:
npm installRun the standard Next.js dev server:
npm run devOpen http://localhost:3000.
Preview the production build locally in the Cloudflare Workers runtime:
npm run previewThis runs an OpenNext build and starts a local Wrangler preview server.
Deploy the app to Cloudflare Workers:
npm run deployIf you want Cloudflare env vars to remain managed in the dashboard, use:
npx opennextjs-cloudflare deploy -- --keep-varsSet NEXT_PUBLIC_SITE_URL to the canonical public site URL so metadata and Open Graph URLs are stable in production.
Examples:
NEXT_PUBLIC_SITE_URL=https://nottshack.example.comFor local Workers preview, you can optionally add a .dev.vars file with:
NEXTJS_ENV=developmentFor production deployments on Cloudflare:
- Set build-time variables in the Cloudflare dashboard under build variables and secrets.
- Set runtime variables in the Cloudflare dashboard under Worker environment variables or secrets.
- Keep
.env*and.dev.varslocal; do not commit them.
npm run build
npm run preview
npm run deploy
npm run cf-typegenwrangler.jsoncdefines the Worker entrypoint and asset binding for the OpenNext output.open-next.config.tsenables the Cloudflare adapter configuration.public/_headerssets long-lived caching headers for/_next/static/*assets.