Anatomy
How this site is wired
Static export plus one edge function — the smallest setup that still exercises the parts of Cloudflare Pages worth testing.
Files that matter
app/Next.js App Router pages. Every route is prerendered to static HTML by next build.
next.config.mjsoutput: 'export' turns the build into a plain ./out folder — no Node server needed.
functions/api/hello.jsA Cloudflare Pages Function. Lives outside the Next build and is deployed straight to the Workers runtime at /api/hello.
public/_headersCustom response headers applied by the Cloudflare CDN.
public/_redirectsRedirect rules — /old-page sends you back to /.
.node-versionPins the Node version the Pages build container uses.
app/not-found.jsExported as 404.html, which Pages serves for unknown paths.
Cloudflare build settings
| Framework preset | None (the Next.js preset still injects a removed next export step) |
|---|---|
| Build command | npm run build |
| Output directory | out |
| Root directory | leave empty |