Astro is a brand new framework for building websites. To me, the big thing is that it allows you to build a site like you’re using a JavaScript framework (and you are), but the output is a zero-JavaScript static site. You can opt-in to client-side JavaScript as needed, and there are clever options for doing so. Notably, the learning curve is somewhat flattened by the fact that it supports componentry you may already know: React/Preact (JSX), Svelte, Vue, or web components.
Starting a new project is as easy as it should be:
npm init astro npm install npm start
There is a helpful little process and output:
As expected (like you would get with Next or Nuxt or any other site builder kind of project) you get a dev server at a local port you can pop right up:
From here, I consider the table stakes to be CSS injection / Hot Module Reloading. No worries there:
This is such a wonderful thing to me. I really like the idea of static site generators—I think they make a lot of sense in a lot of situations. Sending HTML over-the-wire is just a good move for resiliency, CDN-efficiency, SEO, accessibility, you name it. But in the past a lot of the options were either:
I know there are exceptions, but this covers the vast majority of the site generator market.
But I want both!
That’s what happens with Astro.
Those components?
Astro also has it’s own format (.astro) and it’s also very compelling because: