
An Astro integration is a package that plugs into Astro's build and dev server to add one capability: support for a UI framework such as React, an adapter for a host, a sitemap, MDX. You add an official one with a single command, npx astro add, which installs the package and edits your config file for you. Most sites should add the sitemap first, a UI framework only when a component needs to be interactive, and an adapter only when a page must be rendered on a server.
How to add an integration
Run astro add from the project folder with the name of the integration:
# npm
npx astro add sitemap
# pnpm
pnpm astro add sitemap
# Yarn
yarn astro add sitemap
The command installs the package and updates astro.config.mjs. You can add several at once:
npx astro add react sitemap partytown
astro add works for every official integration and for some community ones. For anything else, install by hand. The manual route is two steps: install the package, then list it in the integrations array.
npm install @astrojs/sitemap
// astro.config.mjs
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
export default defineConfig({
site: 'https://www.example.com',
integrations: [sitemap()],
});
Most integrations are functions that accept options, for example sitemap({ entryLimit: 10000 }). Astro ignores falsy entries in the array, so you can switch one on by condition, such as process.env.CI && sitemap().
The official integrations
Astro maintains three groups of integrations. Everything else comes from the community.
| Group | Integration | What it adds |
|---|---|---|
| UI frameworks | React, Preact, Svelte, Vue, SolidJS, Alpine.js | Lets you use that framework's components in Astro pages |
| Adapters | Cloudflare, Netlify, Node, Vercel | Lets pages render on demand on that host |
| Other | Sitemap, MDX, Markdoc, Partytown | Sitemap files, components in Markdown, Markdoc content, third-party scripts off the main thread |
The package names follow one pattern: @astrojs/react, @astrojs/cloudflare, @astrojs/sitemap and so on. The integrations guide in the Astro docs links to the reference page for each.
Which integrations to add first
1. Sitemap, on every public site
npx astro add sitemap
The sitemap integration needs one thing from you: the site option in astro.config.mjs, set to your full URL starting with https://. On the next build it writes sitemap-index.xml and sitemap-0.xml into the output folder. Point search engines at the index file from robots.txt:
Sitemap: https://www.example.com/sitemap-index.xml
Two options earn their keep on a real site. filter keeps pages out of the sitemap, and serialize lets you change each entry, for example to add a last-modified date:
sitemap({
filter: (page) => !page.includes('/thank-you/'),
serialize: (item) => ({ ...item, lastmod: '2026-11-15' }),
})
We use both on seahawkmedia.com: the filter drops noindexed pages and archive pagination, and serialize adds each article's modified date. One limit to know: the integration cannot generate entries for dynamic routes that are rendered on demand, such as a /products/[id] page with no pre-built list of URLs. The customPages option takes a list of extra URLs to include. The sitemap reference lists every option.
2. A UI framework, when a component needs to be interactive
npx astro add react
Swap react for preact, svelte, vue, solid or alpinejs. After that you can import a component into any .astro page and decide when its JavaScript loads:
---
import PricingCalculator from '../components/PricingCalculator.jsx';
---
<PricingCalculator client:visible />
Adding a framework does not put JavaScript on every page. A component without a client: directive is rendered to HTML and its client-side JavaScript is stripped. If your site has no interactive components yet, skip this integration until it does. If you install two JSX frameworks, such as React and Preact, give each one an include option so Astro knows which files belong to which.
3. An adapter, only for on-demand rendering
A site that is fully pre-rendered does not need an adapter. You need one when a page has to be rendered at request time, or when you use server features such as sessions, actions or server islands. Pick the adapter that matches your host:
npx astro add cloudflare
npx astro add node
npx astro add netlify
npx astro add vercel
With the adapter in place, mark a single page with export const prerender = false, or set output: 'server' to render every page on demand by default. The Node adapter has a mode option: standalone builds a server that starts on its own, and middleware builds a handler for an existing Express or Fastify server. The Cloudflare adapter reads variables and bindings from cloudflare:workers. Check each adapter's reference page before you deploy, because the options differ by host.
Not sure where the site will live? Our lists of Astro web hosts and Astro management platforms compare the options.
4. Images: nothing to install
Image optimization is built into Astro, so there is no integration to add. Keep images in src/ (files in public/ are copied as they are, with no processing) and use the Image component:
---
import { Image } from 'astro:assets';
import team from '../assets/team.jpg';
---
<Image src={team} alt="The Seahawk support team at work" />
Astro outputs an optimized image with width and height set, which prevents the page from jumping as it loads. The Picture component adds modern formats such as AVIF and WebP with a fallback. Processing is done by Sharp by default. Remote images are only optimized when you authorize their source with image.domains or image.remotePatterns. The images guide has the details.
5. MDX, if writers need components inside articles
npx astro add mdx
Plain Markdown works without any integration. Add MDX when an article needs a component in the middle of the text, such as a chart or a call-to-action block. It is also what lets you use the Image component inside content files.
A sensible starting setup
| Your site | Add |
|---|---|
| Static marketing site or blog | Sitemap |
| The same, with an interactive calculator or search | Sitemap, one UI framework |
| Blog with components inside posts | Sitemap, MDX |
| Site with logins, a cart or other per-visitor pages | Sitemap, the adapter for your host |
| Astro front end on WordPress content | Sitemap, plus an adapter only if you need previews or on-demand pages |
That last row is the setup in our guide to using Astro with WordPress. A full CMS can arrive as an integration too: EmDash is itself an Astro integration, listed in the same integrations array.
Updating and removing integrations
Update Astro and every official integration together:
npx @astrojs/upgrade
Or update specific packages by hand:
npm install @astrojs/react@latest @astrojs/sitemap@latest
To remove an integration, uninstall the package and delete its import and its entry in the integrations array:
npm uninstall @astrojs/react
Treat community integrations like any other dependency. Before adding one, check when it was last updated and whether it supports your Astro version, because an abandoned integration is the usual reason a major upgrade stalls. If you are weighing Astro against staying on a WordPress theme, our WordPress vs Astro guide covers what that maintenance looks like on each side.
Frequently asked questions
Do I need an adapter for a static Astro site?
No. Adapters are for pages rendered on demand. A fully pre-rendered site builds to a folder of files that any static host can serve without one.
Does adding React make every page load JavaScript?
No. Astro only sends a component's JavaScript to the browser when you add a client: directive to it. Without a directive the component becomes plain HTML.
Do I need an integration to optimize images?
No. The Image and Picture components are built into Astro and imported from astro:assets. You only need the MDX integration if you want to use them inside content files.
Does astro add work with community integrations?
With some of them. It supports all official integrations and a number of community packages. If it does not recognize a package, install it with your package manager and add it to the integrations array yourself.
How do I keep integrations up to date?
Run npx @astrojs/upgrade. It upgrades Astro and all official integrations in one step, so their versions stay compatible with each other.
