Astro + Cloudflare Pages - General Usage Guide
Deploying Astro (Starlight) documentation sites to Cloudflare Pages is fast, secure, and scalable. Here’s a general overview:
Why Use Cloudflare Pages for Astro?
Section titled “Why Use Cloudflare Pages for Astro?”- Global CDN: Fast delivery worldwide
- Free SSL: Automatic HTTPS
- Git Integration: Deploy on every push
- Zero Config: No server management
- Preview Deployments: Test changes before going live
- Custom Domains: Use your own or a free
*.pages.devsubdomain
Basic Steps
Section titled “Basic Steps”- Create your Astro (Starlight) site
Terminal window pnpm create astro@latest -- --template starlightpnpm installpnpm run build - Push to GitHub/GitLab
- Connect to Cloudflare Pages
- Set build command:
pnpm run build - Set output directory:
dist(or your custom build dir)
- Set build command:
- Deploy!
- Use preview deployments for PRs
- Configure custom domains in the Pages dashboard
- For advanced control, use the Wrangler CLI
References
Section titled “References”- Astro Starlight Docs
- Astro Docs: Deploy to Cloudflare Pages
- Cloudflare Pages Docs
- SRA Climbing Adventure Docs
Bun vs pnpm: Comparison
Section titled “Bun vs pnpm: Comparison”| Feature | Bun | pnpm |
|---|---|---|
| Language | JavaScript/TypeScript runtime + package manager | Node.js package manager |
| Install Speed | Very fast (native, parallel) | Fast (symlink-based, parallel) |
| Disk Space Usage | Low (single global cache) | Very low (symlinks, global store) |
| Compatibility | Node.js, npm, Yarn, some edge cases | npm, Yarn, Node.js |
| Monorepo Support | Basic (improving) | Excellent |
| CLI Simplicity | All-in-one (run, test, install) | Focused on package management |
| Ecosystem | Newer, growing | Mature, widely adopted |
| Scripts | bun run, bun test, bun install | pnpm run, pnpm install |
| Windows Support | Partial (improving) | Full |
| Community/Docs | Growing, active | Large, mature |
Summary:
- Bun is an all-in-one JavaScript runtime and package manager, extremely fast, and great for new projects or those wanting a single toolchain. Still maturing for some advanced/edge use cases.
- pnpm is a mature, fast, and disk-efficient package manager for Node.js, ideal for monorepos and large projects.