The Starlight plugins most docs sites benefit from are starlight-links-validator (fails the build on broken internal links), starlight-image-zoom (click-to-zoom screenshots) and, depending on the project, starlight-sidebar-topics, starlight-typedoc or starlight-openapi for API reference, starlight-versions for versioned docs, and @astrojs/starlight-docsearch when Pagefind search isn’t enough. You add each one to the plugins array inside the starlight() integration.
Starlight already includes search, dark mode, i18n, syntax highlighting and a component set, so the list of plugins you need is short. This guide covers what each one adds, when it’s worth it, and when to skip it.
Key Takeaways
- Starlight plugins go in
starlight({ plugins: [...] })inastro.config.mjs, not in Astro’s top-levelintegrationsarray.- Install
starlight-links-validatoron every docs site. Broken links are the most common docs bug, and it catches them at build time.- Add API reference plugins (
starlight-typedoc,starlight-openapi) only if you have the source they generate from.- Check what Starlight does natively first: Pagefind search, Expressive Code,
<Tabs>,<Steps>,<FileTree>and autogenerated sidebars need no plugin.- Community plugins are maintained by individuals. Check the last release date and Starlight version support before adding one.
How Starlight plugins work
Starlight is an Astro integration, and it has its own plugin system on top. A Starlight plugin can change Starlight’s config, add Astro integrations, override built-in components and add routes. That’s why they’re registered inside Starlight’s options:
// astro.config.mjs
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightLinksValidator from 'starlight-links-validator';
import starlightImageZoom from 'starlight-image-zoom';
export default defineConfig({
site: 'https://docs.example.com',
integrations: [
starlight({
title: 'Example Docs',
plugins: [starlightLinksValidator(), starlightImageZoom()],
}),
],
});
Install each package with npm first. Plugins run in the order listed, which matters only when two plugins override the same component; the plugin’s README says when that’s a problem.
The full list of community plugins lives on the Starlight site’s plugins and integrations page. What follows are the ones that solve problems most docs sites actually have.
Build quality: starlight-links-validator
npm install starlight-links-validator
This plugin checks every internal link in your Markdown and MDX content during astro build, including links to headings (/guides/setup/#install). If a target page or anchor doesn’t exist, the build fails with a list of the broken links and the files they’re in.
Why it’s first on the list: docs get reorganized constantly. Renaming a page or a heading silently breaks every link to it, and readers find out before you do. With the validator, the deploy that would have shipped broken links never ships.
It checks internal links only, which keeps builds fast and deterministic. For external links, run a separate link checker in CI on a schedule, since third-party sites go down without warning.
Readability: starlight-image-zoom
npm install starlight-image-zoom
Screenshots of settings screens and dashboards are usually unreadable at content width. This plugin lets readers click an image to view it full size, with keyboard support and a close button. No changes to your Markdown are needed; it applies to content images automatically.
Skip it if your docs are mostly code and diagrams that already fit the column.
Navigation: starlight-sidebar-topics
npm install starlight-sidebar-topics
Starlight shows one sidebar for the whole site. Once a project has distinct areas (a user guide, an API reference, a CLI reference), one sidebar gets long and hard to scan. starlight-sidebar-topics splits the docs into topics, each with its own sidebar, and adds a topic switcher at the top:
// astro.config.mjs (excerpt)
import starlightSidebarTopics from 'starlight-sidebar-topics';
starlight({
title: 'Example Docs',
plugins: [
starlightSidebarTopics([
{
label: 'Guides',
link: '/guides/',
items: [{ label: 'Start here', autogenerate: { directory: 'guides' } }],
},
{
label: 'Reference',
link: '/reference/',
items: [{ label: 'API', autogenerate: { directory: 'reference' } }],
},
]),
],
});
Use it when a reader of one section rarely needs the other. If everything is closely linked, a single sidebar with collapsed groups is simpler.
API reference: starlight-typedoc and starlight-openapi
Hand-written API reference drifts from the code. These two plugins generate it.
starlight-typedoc runs TypeDoc on a TypeScript project and outputs Starlight pages for every exported function, class and type, using your TSDoc comments. It’s the right choice for documenting a library.
// astro.config.mjs (excerpt)
import starlightTypeDoc, { typeDocSidebarGroup } from 'starlight-typedoc';
starlight({
title: 'Example SDK',
plugins: [
starlightTypeDoc({
entryPoints: ['../packages/sdk/src/index.ts'],
tsconfig: '../packages/sdk/tsconfig.json',
}),
],
sidebar: [typeDocSidebarGroup],
});
starlight-openapi reads an OpenAPI (Swagger) schema file and generates pages for every operation, with parameters, request bodies and responses. It’s the right choice for documenting an HTTP API.
// astro.config.mjs (excerpt)
import starlightOpenAPI, { openAPISidebarGroups } from 'starlight-openapi';
starlight({
title: 'Example API',
plugins: [
starlightOpenAPI([
{ base: 'api', schema: './schemas/openapi.yaml' },
]),
],
sidebar: [...openAPISidebarGroups],
});
Both generate pages at build time, so the output is still static HTML that Pagefind indexes. Check each plugin’s README for the current option names; they track TypeDoc and OpenAPI versions.
Versioned docs: starlight-versions
npm install starlight-versions
If users run older releases of your software, they need the docs for their version. starlight-versions archives a snapshot of your current docs as a named version, serves it under its own path, and adds a version picker.
It’s worth the extra content only when old versions are genuinely in use. Many projects do better with a single current version plus a migration guide per major release, which is easier to keep accurate.
Search: when to add @astrojs/starlight-docsearch
Starlight ships with Pagefind, a static search index built during astro build. It needs no service and no account, and it handles most docs sites well.
@astrojs/starlight-docsearch replaces it with Algolia DocSearch, a hosted search service. Consider it when:
- The site has thousands of pages and you want typo tolerance and relevance tuning beyond Pagefind’s defaults.
- You want search analytics to see what readers can’t find.
- Your project qualifies for Algolia’s free DocSearch program for open-source documentation.
Otherwise, keep Pagefind. It works offline in previews, costs nothing and has no third-party script. The Pagefind search guide covers tuning it, and Pagefind vs Algolia compares the two directly.
AI readability: starlight-llms-txt
npm install starlight-llms-txt
This plugin generates llms.txt, plus fuller variants, from your Starlight content during the build. AI coding assistants and agents increasingly fetch these files from developer docs to load accurate context.
It costs one line of config. Whether any particular AI tool reads the file varies, so treat it as a low-cost addition rather than a guarantee. The llms.txt and AI citations guide explains the format and the page-level habits that matter more.
Content extras: starlight-blog and others
starlight-blog adds a blog to a Starlight site: a post list, tags, authors, RSS and post pages styled to match. It suits product docs that also publish release notes or announcements and don’t want a second site.
A few others solve narrower problems:
| Plugin | What it adds | Use when |
|---|---|---|
starlight-heading-badges |
Badges next to headings (“New”, “Deprecated”) | API docs that track feature status |
starlight-videos |
Video pages and courses with a consistent layout | Video tutorials alongside text docs |
starlight-kbd |
Keyboard shortcut display that adapts per OS | Desktop app or editor docs |
starlight-auto-sidebar |
Per-folder metadata for autogenerated sidebars | Large autogenerated sidebars needing ordering control |
Theme plugins (for example starlight-theme-rapide) |
A full visual restyle | You want a different look without custom CSS |
What you don’t need a plugin for
Before installing anything, check what Starlight does natively:
| Need | Built in |
|---|---|
| Search | Pagefind, automatic |
| Code blocks with titles, line highlights, diffs | Expressive Code |
| Tabs, steps, file trees, cards, asides, badges | Components in @astrojs/starlight/components |
| Translated docs | locales option |
| Autogenerated sidebar | autogenerate: { directory } in sidebar |
| Last updated date, edit link | lastUpdated, editLink options |
| Custom header, footer, page layout | Component overrides |
| Tailwind CSS | @astrojs/starlight-tailwind compatibility package |
Most “I need a plugin for X” questions are answered by a component override: you replace one of Starlight’s components (the footer, say) with your own via the components option, and keep everything else. The Starlight frontmatter cheatsheet lists the per-page options that cover many more cases.
A sensible starting set
For a typical product or library docs site:
starlight-links-validator, always.starlight-image-zoomif you have screenshots.- One API reference plugin if you have a TypeScript library or an OpenAPI file.
starlight-llms-txtif your readers are developers using AI tools.
Add versioning, topics or DocSearch when the site’s size or audience calls for them, not before. Each plugin is another dependency to upgrade when Starlight releases a new major version.
If you’re still deciding between Starlight and a custom Astro docs layout, the Astro or Starlight decision guide walks through it. For a designed docs site without Starlight’s default look, Komal Nakrani’s Astro documentation themes are a smaller set of plain Astro projects you can extend.
FAQ
How do I add a plugin to Starlight?
Install the package with npm, import it in astro.config.mjs, and add it to the plugins array inside starlight({ ... }). Starlight plugins don’t go in Astro’s top-level integrations array.
What is the difference between a Starlight plugin and an Astro integration?
An Astro integration hooks into Astro’s build. A Starlight plugin hooks into Starlight specifically: it can update Starlight’s config, override its components and add Astro integrations of its own. Starlight itself is an Astro integration.
Does Starlight have built-in search?
Yes. Starlight builds a Pagefind search index during astro build and includes a search box, with no configuration or external service. You can swap in Algolia DocSearch with the official plugin.
How do I check for broken links in Starlight?
Install starlight-links-validator and add it to the plugins array. The build then fails if any internal link or heading anchor in your content points to something that doesn’t exist.
Can Starlight generate API documentation?
Yes, through plugins. starlight-typedoc generates reference pages from TypeScript source and TSDoc comments, and starlight-openapi generates them from an OpenAPI schema.