Lesson 4 of 4
Publish with Cloudflare Pages
Turn your GitHub repo into a live website — free, fast, and automatically updated every time you push.
What is Cloudflare Pages?
Cloudflare Pages is a free service that hosts static websites. You connect it to a GitHub repository once; from then on, every time you push a change, Cloudflare automatically publishes the new version to a real web address and serves it from a fast global network. No servers to manage.
Deploy your site, step by step
- Make sure your website is pushed to a GitHub repo (that's Lesson 2). It needs an
index.htmlat the top level. - Create a free account at Cloudflare.
- In the dashboard, go to Workers & Pages → Create → Pages, then Connect to Git.
- Authorize Cloudflare to access GitHub and pick your repository.
- Configure the build settings (see below), then click Save and Deploy.
- Wait about a minute. Cloudflare gives you a live URL like
your-project.pages.dev. Open it — you're live! 🚀
The right settings for a plain static site
Because our site is hand-written HTML with no build tools, the settings are wonderfully simple:
Framework preset: None
Build command: (leave empty)
Build output directory: / (the repo root, where index.html lives)
Automatic deploys on every push
This is the part that feels like magic. Once connected, you never touch the Cloudflare dashboard again to update your site. The workflow becomes:
# Make an edit (yourself or with Claude Code), then:
git add .
git commit -m "Update the homepage headline"
git push
# Cloudflare notices the push and redeploys automatically.
# ~1 minute later, your live site shows the change.
Every push is also saved as its own deployment, so you can roll back to a previous version from the dashboard with one click if something breaks.
Using your own custom domain (optional)
The free .pages.dev address works forever, but you can attach your own domain
(like kadir.dev):
- Buy a domain (from Cloudflare Registrar, Namecheap, etc.).
- In your Pages project, open Custom domains → Set up a domain and enter it.
- Follow the DNS instructions. Cloudflare adds HTTPS (the padlock 🔒) automatically and free.
Bonus: the _headers file
Cloudflare Pages reads a special file named _headers in your repo to add
security and caching rules — no dashboard needed. This project includes one. A simple example:
# Apply these response headers to every page on the site
/*
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Optional, but a nice touch once you're comfortable — and a taste of how much Cloudflare can do for a "just static" site.
From zero to hero
You can now build a static website, version it with Git & GitHub, get help from Claude Code, and publish it live on Cloudflare Pages. That's the complete loop the pros use.
Next challenge: fork this site, change the colors and text to make it yours, push it, and watch it go live. Then build something brand new.