Deployment
Your docs site is a fully static build — no server needed. Deploy it anywhere static files are hosted. Cloudflare Pages is the recommended option: it’s fast, free, and has zero cold starts.
Cloudflare Pages (recommended)
Cloudflare Pages free tier includes unlimited sites, 500 builds/month, and global CDN distribution.
Steps
- Push your repo to GitHub or GitLab
- Open the Cloudflare dashboard → Workers & Pages
- Click Create application → Pages → Connect to Git
- Select your repository
- Configure the build:
| Setting | Value |
|---|---|
| Framework preset | Astro |
| Build command | npm run build |
| Build output directory | dist |
- Click Save and Deploy
Every push to your main branch triggers an automatic redeploy.
Custom domain
In Workers & Pages → your-project → Custom domains, add your domain. Cloudflare manages the SSL certificate automatically.
Build pipeline
flowchart LR
subgraph Local
A[Edit .md files] --> B[git push]
end
subgraph Cloudflare
B --> C[Pages build]
C --> D[astro build]
D --> E[/dist/]
E --> F[CDN edge nodes]
end
F --> G[Users worldwide]
Manual deploy with Wrangler
You can also deploy from the command line:
npm install -g wrangler
wrangler pages deploy dist --project-name=your-docs-site
Environment variables
Set them in the Cloudflare dashboard under Settings → Environment variables, or via Wrangler:
wrangler pages secret put MY_API_KEY
Access them in .astro files via import.meta.env.MY_API_KEY.
Preview deployments
Every pull request automatically gets a unique preview URL — great for reviewing docs changes before merging.