New: AI Coding Tools Guide — compare Cursor, Windsurf & more → Read now
Cloud cloudflare

Cloudflare Pages: Deploy Static Sites to the Edge

Complete guide to deploying Astro, Next.js, and static sites on Cloudflare Pages with global CDN and zero cold starts.

Sam Patel 9 min read

Why Cloudflare Pages?

Cloudflare Pages delivers static sites from 300+ edge locations with:

  • Zero cold starts
  • Unlimited bandwidth on free tier
  • Git integration
  • Preview deployments

Setup for Astro

Build command: npm run build
Output directory: dist
Node version: 22

Configuration

Connect your GitHub repository, set environment variables, and deploy. Every push to main triggers a production build.

Performance

Static assets are cached at the edge globally. HTML pages benefit from Cloudflare’s CDN with automatic HTTP/2 and Brotli compression.

Comparison

See how Cloudflare stacks up in our Vercel vs Netlify comparison — Cloudflare often wins on price and global reach for static content.

Frequently Asked Questions

Is Cloudflare Pages free?

Yes. The free tier includes unlimited static requests, 500 builds/month, and global CDN distribution.

What build command for Astro?

Use 'npm run build' with output directory 'dist' and Node.js version 22.

Does Cloudflare Pages support SSR?

Yes via Pages Functions, but static generation is recommended for content sites.

Related Articles