Astro for Lightning-Fast Websites
Build incredibly fast static websites with Astro.
What Is Astro?
Astro builds fast websites by sending zero JavaScript by default. Islands Architecture loads JavaScript only where needed.
Basic Component
---
// This code runs on the server only
const posts = await fetchPosts();
const title = "My Blog";
---
<html>
<head>
<title>{title}</title>
</head>
<body>
<h1>{title}</h1>
<ul>
{posts.map(post => (
<li><a href={post.url}>{post.title}</a></li>
))}
</ul>
</body>
</html>
<style>
h1 { color: blue; }
</style>
Using React/Vue Inside
---
import ReactCounter from './Counter.jsx';
---
<h1>Static Page</h1>
<!-- Island: JavaScript loads only here -->
<ReactCounter client:visible />
client Directives
client:load - Load immediately
client:visible - Load when visible
client:idle - Load when browser idle
client:media - Load on media query match
Conclusion
Astro is perfect for blogs, documentation, and content-heavy sites. Incredible performance out of the box.