Git-driven static hosting with edge Functions baked in. Connect a repo, get global deploys with preview URLs per pull request and zero infrastructure to manage. This site runs on it.
Pages is Cloudflare's Jamstack hosting platform. You point it at a GitHub or GitLab repo, pick your build command, and Cloudflare builds your site and distributes the output across 330+ edge locations. Every push to your production branch deploys globally; every pull request gets a unique preview URL.
The trick is Functions. Drop a file under functions/ and it compiles into a Worker route on the same deploy. You get server-side logic — form handlers, API proxies, auth checks — without leaving the Pages deploy pipeline. For teams that start with a marketing site and grow into an app, this is the ramp.
Pages also supports direct uploads via Wrangler for teams that want their own CI. The build pipeline is optional; the edge distribution is not.
Pages needs a build command and an output directory. For most frameworks this is auto-detected. You can also set environment variables and Node version in the dashboard or via wrangler.toml.
# wrangler.toml — Pages project name = "my-site" pages_build_output_dir = "./dist" # Compatibility flags for Functions compatibility_date = "2024-09-01" [[kv_namespaces]] binding = "CACHE" id = "abc123..."
Any file in functions/ maps to a route. functions/api/submit.ts becomes /api/submit. You get the same Workers API — env bindings, request.cf geolocation, waitUntil — without a separate wrangler project.
// functions/api/subscribe.ts export const onRequestPost: PagesFunction<Env> = async (ctx) => { const { email } = await ctx.request.json(); await ctx.env.DB.prepare( "INSERT INTO subscribers (email) VALUES (?)" ).bind(email).run(); return Response.json({ ok: true }); };
Every non-production branch gets its own URL: <branch>.<project>.pages.dev. PRs get a unique preview. QA, stakeholder review, and design feedback happen on live URLs without touching production. This is the feature teams actually love.
# Deploy via Wrangler (direct upload, skipping CI) npx wrangler pages deploy ./dist --project-name my-site # Preview a branch npx wrangler pages deploy ./dist \ --project-name my-site \ --branch feature/new-nav
Active repos with frequent pushes burn through this fast. Move to Wrangler direct upload if your CI already builds the site, or upgrade to Pro for 5,000 builds.
Pages Functions add a routing layer on top of Workers. For latency-critical APIs, a standalone Worker with custom routes can shave a few milliseconds.
Large doc sites or monorepos with generated assets can hit this. If you're close, split into multiple Pages projects behind a single domain with Workers routes.
Pages bindings historically lived only in the dashboard. Now wrangler.toml works too, but mixing the two is a source of "works locally, broken in prod" bugs. Pick one.