Astro is an open-source web framework for building content-driven websites that renders pages to static HTML by default and sends JavaScript to the browser only for components that need interactivity. In the field of web applications, it is best known for popularizing the islands architecture, in which small interactive regions sit inside otherwise static pages.
Astro is UI-agnostic: a single project can use components written in React, Vue.js, Svelte, Solid or Preact alongside its own .astro component format. It supports static site generation, server-side rendering through adapters for many hosting platforms, and a hybrid of both, which makes it a common choice for documentation, blogs, marketing sites and e-commerce storefronts.
How Astro renders pages
Astro treats the server as the default place to render, whether that happens at build time or on each request. An .astro file has a component script between code fences, which runs only on the server, and an HTML-like template below it. The script can fetch data, read files or query a database, and none of that code reaches the browser.
The output of a page is plain HTML and CSS, with zero client-side JavaScript unless a developer explicitly asks for it. Astro scopes component styles automatically, bundles assets with Vite and uses file-based routing, so a file at src/pages/blog/index.astro becomes the /blog/ route. This zero-JavaScript baseline explains why Astro sites often score well on Core Web Vitals without special tuning.
The table below shows the main rendering modes and when each fits.
| Mode | When HTML is produced | Best fit |
|---|---|---|
| Static (prerendered) | Once, at build time | Blogs, documentation, marketing pages |
| On-demand (server) | On every request via an adapter | Personalized or frequently changing pages |
| Mixed per route | Static by default, selected routes on demand | Mostly static sites with a few dynamic pages |
| Server islands | Page cached, one component rendered later | Static pages with personalized fragments |
Islands architecture and client directives
An island in Astro is a framework component that is hydrated independently of the rest of the page. A React carousel or a Svelte search box is rendered to HTML on the server and, only when marked with a client directive, receives its JavaScript in the browser. Each island loads and hydrates on its own, so a slow widget does not delay the rest of the page.
Directives give fine control over when hydration happens, which is the main lever for performance. The table compares them.
| Directive | Hydration timing | Typical use |
|---|---|---|
client:load | Immediately on page load | Critical controls above the fold |
client:idle | When the main thread becomes idle | Secondary widgets |
client:visible | When the component enters the viewport | Comments, carousels, footers |
client:media | When a CSS media query matches | Mobile-only menus |
client:only | Client rendering with no server HTML | Components that need browser APIs |
Islands do not share a component tree, so passing state between islands requires a small shared store, custom events or a library such as nanostores. Props passed to an island must also be serializable, because they travel from the server to the browser inside the HTML.
Astro compared with other web frameworks
Astro sits between classic static site generators and full single-page application frameworks. Its closest neighbors in practice are Next.js, Nuxt and SvelteKit, which also render on the server but treat the page as one hydrated application by default. The comparison below reflects default behavior, since every framework can be configured toward the others.
| Framework | Default client JavaScript | UI library | Primary strength |
|---|---|---|---|
| Astro | None unless islands are marked | Any supported library | Content-heavy sites |
| Next.js | React runtime for the app | React only | Large React applications |
| Nuxt | Vue runtime for the app | Vue.js only | Full-stack Vue applications |
| SvelteKit | Small compiled Svelte runtime | Svelte only | Lightweight interactive apps |
The key difference is the unit of hydration. Next.js with React Server Components reduces shipped code but still hydrates a shared React tree, whereas Astro hydrates isolated islands with no common runtime between them. For an application where nearly every element is interactive, that isolation brings little benefit.
Content collections and the build pipeline
Astro includes content collections, a typed system for Markdown, MDX, JSON or YAML content. A schema defined with the Zod validation library checks every entry’s front matter at build time, so a missing date or misspelled field fails the build instead of the live page. Content loaders can also pull entries from a headless CMS or an API into the same typed interface.
The build pipeline relies on Vite for bundling and hot module replacement during development. Image handling optimizes formats and sizes at build time, and integrations add framework renderers, sitemaps, Tailwind CSS or adapters for platforms such as Node.js servers and edge runtimes. View transitions between pages can be enabled with a built-in router component that uses the browser’s View Transitions API where available.
When Astro is the wrong choice
Astro is optimized for sites where content matters more than interaction, and its trade-offs appear when that balance flips. Highly interactive dashboards, collaborative editors or apps with complex client-side routing gain little from islands and may become harder to structure than in a single framework.
| Project type | Fit | Reason |
|---|---|---|
| Documentation or blog | Strong fit | Mostly static content with few widgets |
| Marketing site with forms | Strong fit | Small islands for forms and menus |
| Storefront with dynamic cart | Good fit | Static catalog plus cart island or server island |
| Real-time dashboard | Weak fit | Nearly all content is interactive |
| Offline-first app | Weak fit | Heavy client state and routing |
- Mixing many UI libraries on one page increases total JavaScript, because each library ships its own runtime.
- Overusing `client:load` cancels the performance advantage that islands provide.
- Server-only code in the component script cannot react to browser events after the page loads.
The idea in brief
Astro is a tool for building websites that load fast because they send very little code. It prepares most of each page in advance, so the browser receives ready-made text and images.
Only the parts that must react to clicks, such as a search box or a photo slider, get extra code. Think of a printed newspaper with a few small touchscreens glued into it: most of the page is simple paper, and only the screens need power.
A practical scenario
A software company rebuilt its product documentation, about 600 pages, which had been a React single-page application. Readers on slow mobile connections waited several seconds for the full application bundle before any text appeared, even though almost every page was static text.
The team moved the pages into an Astro content collection with a schema for titles, versions and categories. Only two components stayed interactive: the search dialog, hydrated with client:idle, and a code sample tab switcher, hydrated with client:visible. Most pages now ship no JavaScript at all, the text renders as soon as the HTML arrives, and broken front matter is caught during the build. The documentation became noticeably faster on mobile devices while the writers kept working in Markdown.