Starlight is a documentation website framework built on Astro, optimized for high performance, accessibility, and SEO.
- Language
- TypeScript
- License
- MIT
- Running for
- 2 years
- Team
- Solo
Why this architecture
Leveraging Astro static rendering delivers 100/100 Lighthouse performance with zero JavaScript by default and built-in client-side WebAssembly search.
Tech stack by layer
6 technologies · audited Sep 17, 2026- AstroIsland architecture framework rendering zero-JavaScript static HTML by default.
- TypeScriptStrict type safety across configuration schemas, route data, and component interfaces.
- Tailwind CSSOptional documentation styling integration provided by @astrojs/starlight-tailwind.
- MDXRich content format enabling interactive UI components inside technical documentation.
- PagefindStatic client-side search engine indexed at build time without external server compute.
- pnpmMonorepo workspace package manager linking packages, themes, and example documentation sites.
- PlaywrightEnd-to-end browser test automation in docs/ verifying accessibility and cross-browser layouts.
Starlight architecture diagram
Open SVGDiagram as text
- Docs author (MDX · Markdown · frontmatter) → Starlight integration (@astrojs/starlight): content
- Starlight integration (@astrojs/starlight) → Astro build (islands · zero JS default): integration
- Starlight integration (@astrojs/starlight) → Zod schemas (frontmatter · sidebar · i18n): validate
- Starlight integration (@astrojs/starlight) → Expressive Code (frames · highlighting · copy): code blocks
- Astro build (islands · zero JS default) → Pagefind (build-time search index): index pages
- Astro build (islands · zero JS default) → Static site (HTML · CSS · search index): emit
- Pagefind (build-time search index) → Static site (HTML · CSS · search index): search index
- Static site (HTML · CSS · search index) → Reader browser (client-side WASM search): serve
Key architectural decisions
5 decisions- 01
Zero-JS baseline architecture powered by Astro Island Architecture
Starlight renders documentation pages as pure static HTML and CSS by default. Client JavaScript is only downloaded when interactive islands (such as search or theme toggles) explicitly require it.
- 02
Offline-first, client-side search via Pagefind WASM
Rather than requiring external third-party search SaaS (like Algolia), Starlight embeds Pagefind (packages/starlight/package.json) to generate static search indexes during the build that run locally via WebAssembly.
- 03
Expressive Code integration for syntax highlighting and code blocks
Starlight integrates astro-expressive-code natively, providing editor frame chrome, line highlighting, terminal window chrome, and copy buttons without runtime client dependencies.
- 04
Strict Zod schema validation for frontmatter and navigation
Document frontmatter metadata, sidebar navigation hierarchies, and internationalization tables are validated at build time using strict Zod schemas (packages/starlight/src/schema.ts).
- 05
Multi-lingual content tracking and internationalization via Lunaria
The documentation workspace utilizes Lunaria (docs/lunaria.config.ts) to track translation progress across dozens of languages, reporting out-of-date localized documentation pages automatically.
How Starlight is built
How Starlight is structured
Starlight is maintained as an open-source monorepo managed with pnpm (pnpm-workspace.yaml, package.json). The repository is developed by the Astro core team to provide a standard documentation engine for modern developer tools:
packages/starlight/: The core Astro integration (@astrojs/starlight). It houses the routing engine, markdown AST processors, internationalization handlers, accessibility layouts, and default navigation sidebars.packages/tailwind/: The official Tailwind CSS plugin (@astrojs/starlight-tailwind) that bridges Tailwind utility classes with Starlight CSS variables.packages/markdoc/: Alternative content renderer adapter supporting Stripe's Markdoc syntax (packages/markdoc/package.json).packages/docsearch/: Optional Algolia DocSearch component adapter for large documentation sites requiring hosted cloud search.docs/: The official documentation website (docs/astro.config.mjs) demonstrating multi-lingual translation workflows and automated accessibility tests.examples/: Minimal starter templates (examples/basics,examples/tailwind,examples/markdoc).
Frontend
The frontend user experience is built using Astro components (.astro) and modern TypeScript:
- Zero-JavaScript Baseline: Content pages, navigation drawers, and table-of-contents sidebars are authored as static Astro components. Pages load instantly without hydration delay, delivering pristine Cumulative Layout Shift (CLS) and First Contentful Paint (FCP) scores.
- Interactive Islands: Small client interactive widgets—such as search modals, theme selectors, and language switchers—hydrate on demand using Astro's
client:loadorclient:idledirectives. - Code Block Presentation: Code samples are processed by Expressive Code (
astro-expressive-code), which applies Shiki-based syntax highlighting, line numbers, insertion diff markers, and terminal tab decorations during the static build phase. - Design System & Typography: Starlight implements a responsive layout system governed by custom CSS properties, ensuring full dark and light mode support and WCAG AAA accessibility compliance.
Backend & APIs
Starlight operates primarily as a static site generator (SSG) with zero persistent backend server requirements:
- Content Collections & Schema: Starlight integrates with Astro's Content Layer. Documents in
src/content/docs/are validated against strict Zod schemas (packages/starlight/src/schema.ts). Bad frontmatter attributes or broken internal references immediately halt the build with descriptive errors. - Pagefind Search Indexer: During
astro build, the Pagefind integration (pagefind,@pagefind/default-ui) traverses the emitted HTML pages, parses headings, extracts body text, and constructs a static, multi-lingual inverted search index. At runtime, the browser queries this index using a tiny WebAssembly worker without pinging external API servers. - Markdown & AST Plugins: The content processing pipeline combines Remark and Rehype plugins (
unified,remark-directive,hast-util-to-html) to auto-generate heading IDs, insert anchor links, and format callout alert boxes.
Data & persistence
Starlight has no database dependencies:
- Filesystem Content: All documentation articles are stored as plain Markdown (
.md), MDX (.mdx), or Markdoc files within the repository. - Version Control & I18n: Multi-lingual translations are tracked on the filesystem. Tools like Lunaria (
docs/lunaria.config.ts) analyze Git commit history to flag when a translated document is out of sync with the primary English source document.
Build, test & deploy
The build and continuous integration pipeline enforces rigorous quality checks:
- Build Pipeline: Monorepo builds run via
pnpm build, compiling packages usingtsdownand verifying bundle size limits using Size Limit (size-limitinpackage.json). - Testing: Automated test suites combine Vitest for internal component logic and Playwright (
@playwright/test) for cross-browser end-to-end testing in headless Chromium, Firefox, and WebKit. - Accessibility Verification: Automated axe-core tests (
axe-playwrightindocs/package.json) run against generated documentation pages to prevent contrast and ARIA regressions.
Self-hosting notes
Deploying a Starlight documentation site is effortless:
- Run
pnpm buildornpm run buildto generate the static output directory (dist/). - Deploy the
dist/folder to any static hosting provider, including Cloudflare Pages, Vercel, Netlify, GitHub Pages, or an AWS S3/CloudFront bucket. - Because all search indexes and assets are completely static, hosting costs are near zero and pages scale to millions of concurrent readers without server scaling concerns.
What to copy (and what not to)
Architectural patterns to emulate from Starlight:
- Zero-JS default delivery: Statically compiling content pages without forcing client-side framework hydration ensures maximum performance and flawless search engine indexing.
- Offline build-time search indexing: Incorporating client-side search engines like Pagefind eliminates third-party search service subscriptions and privacy compliance concerns.
- Strict build-time content validation: Leveraging Zod schemas to validate content frontmatter catches syntax errors and missing metadata in pull request pipelines before deployment.
Avoid introducing heavy client-side state libraries into documentation websites; documentation is primarily a reading experience where static HTML and CSS deliver the best user experience.
Sources & repo audit
- package.json (Root monorepo scripts, size-limit checks, pnpm 11 package manager)
- packages/starlight/package.json (Core Starlight integration, Expressive Code, Pagefind search)
- packages/tailwind/package.json (Starlight Tailwind CSS integration)
- docs/astro.config.mjs (Official documentation site Astro configuration)
Independent analysis of repository at github.com/withastro/starlight. Spotted an inaccuracy? Use the claim form to request a correction.
Show this stack on your README or website
[](https://stackitfast.com/project/starlight)Paste it into your README. It shows your current stack and links to this page.
Scaffold it with your agent
Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Starlight's architecture.
- 1Copy the promptThe full markdown spec, with every layer and decision.
- 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
- 3Paste and scaffoldUse it as the first instruction; review before you ship.
# MISSION: Scaffold "Starlight" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Starlight**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Starlight
- **What It Does**: Starlight is a documentation website framework built on Astro, optimized for high performance, accessibility, and SEO.
- **Domain & Category**: Documentation Portal
- **Production Scale**: Solo
- **Development Mode**: CLASSIC
- **Architectural Rationale**: Leveraging Astro static rendering delivers 100/100 Lighthouse performance with zero JavaScript by default and built-in client-side WebAssembly search.
- **Live Website Reference**: https://starlight.astro.build
- **Source Repository**: https://github.com/withastro/starlight
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: Astro, TypeScript, Tailwind CSS, MDX, pnpm, Playwright
- **Primary Language(s)**: TypeScript, Astro, CSS
- **License of the reference repo**: MIT
- **Frontend**: Astro — Island architecture framework rendering zero-JavaScript static HTML by default.; TypeScript — Strict type safety across configuration schemas, route data, and component interfaces.; Tailwind CSS — Optional documentation styling integration provided by @astrojs/starlight-tailwind.; MDX — Rich content format enabling interactive UI components inside technical documentation.
- **Backend & APIs**: Pagefind — Static client-side search engine indexed at build time without external server compute.
- **Infrastructure & deploy**: pnpm — Monorepo workspace package manager linking packages, themes, and example documentation sites.; Playwright — End-to-end browser test automation in docs/ verifying accessibility and cross-browser layouts.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/withastro/starlight @ 6cf72a2)
1. **Zero-JS baseline architecture powered by Astro Island Architecture**: Starlight renders documentation pages as pure static HTML and CSS by default. Client JavaScript is only downloaded when interactive islands (such as search or theme toggles) explicitly require it.
2. **Offline-first, client-side search via Pagefind WASM**: Rather than requiring external third-party search SaaS (like Algolia), Starlight embeds Pagefind (packages/starlight/package.json) to generate static search indexes during the build that run locally via WebAssembly.
3. **Expressive Code integration for syntax highlighting and code blocks**: Starlight integrates astro-expressive-code natively, providing editor frame chrome, line highlighting, terminal window chrome, and copy buttons without runtime client dependencies.
4. **Strict Zod schema validation for frontmatter and navigation**: Document frontmatter metadata, sidebar navigation hierarchies, and internationalization tables are validated at build time using strict Zod schemas (packages/starlight/src/schema.ts).
5. **Multi-lingual content tracking and internationalization via Lunaria**: The documentation workspace utilizes Lunaria (docs/lunaria.config.ts) to track translation progress across dozens of languages, reporting out-of-date localized documentation pages automatically.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
- Structure as a Turborepo monorepo with strict package boundaries:
- `apps/web`: Application UI, routing, layouts, and server endpoints.
- `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
- `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
- `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
- Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
- Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
- Leverage Astro's Island Architecture: keep pages static (.astro) by default for zero-JS baseline and instant Google search indexing. Hydrate interactive React components with 'client:load' or 'client:visible' only where needed for user state.
4. **Design System & Aesthetics**:
- Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
- Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
- Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
- Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer: client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.Frequently asked about Starlight
What is Starlight built with?
Starlight is built on Astro and TypeScript, utilizing MDX for content, Pagefind for search, Expressive Code for syntax formatting, and pnpm workspaces.
Does a Starlight website require JavaScript to read?
No. Starlight sites deliver complete, accessible documentation in pure static HTML and CSS with a zero-JavaScript baseline score of 100/100 on Lighthouse.
Does Starlight require external search subscriptions like Algolia?
No. Starlight includes Pagefind by default, compiling static WebAssembly search indexes at build time with zero ongoing hosting costs.
Can I customize Starlight with Tailwind CSS?
Yes. The official @astrojs/starlight-tailwind plugin integrates Tailwind CSS design tokens directly into Starlight documentation themes.
One email a month: new deep dives and stack trends
New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.
Similar architectures
- AstroHybridIsland Architecture Web Framework · 1M+ MAUShares Astro · TypeScript · pnpm
- Stack It FastHybridContent Directory & Showcase · Just Me (Solo Vibe Coder)Shares Astro · TypeScript · Tailwind CSS
- StrapiClassicHeadless CMS · 20+ peopleShares TypeScript
- GhostClassicContent Platform · 20+ peopleShares TypeScript · pnpm
- Payload CMSHybridNext.js-Native Headless CMS & App Framework · 6-20 peopleShares TypeScript · pnpm
- Tailwind CSSClassicUtility-First CSS Engine & Framework · 1M+ MAUShares TypeScript · Tailwind CSS