What is Astro?
Astro is a web framework that ships zero JavaScript by default and uses island architecture for partial hydration.
What is Astro?
Astro is an open-source web framework, first released in 2021, that outputs static HTML with zero client-side JavaScript by default. It introduced the concept of island architecture to the mainstream: interactive UI components ("islands") hydrate independently while the rest of the page stays as pure HTML. Astro 5, released in December 2024, added Content Layer for type-safe data loading and Server Islands for deferred server-rendered components. The framework is UI-agnostic — you can use React, Vue, Svelte, Solid, or Preact components in the same project. Because non-interactive pages ship no JS bundle at all, Astro sites routinely score 95-100 on Lighthouse performance audits. We use Astro as our default framework at Social Animal for content-heavy sites, marketing pages, documentation portals, and glossary sites like this one.
How it works
Astro uses .astro single-file components with a frontmatter script fence (similar to Markdown frontmatter) and an HTML template below it. The frontmatter runs at build time (or request time in SSR mode), not in the browser.
---
// This runs on the server / at build time
const posts = await fetch('https://api.example.com/posts').then(r => r.json());
---
<html>
<body>
<h1>Blog</h1>
{posts.map(post => <article><h2>{post.title}</h2></article>)}
<!-- This React component hydrates independently -->
<SearchWidget client:idle />
</body>
</html>
The client:* directives control hydration strategy per component:
client:load— hydrate immediately on page loadclient:idle— hydrate when the browser is idle (requestIdleCallback)client:visible— hydrate when the component enters the viewport (Intersection Observer)client:media— hydrate when a CSS media query matchesclient:only— skip SSR entirely, render only on client
If no client: directive is present, the component renders to HTML at build time and ships zero JavaScript. This is the key architectural decision: JS is opt-in per component, not opt-out per page.
Astro supports three output modes: static (full pre-render at build), server (on-demand SSR), and hybrid (per-route choice). It deploys to Vercel, Netlify, Cloudflare Workers, Deno, and Node via official adapters.
When to use it
Astro is the right call when your site is primarily content with pockets of interactivity. That covers a lot of ground:
When YES:
- Marketing sites, landing pages, and portfolios
- Documentation sites and knowledge bases
- Blogs and editorial publications
- E-commerce storefronts where product pages are mostly static
- Any project where Core Web Vitals and SEO matter more than app-like interactivity
When NO:
- Highly interactive SPAs (dashboards, real-time collaboration tools, complex forms) — use Next.js or SvelteKit instead
- Projects where your entire team already knows Next.js and the site is app-heavy — switching frameworks for marginal gains isn't worth the ramp-up
- If you need deeply nested shared client state across most components, Astro's island model adds friction
We've shipped Astro on 50+ projects. Our rule of thumb: if more than 60% of the page is static content, Astro wins.
Astro vs alternatives
| Feature | Astro | Next.js (15) | SvelteKit | Hugo |
|---|---|---|---|---|
| Default JS shipped | 0 KB | ~80-100 KB+ | ~15-25 KB | 0 KB |
| UI library lock-in | None (multi-framework) | React | Svelte | None (Go templates) |
| SSR support | Yes (hybrid) | Yes | Yes | No |
| Island architecture | Built-in | No (RSC is different) | Experimental | No |
| Content collections | Built-in (Content Layer) | Manual / MDX | Manual / mdsvex | Built-in |
| Build speed (1000 pages) | ~5-10s | ~15-30s | ~10-20s | ~1-2s |
Next.js is the better choice for app-heavy projects. Hugo is faster for pure static builds but has no component model. SvelteKit is a strong middle ground if your team is Svelte-native. Astro's unique advantage is mixing multiple UI frameworks in one project while keeping the JS budget at zero by default.
Real-world example
Our preferred stack for glossary and documentation sites is Astro + Content Layer + Cloudflare Pages. For this very site (socialanimal.dev), we use Astro's content collections to type-check every glossary entry at build time — if a related term slug doesn't exist, the build fails. Pages pre-render in under 3 seconds for 200+ entries. Each page ships 0 KB of JavaScript unless a search widget or interactive diagram is present, in which case only that island hydrates via client:visible. The result: consistent 100 Lighthouse performance scores and sub-200ms Time to First Byte via Cloudflare's edge network.