Cloudflare Pages is one of the best free hosting options available for static sites. Combined with Astro’s blazing-fast static output, it is a powerful pairing that costs nothing and deploys globally.
Prerequisites
- A GitHub account
- A Cloudflare account (free tier)
- Your Astro project in a GitHub repository
- A domain (optional but recommended)
Step 1 — Push your project to GitHub
If your project is not already on GitHub, create a new repository and push your code:
git init
git add .
git commit -m "initial commit"
git branch -M main
git remote add origin https://github.com/your-username/your-repo.git
git push -u origin main
Step 2 — Connect to Cloudflare Pages
- Log in to dash.cloudflare.com
- Go to Workers & Pages → Create application → Pages
- Click Connect to Git and authorise GitHub
- Select your repository
- Set these build settings:
- Build command:
npm run build - Build output directory:
dist - Node.js version:
20(set in Environment Variables asNODE_VERSION=20)
- Build command:
- Click Save and Deploy
Cloudflare will build and deploy your site. Every push to main triggers a new deployment automatically.
Step 3 — Add your custom domain
- In your Pages project, go to Custom domains
- Click Set up a custom domain
- Enter
tensorflake.com - Cloudflare will automatically add the DNS records if your domain is on Cloudflare
Your site will be live at https://tensorflake.com within minutes.
Automatic Deployments
Once set up, your workflow is:
- Write a new post in
src/content/article/ git add . && git commit -m "new post" && git push- Cloudflare detects the push and redeploys — usually in under 60 seconds
No servers to manage. No costs. Global CDN included.