AstroShowcase
Docs / Getting Started / Introduction to Astro
Getting Started Updated May 7, 2026

Introduction to Astro

What Astro is, why it's different from other frameworks, and when you should use it.

What is Astro?

Astro is a web framework for building content-focused websites. Unlike React or Vue, which ship a JavaScript runtime to every visitor by default, Astro sends pure HTML and CSS. JavaScript is only added where you explicitly ask for it.

The result is sites that are:

  • Fast by default — no JavaScript framework overhead in the browser
  • SEO-friendly — fully rendered HTML on every request
  • Easy to write.astro files look like HTML with superpowers

Astro was created in 2021 and reached v1.0 in 2022. Version 6.3 (used on this site) is the most capable release yet, with built-in server islands, content collections, middleware, and a TypeScript-first developer experience.

How Astro is different

Most frameworks work like this:

  1. Server sends a JavaScript bundle to the browser
  2. JavaScript runs and renders the page
  3. User can finally see and interact with the page

Astro works like this:

  1. Server renders HTML
  2. Browser displays it immediately
  3. Only interactive components load JavaScript (called “islands”)

This is called the Islands Architecture. The sea is static HTML; the islands are interactive components. You can use React, Vue, Svelte, or any other framework for your islands — Astro is UI-framework agnostic.

When to use Astro

Astro is a great fit for:

Use caseWhy Astro works
Marketing sitesStatic HTML, fast LCP, great SEO
Blogs & portfoliosMDX content, automatic image opt
DocumentationContent collections, sidebar nav
E-commerce storefrontsStatic pages + SSR cart/auth
Community showcase sitesLike this one!

Astro is not the best choice for:

  • Highly interactive apps (use Next.js, SvelteKit, or Remix)
  • Real-time dashboards (consider SvelteKit + WebSockets)

The .astro file format

Every Astro component is a .astro file with two sections:

---
// This section runs on the SERVER only — never sent to the browser
// Great for: database queries, API calls, reading env vars

import Header from './Header.astro'

const greeting = "Hello, world!"
const posts = await fetch('/api/posts').then(r => r.json())
---

<!-- This section is the HTML template — uses the variables above -->
<Header />
<h1>{greeting}</h1>
{posts.map(post => <p>{post.title}</p>)}

The --- fences are called the frontmatter. Code there runs at build time (for static pages) or request time (for SSR pages) — never in the browser. This is what makes Astro so fast: there is no client-side data fetching waterfall.

Astro vs the competition

FeatureAstroNext.jsSvelteKit
Default JS shipped~0 KB70-100 KB10-30 KB
UI frameworkAnyReact onlySvelte only
MDX supportBuilt-inPluginPlugin
Image optimizationBuilt-inBuilt-inPlugin
Content collectionsBuilt-inManualManual
Server islandsBuilt-in

What’s next