Cloudflare Pages hosts static sites and frontend apps. It connects to a Git repo, runs a build command, and serves the output globally.
For an Astro static app, typical settings are:
Build command: pnpm buildOutput directory: dist
Environment variables can differ between production and preview. Use them for public build-time config, not secrets that must stay server-only in a fully static app.
TIP
Preview deployments are useful for checking pull requests before merging.
Further Learning
“Cloudflare Pages Astro” — Astro deployment guide
“Cloudflare Pages build configuration” — commands and output directory
“Cloudflare Pages environment variables” — production vs preview config
Cloudflare Pages Deployment
Cloudflare Pages is a free, simple way to host static sites and frontend apps. Connect it to your Git repository, tell it how to build your project, and it handles the rest — building, hosting, and serving your site worldwide.
The basic setup
For a typical static site (like an Astro project), the settings are just:
Build command: npm run buildOutput directory: dist
Push to your Git repo, and Cloudflare automatically rebuilds and redeploys your site.
Preview builds for every change
TIP
Every pull request gets its own preview deployment — a live, shareable URL to see exactly what that change looks like, before merging it into your main branch. Great for reviewing changes visually before they go live.
Environment variables
You can set different values for production vs. preview builds — but remember: since this is a static site, anything here ends up baked into the files anyone can view. Use it for public config, not secrets.
In one sentence
Cloudflare Pages connects to your Git repo, runs your build command, and hosts the output globally — every pull request gets a preview URL, and environment variables here are for public config, not secrets.
Want to go deeper?
Switch to Expert mode above for build configuration specifics and environment variable scoping.