Key Concepts
Zero JS by Default
<!-- This page ships 0KB of JavaScript -->
<h1>Hello, World!</h1>
<p>This is pure HTML. No framework runtime.</p>Islands Architecture
Add interactivity only where needed:
---
import StaticHeader from "./Header.astro"; // No JS
import ReactCounter from "./Counter.jsx"; // Interactive
---
<StaticHeader /> <!-- Pure HTML -->
<ReactCounter client:visible /> <!-- Hydrates when visible -->Hydration directives:
| Directive | When |
|---|---|
client:load |
Immediately on page load |
client:idle |
When browser is idle |
client:visible |
When component scrolls into view |
client:media |
When media query matches |
Content Collections
Type-safe content management for Markdown/MDX:
// src/content/config.ts
import { defineCollection, z } from "astro:content";
const blog = defineCollection({
schema: z.object({
title: z.string(),
date: z.date(),
tags: z.array(z.string()),
}),
});---
const posts = await getCollection("blog");
---
{posts.map(post => <BlogCard post={post} />)}Use Any Framework
Mix frameworks in one project:
---
import ReactWidget from "./Widget.jsx";
import VueChart from "./Chart.vue";
import SvelteForm from "./Form.svelte";
---
<ReactWidget client:load />
<VueChart client:visible />
<SvelteForm client:idle />Performance
| Metric | Astro | Next.js | Gatsby |
|---|---|---|---|
| JS shipped (blog) | 0KB | 80KB+ | 200KB+ |
| Lighthouse score | 100 | 85-95 | 80-90 |
| Build time (1K pages) | 8s | 25s | 45s |
Key Stats
- 50,000+ GitHub stars
- Zero JS default
- Islands architecture
- React, Vue, Svelte, Solid support
- 100 Lighthouse score typical
FAQ
Q: What is Astro? A: A web framework that ships zero JavaScript by default, using Islands architecture for selective interactivity. Best for content-first sites.
Q: Is Astro free? A: Yes, fully open-source under MIT license.
Q: Can I use Astro with React? A: Yes, Astro supports React, Vue, Svelte, Solid, and Preact — even mixed in the same project.