How to Build an Astro Static Site: A Beginner’s Guide (Using Claude Code)

An Astro static site is a website built with Astro, a free, open-source framework that turns your pages into plain HTML files before anyone visits. You can build one without coding by asking Claude Code to create the site, save it to GitHub and put it live on Cloudflare’s free plan. I built my first Astro site this way, and it had a working version live after one afternoon.

People I speak with often ask me how to build a website like this, because they would like one too but do not know where to start. Most of the guides they find are written for developers, so it is completely normal to feel a bit lost at first. I mainly work with WordPress and Astro was new to me, so I had many of the same questions when I started.

In this guide, I will walk you through how I built my first Astro static site with Claude Code, GitHub and Cloudflare. I will also share what confused me, what I would do differently, and when I would still choose WordPress instead. I am still learning Astro myself, so this is one beginner’s experience rather than expert advice.

What Is an Astro Static Site?

A static site is a website made of ready-made files, such as HTML, CSS and images. When someone visits a page, the server simply sends the finished file, instead of building the page from a database each time like WordPress does.

Astro is a static site generator, which means it turns your pages and blog posts into those finished files when you build the site. You may see it called Astro JS or the Astro framework, and it is free and open source under the MIT licence.

I am often asked how a static site can be safe and fast. With no database, no plugins and no admin login on the server, there is far less for hackers to attack and far less to slow your pages down. Your host just sends small, ready-made files to each visitor.

Astro vs WordPress: When I Would Pick Each

I work with WordPress every day, and it is still the right choice for many businesses. It is a great fit when a site needs regular updates, lots of features, or a team that wants full control through a familiar dashboard.

I would pick Astro when a website does not need many updates, and the client does not need the full setup that WordPress offers. That might be a client who is unlikely to keep their site updated, or who does not know how WordPress works. If they do not want much control either, a static Astro site could be the better way forward.

The one thing I would always check first is that the client knows how to edit their site. With Astro, your content lives in files rather than in a dashboard, so whoever runs the site needs a clear and simple way to make changes.

What You Need Before You Start

You only need a few accounts and tools to get going:

  • A Claude plan with Claude Code: Claude Code needs a paid plan, as the free plan does not include it. Pro costs $20 a month, or $17 a month when billed yearly.
  • A GitHub account: This is free, and private repositories are included on the free plan.
  • A Cloudflare account: The free plan is enough for a small static site, and requests to static files on Cloudflare Workers are free and unlimited.
  • A domain name: I bought mine from Spaceship, and it is a small yearly cost.

Claude Code and my domain were the only two things I paid for. I was on the Max plan because I use Claude for a lot of client work. For a site like this, though, Pro is enough, as long as you are smart with models and do not use Opus for everything.

You do not need to set up much by hand either. Astro needs Node.js version 22.23.4 or higher, and you can ask Claude Code to check this and run the Astro setup for you. The Claude desktop app also lets you use Claude Code without opening a terminal.

Step 1: Build Your Astro Site with Claude Code

Everything on my site was written by Claude Code, from the design and pages to the blog setup and basic SEO. I know a little about code from online courses and from working with WordPress, which helped me follow along, but I did not write the code myself.

I did not use an Astro theme. Instead, have a design or template ready before you ask Claude Code to build the site. I made my design in Google Stitch, an AI design tool from Google Labs, and Claude Code then built the site from it.

Claude Code also starts a small preview of the site on your computer. This means you can open it in your browser, look at each page, and ask for changes until you are happy with it.

Before you start, write down the true facts about you and your business, and give them to Claude Code. I built a drone guide site for beginners, and its first draft claimed things that were not true, like gear I do not own. Having a facts file made these much easier to correct.

Step 2: Save Your Site to GitHub

GitHub is where your site’s files are stored, and it keeps a history of every change you make. I kept my project in a private repository, which is free on GitHub.

This part was the most confusing for me, because commits, branches and pull requests were all new. Here is the plain version I wish I had at the start:

  • Commit: Saves a snapshot of your changes on your computer.
  • Push: Copies those changes up to GitHub.
  • Branch: A separate copy where you can try changes without touching your main version.
  • Pull request: A request to merge a branch into your main version.
  • Merge into main: The step that makes your changes go live, once Cloudflare is connected.

You do not need to remember all of this on day one. Ask Claude Code to explain each step before it does it, and to tell you which step makes your changes go live.

Step 3: Put Your Astro Static Site Live on Cloudflare

Cloudflare hosts your finished site, and it can also look after your domain. Astro’s deploy guide says Cloudflare recommends Cloudflare Workers for new projects, rather than Cloudflare Pages.

For beginners, I would suggest Workers Builds, which is Cloudflare’s own way to connect to GitHub. In the Cloudflare dashboard, you create an application and pick your GitHub repository, and from then on every change you merge into main builds and goes live by itself. The free plan includes 3,000 build minutes a month, which is plenty for a small site.

My own site uses a slightly different setup that Claude Code made with GitHub Actions, and it works well. If I started again, I would pick Workers Builds, because it is free and you set it up inside Cloudflare.

Once the site is live, you add your domain to the Worker as a custom domain in Cloudflare. If you bought your domain elsewhere, like I did with Spaceship, you first switch its nameservers to Cloudflare.

Cloudflare is not the only option. Bunny.net can also host static sites, using a storage zone for your files with its CDN in front. Its new command-line tool, still in public preview, can build and upload an Astro site for you.

How to Update Your Astro Site After It Is Live

I update my site by asking Claude Code to make the change, such as adding a new blog post or changing some text on a page. I normally start a new chat for each update, so every chat stays focused on one job.

Be specific when you ask. Tell Claude Code which page to change, exactly what the new text or post should say, and whether you would like it to go live when it is done.

Do Astro Sites Need Updates?

When I started, I believed an Astro site was completely safe and needed no maintenance, unlike WordPress. I found out that is not quite true during a design audit of my own site, when Claude Code ran a security check called npm audit. It flagged several “critical” and “high” warnings and recommended upgrading from Astro 6 to Astro 7.

The good news is that a static Astro site is far lower risk than WordPress, which runs live code, a database, plugins and a login page on every visit. On WordPress, a new security hole can be attacked on the live site very fast. Patchstack’s 2026 report found that the most targeted holes were attacked at scale a median of five hours after going public.

My site is fully static, so visitors only download plain HTML, CSS and images from Cloudflare. There is no database, no login page and no server code running when someone visits, which removes most of what attackers look for.

What the Warnings Actually Meant

Low risk is not the same as no risk, though. The tools that build your site are still software, and software has bugs. Most of the warnings I saw affected my own computer or the build on GitHub Actions, not the people visiting my site.

  • Astro (critical): A harmful AVIF image could run code during the build. Some values were also not safely escaped, which can lead to cross-site scripting (XSS). Two more bugs only affected server-rendered sites, so they did not apply to mine.
  • sharp (high): This is the tool Astro uses to resize photos, and a harmful image file could crash the build or worse.

In theory, the XSS bugs could end up baked into the HTML files visitors download, but only if an attacker’s text or images got into your content. If you write all the content and pick all the images yourself, the risk is low. It grows if you later pull in content from WordPress, other people or downloaded images.

Updates matter more if your Astro site is not fully static and uses on-demand (server) rendering on Cloudflare Workers. In that case, Astro code runs live every time someone visits, which is much closer to how WordPress works.

npm audit labels can also sound scarier than they are. “Critical” describes how bad the bug is, not how risky it is for your particular site. It is worth asking Claude Code whether each warning actually applies to your setup.

Claude Code did the upgrade to Astro 7 as a separate task, without mixing it in with other changes. It needed a one-line fix to the deploy workflow, and after that npm audit found no problems. Staying current is cheaper, because every major version you skip makes the next upgrade bigger.

My Simple Maintenance Routine

This is the routine I now follow:

  • Every 2 to 3 months: Or whenever you are working on the site anyway, ask Claude Code to update Astro and its packages and run npm audit.
  • Major upgrades on their own branch: Do big jumps like Astro 6 to 7 as a separate task, not mixed in with other changes.
  • Check before you merge: Run the build, check the preview at mobile, tablet and desktop widths, then merge into main.
  • Only open up the dev server when you need it: Turn on server.host: true only to preview on your phone, because it lets anyone on the same Wi-Fi reach your preview, and turn it off on public Wi-Fi.

Treat it as a 15-minute chore, not an emergency. The one exception is a site that uses server rendering, where a serious Astro warning is worth fixing straight away.

What I Found Confusing and What I Would Do Differently

My first deploy failed because I had not finished setting up my Cloudflare account. Set up your GitHub and Cloudflare accounts properly before you build anything.

I also ran several Claude Code chats on the same project at the same time, and they mixed up each other’s work. Nothing was lost, but it was hard to tell which chat had changed what, so one chat per task is much easier to follow.

At first, I also tried a visual site builder called Phantom Studio, but I may not have set it up correctly. Visual editors like Phantom Studio or Sitereal, a desktop builder that writes real Astro files into your project, can still work well. Just make sure you set them up properly and understand how you will edit the site afterwards.

If I started again, I would do everything with Claude Code, and take the time to understand how GitHub and Cloudflare Workers work. Ask Claude Code to guide you through each step, and to explain anything that is new to you.

FAQs

Yes, Astro is free and open source under the MIT licence. The Astro team joined Cloudflare in January 2026, and Astro says it will stay free and open source and keep supporting other hosts.

No, you can build one with Claude Code without writing the code yourself. It does help to learn a few GitHub basics, such as commits and merges, so you know what is happening when your site goes live.

Hosting can be free on Cloudflare’s free plan, so your main costs are a domain and a Claude plan. Requests to static files on Cloudflare Workers are free and unlimited, and GitHub’s free plan includes private repositories.

Not always. Astro suits simple sites that rarely change, while WordPress suits sites that need regular updates, lots of features or easy editing from a dashboard. Whichever you pick, make sure whoever runs the site knows how to edit it.

Cloudflare now recommends Workers for new projects. With Workers Builds, you connect your GitHub repository, and every change you merge into main builds and goes live.

The simplest option is to list your email address, which is what I do on my own site. If you would like a proper form, a service like Formspree works with static sites and emails you each message. Astro’s docs also show how to handle forms yourself with on-demand rendering and a server adapter, such as the Cloudflare one.

Yes, and in my view it suits WordPress sites that do not need many updates and are not dynamic. Astro’s migration guide covers exporting your posts to Markdown, or keeping WordPress as a headless CMS for writing. Larger or more complex sites may need some manual fixes after the move.

Yes, but far less urgently than WordPress sites. The tools that build your site still get security fixes, so update Astro and its packages every few months. If your site uses server rendering, keep a closer eye on Astro’s security advisories.

Would You Like a Second Opinion on Astro or WordPress?

Building a static site for the first time can feel like a lot, and getting stuck now and then is completely normal. If you are trying to decide between Astro and WordPress, I am happy to share what I have learned and give you a second opinion.

You can find out more about my website development services, or simply reach out and tell me about your project.

How this article was made

I write my articles with the help of an AI writing partner, and I would like to be open about how that works. Before anything gets written, the AI interviews me. It asks about my experience, my opinions, and what has and hasn’t worked for the clients I’ve been lucky enough to work with. It keeps asking follow-up questions until it has the full story, then writes the article in my tone of voice, guided by my previous blog posts.

The words are AI-assisted, but the experiences, examples, opinions and results are all my own, drawn from 10+ years working in digital marketing. Any facts or figures are checked against their original sources, and I read and edit every article before it goes live.

My hope is that this approach lets me share more of what I’ve learned, more often, in a way that’s actually useful to you. If you spot anything that looks off, or have a question, I’d genuinely love to hear from you.

Read moreShow less

Similar Posts