Deploy static sites and full-stack applications to Cloudflare Pages. Use when deploying web applications built with Next.js, Astro, SvelteKit, Vite, or any static site generator, with automatic preview deployments and Git integration.
Deploy static and full-stack web applications to the edge.
CLOUDFLARE_API_TOKEN with Cloudflare Pages:Edit permissionCLOUDFLARE_ACCOUNT_ID./dist, ./build, ./out)npm run build
# First deployment creates the project
wrangler pages deploy ./dist --project-name my-site
# Subsequent deployments
wrangler pages deploy ./dist --project-name my-site
// functions/api/data.ts
export const onRequestGet: PagesFunction = async (context) => {
return Response.json({ message: 'Hello from the edge!' });
};
# wrangler.toml
[[d1_databases]]
binding = "DB"
database_name = "my-db"
database_id = "xxx"
| Framework | Build Command | Output |
|---|---|---|
| Vite/React | npm run build | dist |
| Next.js | npx @cloudflare/next-on-pages | .vercel/output/static |
| Astro | npm run build | dist |
| SvelteKit | npm run build | .svelte-kit/cloudflare |
| Hugo | hugo | public |
functions/
├── api/
│ ├── hello.ts → /api/hello
│ ├── users/
│ │ ├── index.ts → /api/users
│ │ └── [id].ts → /api/users/:id
│ └── [[path]].ts → /api/* (catch-all)
└── _middleware.ts → Runs before all routes
| Resource | Free | Pro |
|---|---|---|
| Sites | Unlimited | Unlimited |
| Requests | Unlimited | Unlimited |
| Bandwidth | Unlimited | Unlimited |
| Builds/month | 500 | 5,000 |
| Concurrent builds | 1 | 5 |
| Max file size | 25MB | 25MB |
<hash>.<project>.pages.dev and <branch>.<project>.pages.dev._redirects and _headers files in output directory for custom rules.@cloudflare/next-on-pages adapter for full compatibility.wrangler pages secret put or dashboard.