Astro

Astro is a modern static site generator that allows developers to create high-performance websites and web applications using
TypeScript
. Some of the key features of Astro include:

Rendering Library Agnostic

Unlike most static site generators and frameworks that require developers to use a specific templating engine, Astro allows developers to use any front-end framework, library, or component they prefer. You can also mix and match them if you want, although you probably shouldn’t.

Server-First Approach

Astro provides you Astro components, that acts in a similar manner to Vue and Svelte components, but that are just for server side use. It’s like the template files used to render HTMl from the back-end, but with a more modern interface and implementation. Even when you are using a library such as React or AplineJS, that is only used to render on the back-end side by default. The purpose of this is to keep the bundle size as small as possible, only adding what is strictly necessary.

Islands

If you want to enable the UI library to be loaded on the front-end you can still do it, but you need to be explicit about that. We will discuss how to accomplish that when we talk about directives. But what you need to understand for now is that astro sees each page as static content with islands of interactive content. This blog for example, most of it is just statically generated content, aka a bunch of html files. But some parts of it, such as the search box in the menu, uses Svelte to manage user interaction and update itself. Svelte, or other UI library you might use, will be loaded only when an interactive land is present on the page, and they will only be mounted on those specific widgets instead of managing the whole page.

Server-Side Rendering (SSR)

Even though you should prefer to render everything at build time so your website is blazing fast, sometimes you need to run some logic server side on every request. That is of course possible with Astro, both to to render HTML using components or for API endpoints that return JSON, XML or any other text format. This will limit you on deployment options or infer in extra costs as it will use lambdas or other similar feature available on your hosting provider.

Many Built-in Features

It can be tiresome and even overwhelming to configure a project nowadays, you need to configure
TypeScript
, hot reloading, code splitting, tree-shaking and many other things. Most of it comes already configured and simply working with Astro, and of course you can customise it as well. But it is great to have such a great starting point.

Simple Integrations

Adding a UI library, configuring Tailwind, adding Partytown or building it to deploy in vercel is very simple and rarely requires more than a command on the console. Maybe it won’t have the specific library you want to use but it is pretty simple to create a plugin for it.
Keep tuned for a tutorial showing how to write a blog from scratch using Astro.