Overview
Astro 7 (released 2026-06-22; 7.3.x current) is a content-first framework that ships zero JavaScript by default and hydrates interactive islands per component. It requires Node.js 22.12 or newer and uses Vite 8. Upgrade with npx @astrojs/upgrade. Pick it for content-heavy, mostly static sites, and read the Astro 7 defaults before upgrading; each deeper topic has its own page.
Use Astro for content-heavy, mostly static sites
Pick Astro for marketing sites, blogs, documentation, and static-first sites with a few islands (search, theme toggle, a graph). Pick another framework for apps with cross-page client state or live data on most pages; Astro supports SSR, but Next.js has the stronger story for authenticated app views. See nextjs-vs-astro.
Keep the default file structure
Do not relocate src/pages/ or src/content/.
src/
pages/ # file-based routes (.astro, .md, .mdx)
layouts/ # one BaseLayout.astro is usually enough
components/ # .astro components and framework islands
content/ # content collections
public/ # static files served at /: favicons, robots.txt, llms.txt
astro.config.mjs
Know the Astro 7 defaults before upgrading
- Rust compiler: unclosed tags are build errors and invalid HTML is no longer auto-corrected. Add the missing closing tags.
compressHTMLdefaults to'jsx': whitespace between inline elements is stripped like JSX, so<span>a</span><em>b</em>loses its space. Add{" "}or setcompressHTML: true.- Markdown and MDX render with Sätteri by default and
@astrojs/markdown-remarkis not installed. Remark, rehype, and recma plugins needprocessor: unified()from that package; see astro-mdx. src/fetch.tsis a reserved file for advanced routing; setfetchFileto another name if you already use it.@astrojs/dbis removed; use Drizzle,node:sqlite, or a hosted database.- Carried over from Astro 6: legacy content collections,
Astro.glob(), and<ViewTransitions />are gone, and Zod 4 comes fromastro/zod.
Define content with typed collections
Use src/content.config.ts, a loader (glob() or file()), and a Zod schema so a malformed frontmatter field fails the build. See astro-content-collections.
Install integrations with astro add
npx astro add <name> installs the package and edits astro.config.mjs. Prefer it over manual edits. Integrations run in the order listed in integrations; put one first or last only when its docs say so.
- Tailwind:
astro add tailwindinstalls@tailwindcss/vitefor Tailwind 4 and you add@import "tailwindcss";to a global stylesheet.@astrojs/tailwindis the legacy Tailwind 3 integration. See tailwind. @astrojs/sitemapwritessitemap-index.xmlandsitemap-0.xml. It needssiteset and cannot list dynamic routes rendered on demand.@astrojs/mdxfor components inside content;@astrojs/checkin CI to type-check.astrofiles.@astrojs/partytownmoves analytics and ad scripts into a web worker: addtype="text/partytown"to each script and listwindowglobals the page calls inconfig.forward. Partytown is beta and not guaranteed to work with every script, so test each one.- Official frameworks: React, Preact, Solid, Svelte, Vue, Alpine. Official adapters: Node, Vercel, Netlify, Cloudflare. See astro-ssr.
Before adding a community integration, check that its astro peer dependency range includes your major; Vite 8 is a breaking change for integrations that depend on Vite internals. Run astro check afterward. For build-time automation (an /llms.txt, a search index), write a small integration with an astro:build:done hook:
const searchIndex = () => ({
name: "search-index",
hooks: { "astro:build:done": async ({ pages }) => { /* write search-index.json */ } },
});Set the SEO baseline once in BaseLayout.astro
Pass per-page values as props and render, for every page: the canonical <link>, title and meta description, Open Graph tags, Twitter Card tags, and JSON-LD (Article for posts, WebSite and Organization on the homepage). See technical and structured-data.
Deploy static sites to GitHub Pages or any static host
For GitHub Pages, use withastro/action@v6 to build and actions/deploy-pages@v5 to publish, and set site (and base for a project path) in astro.config.mjs. For a custom domain, remove base, set site to the domain, and set the domain in the repository’s Settings > Pages; an Actions deployment ignores a CNAME file in public/. For SSR, add an adapter and see astro-ssr; for typed server functions see astro-actions. Islands are covered in astro-islands and images in astro-image-optimization.