Web Strategy & Frameworks

What is Astro JS?

Astro is an open-source, server-first web framework built specifically for content-driven websites. It compiles your UI components into pure, static HTML and CSS during the build process, removing all client-side JavaScript by default.

Dean Davis
Dean DavisWeb Designer in Basingstoke
August 28, 20267 min read
What is Astro JS? Server-first web framework and islands architecture

Astro is an open-source, server-first web framework built specifically for content-driven websites. It compiles your UI components into pure, static HTML and CSS during the build process, removing all client-side JavaScript by default.

Most modern frontend frameworks were engineered to solve the problems of complex web applications. Tools like React, Next.js, and Vue excel at building dashboards, software interfaces, and single-page apps (SPAs) that require heavy user authentication and continuous client-side state changes. However, when these application frameworks are used to build marketing sites, blogs, portfolios, or standard business landing pages, they force the user's browser to download, parse, and execute megabytes of unused JavaScript just to display static text and images.

Astro takes the opposite approach: Multi-Page Architecture (MPA). Every page is rendered as lightweight HTML. You only load JavaScript when and where your page actually needs interactivity.

1Core Architecture: Astro Islands

The technical foundation of Astro is its Islands Architecture (pioneered conceptually by Katie Sylor-Miller and popularized by Jason Miller).

An "island" is an isolated interactive component embedded directly inside an otherwise completely static HTML document. Multiple islands on the same page operate completely independently of one another. If an interactive widget on the right rail breaks or lags, it has zero impact on the rest of the page.

Architectural Blueprint

Astro Islands Architecture

Static Header (Pure HTML/CSS)
Static Content Area
(Zero JavaScript)
+ Interactive Island
(e.g. Vue Carousel)
+ Interactive Island
(e.g. React Form)
Static Sidebar Text
Static Footer (Pure HTML/CSS)
ASCII Diagram:
+-------------------------------------------------------+
|  Static Header (Pure HTML/CSS)                        |
+-------------------------------------------------------+
|                                                       |
|  Static Content Area          +--------------------+  |
|  (Zero JavaScript)            | Interactive Island |  |
|                               | (e.g. React Form)  |  |
|                               +--------------------+  |
|                                                       |
|  +---------------------+                              |
|  | Interactive Island  |      Static Sidebar Text     |
|  | (e.g. Vue Carousel) |                              |
|  +---------------------+                              |
+-------------------------------------------------------+
|  Static Footer (Pure HTML/CSS)                        |
+-------------------------------------------------------+

2Client Directives & Partial Hydration

In standard SPAs, "hydration" is an all-or-nothing process: the browser loads the entire framework runtime to attach event listeners to every element on the screen.

Astro uses partial hydration. You explicitly tell Astro when and how to load JavaScript for an individual component using template directives:

Hydrates the component immediately as soon as the initial HTML is parsed. Best for critical UI elements like primary navigation toggles or immediate search inputs.

Hydrates once the main thread is free and the browser triggers requestIdleCallback. Ideal for lower-priority interactive elements.

Hydrates only when the component enters the user's viewport via an IntersectionObserver. Perfect for interactive components located below the fold, such as carousels or contact forms.

Hydrates only if a specific CSS media query condition is met, preventing mobile devices from executing desktop-specific JavaScript.

3Server Islands

Astro also supports Server Islands using the server:defer directive.

This allows you to render the critical static parts of a page instantly from a CDN cache, while deferring personalized, dynamic, or uncacheable server components (like user profile badges, live stock counts, or personalized cart data) to stream in asynchronously after the initial page response.

4Standout Developer Features

Astro balances raw runtime speed with developer ergonomics.

1. UI-Agnostic Component Integration

Astro does not lock you into a proprietary templating ecosystem. You can use your favorite UI libraries side by side in the exact same codebase.

src/pages/index.astroCode snippet
---
// src/pages/index.astro
import ContactForm from '../components/ContactForm.vue';
import ProductGallery from '../components/ProductGallery.jsx';
import NewsletterSignup from '../components/NewsletterSignup.svelte';
---

<main>
  <h1>Product Showcase</h1>
  <ProductGallery client:idle />
  <ContactForm client:visible />
  <NewsletterSignup client:visible />
</main>

Astro converts non-interactive components to pure HTML at build time, stripping out the framework runtimes entirely.

2. Content Collections & The Content Layer

Managing content is built natively into the framework. Astro’s Content Collections provide type-safe Markdown and MDX handling.

You define schemas for your frontmatter using Zod, ensuring that missing dates, incorrect author IDs, or invalid tags trigger compile-time errors instead of breaking production builds:

src/content/config.tsTypeScript
// src/content/config.ts
import { defineCollection, z } from 'astro:content';

const blog = defineCollection({
  type: 'content',
  schema: z.object({
    title: z.string(),
    publishDate: z.date(),
    tags: z.array(z.string()),
    draft: z.boolean().default(false),
  }),
});

export const collections = { blog };

3. Built-In Performance Tooling

Native Image Optimization:

The <Image/> component automatically handles resizing, responsive srcset generation, and conversion to next-gen image formats like WebP and AVIF.

View Transitions API:

Native page transitions and persistent state between page navigations without converting your site into a heavy client-side SPA.

Astro Actions:

Type-safe, backend server functions that handle form submissions and data mutations directly with built-in validation.

5Astro vs. Next.js vs. WordPress

FeatureAstro JSNext.jsWordPress
Primary ArchitectureMulti-Page App (MPA)Single-Page App (SPA/Hybrid)Multi-Page App (MPA)
Client JavaScriptZero by defaultFull React runtime by defaultDependent on plugins/theme
Component SupportReact,Vue,Svelte,Solid,PreactReact onlyPHP / Block Editor
Rendering ModesSSG, SSR, Hybrid, Server IslandsSSG, SSR, ISRDynamic SSR (cached via plugins)
Hosting OptionsAny static host, Edge, VPS, Node.jsNode.js, Vercel, VPSPHP/MySQL hosting
Best ForContent sites, marketing, SEO speedSaaS apps, gated portals, user dashboardsNon-technical content teams

6When to Choose Astro (and When Not To)

Where Astro Excels

Marketing Sites & Landing Pages:

Instant load speeds, zero client runtime, and high Core Web Vitals scores directly impact conversion rates and organic search rankings.

Blogs & Documentation:

Built-in Markdown, MDX, and syntax highlighting make technical documentation fast and maintainable.

Directory Platforms & Portfolio Sites:

Scalable static site generation handles thousands of pre-rendered pages with minimal hosting overhead.

E-Commerce Showcases:

Fast catalog browsing paired with isolated interactive islands for cart functionality and checkout.

When to Look Elsewhere

Highly Dynamic Web Applications:

[Inference] If your project is a continuous, dashboard-style web application (such as a project management tool or an analytics interface) where nearly every UI element shares state and updates dynamically on the client, frameworks like Next.js, Remix, or Nuxt are generally better suited.

7Getting Started

Initialize a new project using the interactive setup wizard:

TerminalBash
npm create astro@latest

Follow the command-line prompts to configure your project folder and select a template. Once initialized, add integrations with a single command:

TerminalBash
# Add Tailwind CSS
npx astro add tailwind

# Add React component support
npx astro add react

Start the local development server:

TerminalBash
npm run dev

Your site runs locally at http://localhost:4321. Edit files inside the src/pages/ directory to automatically create file-based routes and begin building.

Dean Davis
Written By

Dean Davis

Freelance web designer and developer in Basingstoke crafting ultra-fast, modern websites using Astro and bespoke WordPress solutions.

Looking to build a high-performance Astro website? Let's talk
High-Performance Web Architecture

Ready to upgrade to lightning-fast web performance?

Whether you need a content-driven Astro site or a custom WordPress platform, I build web experiences designed for maximum speed, SEO ranking, and conversions.

Start Your Project