intermediate

Pages

Deploy static and Jamstack frontends with preview builds, edge functions, environment variables, and framework adapters.

Pages hosts static sites and Jamstack frontends with Git-connected builds, preview deployments per branch, and optional Pages Functions (Workers) for serverless API routes. A typical FullStack JS flow: Vite or Next static export on Pages, API on Workers or a separate Node host, environment variables per preview and production.

| Feature | Use | |---------|-----| | Git integration | Auto build on push | | Preview URLs | PR review before merge | | Build command | `npm run build` with output dir | | Functions | `/functions` or advanced Workers binding |

Configure Node version, build cache, and framework preset. Custom domains attach through Cloudflare DNS with automatic HTTPS.

On interviews: Pages vs Vercel/Netlify, preview env secrets, SSR limitations, connecting Functions to KV/R2, and CI build failure debugging.

Common pitfalls: leaking preview env vars in client bundles; assuming full Next.js SSR without adapter; wrong output directory; API keys in public `VITE_` variables.

The trade-off is integrated edge hosting and previews versus framework-specific limits and splitting backend across platforms.

Checklist:

  • Separate public build-time from server secrets.
  • Pin Node and lockfile in CI builds.
  • Test preview URLs before production promotion.
  • Align Functions bindings with production Workers.