How to deploy your Astro site to the web
Push the project to GitHub, connect Cloudflare Pages once, buy the domain at cost, and run the proof pass on the live site. From then on, saving is publishing.
This is the lesson where the site stops living on your machine. By the end it is online at an address you own. Every site I showed you in lesson one runs on the same hosting you are about to use.
Going live is the one part of the course where the agent mostly watches: the road runs through two dashboards, and dashboards are clicks rather than code.
Back in Foundations, the version control lesson made a promise: connect the project once to a host, and every checkpoint you push publishes itself. This is that lesson.
Assignment: put the project on GitHub
Your site is a folder with checkpoints. GitHub gives that folder a home online, and the host you connect next watches that home for changes. A private repository is the right default, and everything works the same from one. This is the same move you made in Foundations; expect one sign-in along the way, which is GitHub authorizing your machine.
Create a private GitHub repository for this project and push everything to it. If the GitHub tooling is not set up on this machine, walk me through connecting my account first. Before you push, confirm .env is ignored and that no keys or secrets are in the project. Tell me the repository address when it is done.
Nothing in this build carries a secret, which you confirmed in the security pass last lesson, so the push is clean. The day you do add a key-based service, its key goes in the host’s settings, never in the repository.
A connected repository also quietly buys you one more thing: other people. House of Gandha, the candle shop from lesson one, deploys this way because I built it for a friend. The repository is how she holds her own code without me in the middle. Your site starts private and solo. The door is there when you need it.
Connect the site to Cloudflare Pages once
- Cloudflare Pages
- A free hosting service that serves your site from Cloudflare’s network around the world. You connect it to your repository once, and it rebuilds and republishes the site every time you push. Free at the size of any personal site.
The setup is five clicks-worth of dashboard. The labels drift a little as Cloudflare redesigns, but the shape does not.
- Make a free account at cloudflare.com. The free plan is the real product here, not a trial.
- Open Workers & Pages, then Create. You are creating a Pages project.
- Choose Connect to Git. Sign in with GitHub and allow Cloudflare to see the repository you just made. Private is fine.
- Pick the repository, then the Astro preset. The build command and output folder fill themselves in. Leave them as they are.
- Deploy. A minute or two later your site is live at a free address ending in pages.dev.
Pause on that. The site is on the internet, shareable, before you have spent a cent. And the connection you just made is permanent: from now on, every checkpoint the agent pushes is live about a minute later. Saving is publishing.
My own sites skip the dashboard and deploy from a single terminal command instead. Same destination, different door, and the connected repository is the better first setup, because it makes publishing automatic rather than something you remember to do.
Buy the domain at cost
Now the site deserves a better address than pages.dev, and this is the one place in the whole course where I will tell you exactly where to spend money. Buy the domain at Cloudflare, in the same account, under Domain Registration. Not at GoDaddy, and not at whichever registrar an ad shows you first.
The reason is the pricing shape, not brand loyalty.
A snapshot, July 2026. Domain prices move slowly, and the pattern moves not at all: judge a registrar by the renewal price, never the first-year price.
At Cloudflare: a .com costs $10.44 a year, which is the wholesale registry price passed straight through, and the renewal is the same $10.44. Privacy for the public ownership records is included.
The usual alternative: GoDaddy sells the first year for anywhere between one and twelve dollars, then renews around twenty-two. Most household-name registrars run that same shape, a teaser and then the real price, plus a checkout full of add-ons you do not need.
A domain bought where the site is hosted needs no pointing. The nameserver dance that usually sits between a new domain and a live site, the part that keeps beginners up at night, simply does not happen. That, more than the price, is why I stopped buying domains anywhere else.
On the name itself: .com if it is free, and a clean modern ending if it is not. The ending matters far less than people fear.
Point the domain at the site
Open your Pages project, find Custom domains, and add the domain you just bought. Because the domain and the site live in the same account, Cloudflare confirms it with you and wires it up in a few minutes. The padlock in the address bar arrives on its own, since the security certificate is issued automatically.
The sitemap and share tags were built against a placeholder address, because the real one did not exist yet. Now it does.
Assignment: wire in your real domain
Swap the bracket for your domain and run it. It ends with a checkpoint and a push on purpose.
My site is now live at [my domain]. Update the site address in the Astro config so the sitemap and tags build against it, check the pages for any leftover placeholder or localhost references, then checkpoint and push.
Cloudflare notices the push, rebuilds, and the fix is live about a minute later, at your name.
The proof pass: Lighthouse on the live site
This one counts, because it measures the site the way a stranger’s phone meets it: real network, real hosting, real address.
Have the agent look for itself, with the eyes you gave it two lessons ago.
Assignment: run Lighthouse on the live site
Point it at the live address, not localhost. You get ranked fixes back and decide what is worth chasing.
Open my live site at [my domain] in the browser and run Lighthouse on it. Give me all four scores, tell me what is dragging any of them down, and rank the fixes by how much each would move the number. Change nothing yet.
Go to pagespeed.web.dev, paste your address, and press Analyze.
The same Lighthouse checks, run from Google’s side, in any browser including your phone. Handy for the moment you want to show someone the score.
What comes back looks like this. My own site’s report, run for this lesson in July 2026:

If something does drag, it is nearly always the two suspects you already handled: images that skipped the optimization pass, or motion doing more than its job. Fix what the agent ranks first, push, and measure again on the live page.
Do not chase the last point. On a site this lean, green across the board is the normal outcome rather than the exceptional one, and a real 95 beats an afternoon spent hunting a synthetic 100. What the score is really telling you is that owning the site did not cost you quality.
You own it now
Lesson one named the one thing you take on when nobody hosts your site for you: you own it, so you check it. In practice that is small. Every month or so, have the agent bring the project’s dependencies up to date and rerun the security pass from last lesson. Everything else is just writing.
The folder is the site. It moves to any host, opens in any editor, and works with whichever agent you prefer next year. Nothing needs exporting, nothing is held hostage, and the meter never starts.
Your site is live, at a name that is yours, built from an empty folder in six lessons. Put the address in your bio and send it to the person who asked what you have been up to lately. More can land on top of this foundation: comparison pages, a blog, the deeper search work.
Lesson one made a promise about how this would end: not on a site you watched me build. On yours.