Skip to content

astro

Use when working with Astro for content-focused websites, islands architecture, content collections, view transitions, or hybrid SSR/SSG rendering. Also use when integrating React/Vue/Svelte components into Astro or configuring Astro DB.

ModelSource
sonnetpack: frontend
Full Reference

┏━ πŸ”§ astro ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Use when working with Astro for content-focuse… ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

Astro (v5.x, as of February 2026) is a web framework for content-focused sites. Renders HTML at build time by default; ships zero JS unless you opt in per-component.

ItemValue
Current Version5.x (Vite 6 under the hood)
Installnpm create astro@latest
Config fileastro.config.mjs
Content configsrc/content.config.ts (moved from src/content/config.ts in v5)
Dev servernpx astro dev
Buildnpx astro build
Docshttps://docs.astro.build
I want to…File
Writing components, props, slots, frontmatterreference/components.md
Content collections, loaders, schemasreference/content-collections.md
Client directives, islands, server islandsreference/islands.md
File-based routing, dynamic pages, API routesreference/routing.md
View transitions, ClientRouter, persistencereference/view-transitions.md
SSR, SSG, adapters, integrationsreference/rendering.md
Astro DB, tables, seeds, queriesreference/db.md
Astro Actions, form handling, server functionsreference/actions.md
Image optimization, astro:assets, remote imagesreference/images.md
Environment variables, astro:env, envFieldreference/env.md
v4 β†’ v5 migration, breaking changesreference/migration-v4-v5.md

Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.

Load only the reference docs relevant to the current task. Don’t ingest all 11 files for a single question.

Changev4v5
Content config locationsrc/content/config.tssrc/content.config.ts
Collection entry ID fieldslugid
Render methodentry.render()import { render } from 'astro:content'
View Transitions component<ViewTransitions /><ClientRouter />
Hybrid output modeoutput: 'hybrid'Removed β€” static is default
Astro.glob()AvailableDeprecated β†’ use getCollection()
Script hoistingAuto-hoisted to <head>No longer auto-hoisted
Squoosh image serviceAvailableRemoved β†’ use Sharp
compiledContent()SyncNow async (await entry.compiledContent())