Free Astro tutorials for complete beginners.

Beginner's Guide to Astro

How to Register a Domain Name and Connect It to Your Astro Site

Buy a domain for about $11 a year, then point it at Cloudflare or Netlify. We did this for astrobeginner.com, and these are the exact steps.

Tested on Astro 7.4

Cover image for How to Register a Domain Name and Connect It to Your Astro Site
In this guide
  1. Step 1: Pick a name
  2. Step 2: Check the renewal price
  3. Step 3: Buy it
  4. Step 4: Connect it to your host
  5. Step 5: Make www and the bare name agree
  6. Step 6: Check it
  7. Where to go next
  8. Frequently asked questions

Your host gives you a free address, like yoursite.pages.dev. It works. But a real name, like yoursite.com, is the one thing on an Astro site worth paying for. Here’s how to buy one and connect it. We did this for astrobeginner.com.

Step 1: Pick a name

Short beats clever. Easy to say out loud beats easy to read. If you’d have to spell it on the phone, pick another.

Stick with .com if you can get it. People type it by habit. If your .com is taken, .co, .dev or your country’s ending are fine. Avoid endings nobody has heard of.

Step 2: Check the renewal price

Every seller shows a first-year price. Look for the renewal price, the one you’ll pay every year after. On November 8, 2026, Porkbun listed .com at $11.81 a year with the same price on renewal. Cloudflare Registrar sells domains at cost, with no markup. Some big-name sellers show $1 for year one and about $20 a year after that.

Also check that privacy protection is included. Without it, your home address is published in a public record.

Step 3: Buy it

Make an account, search the name, pay. You’ll get an email. Keep it. It has the login you’ll need once a year.

Step 4: Connect it to your host

There are two ways, and the host tells you which it wants.

The nameserver way. The host gives you two names, like chuck.ns.cloudflare.com. At your registrar, find Nameservers, choose Custom, paste both, save. This hands all the domain’s settings to the host. It’s what we did for astrobeginner.com, and it’s the simplest to manage later.

The DNS record way. The host gives you one or two records to add at your registrar, usually a CNAME pointing www at the host, and an A record or ALIAS for the bare name. At your registrar, find DNS and add exactly what the host shows.

Here’s where each host hides this:

Host Where to add your domain
Cloudflare Add the site to your Cloudflare account, then in the Worker, Settings, Domains & Routes, add the domain.
Netlify Domain management, Add a domain. Netlify offers its nameservers, or shows you records.
GitHub Pages Repository Settings, Pages, Custom domain. GitHub shows the records to add.

Step 5: Make www and the bare name agree

Decide on one. We use astrobeginner.com without www. Then set the other one to redirect to it, so both work and Google sees one site. Cloudflare does this with one redirect rule. Netlify does it in Domain management by setting a primary domain.

Step 6: Check it

Type the name in a browser. You should see your site with a padlock in the address bar. The padlock is HTTPS, and every host above sets it up for you for free. If it says “not secure” for the first few minutes, wait. Certificates take a moment.

Where to go next

Frequently asked questions

Where should I buy a domain?

Anywhere honest about the renewal price. We like Cloudflare Registrar, which sells at cost, and Porkbun, which includes privacy. Avoid anyone whose year-two price is double year one.

Do I need to buy privacy protection?

Check whether it's included. Cloudflare and Porkbun include it. Some sellers charge extra for it. Without it, your name and address are public.

How long until the domain works?

Usually a few minutes. Sometimes a few hours. Nameserver changes can take up to a day in rare cases.

Stuck on a step?

Check the common errors guide, look up a word in the glossary, or ask the friendly people in the official Astro and EmDash Discords. How to ask so people can help.

Keep reading

  1. How to Add Google Analytics to an Astro Site (and a Simpler Option)

    Paste Google's tag into your Astro layout with one small change, is:inline, and it works on every page. Or use Cloudflare Web Analytics, which needs no cookie banner.

    Tutorials, 6 minute read, November 8, 2026

  2. How to Add a Contact Form to an Astro Site (No Server Needed)

    A static site can't receive form submissions on its own. A free form service can. Here's a working contact form in ten lines, with spam protection built in.

    Tutorials, 7 minute read, November 8, 2026

  3. How to Add Search to an Astro Site With Pagefind

    Pagefind gives your static Astro site a real search box in about ten minutes, with no server and no monthly fee. It's what AstroBeginner uses.

    Tutorials, 8 minute read, November 8, 2026

Try "blog", "deploy" or "EmDash".