A production-ready documentation site starter built with Astro Starlight and Nx - for teams who want beautiful docs without rebuilding from scratch.
🚀 If you haven't connected to Nx Cloud yet, complete your setup here. Get faster builds with remote caching, distributed task execution, and self-healing CI. See how your workspace can benefit.
npx create-nx-workspace@latest my-workspace \
--template nrwl/astro-starlight-template \
--packageManager=npmnpx create-nx-workspace@latest my-docs \
--preset=apps \
--packageManager=npmnpx nx run @astro-starlight-template/docs:devOpen http://localhost:4321.
npx nx run @astro-starlight-template/docs:buildOutput lands in apps/docs/dist/.
npx nx run-many -t buildnpx nx affected -t buildNx rebuilds only the projects that changed since your last commit.
npx nx graphastro-starlight-template/
|- apps/
| |- docs/ # Astro Starlight documentation site
|
|- packages/
|- ui-components/ # Shared TypeScript utilities (slugify, formatDate, readingTime)
- Astro + Starlight with full-text search, dark mode, and i18n support
- Configured sidebar with Getting Started, Contributors, and Reference sections
- Tagged
type:appandscope:docsfor module boundary enforcement - Build output cached by Nx - subsequent builds are instant when sources haven't changed
A shared TypeScript library available to any app in the workspace:
import {
slugify,
formatDate,
readingTime,
sortedSidebar,
} from '@astro-starlight-template/ui-components';
slugify('My Great Page'); // -> "my-great-page"
formatDate('2024-06-01'); // -> "June 1, 2024"
readingTime('word '.repeat(600)); // -> 3Tagged type:lib and scope:shared - usable across all apps and libs.
Every target (build, typecheck, etc.) is cached by its inputs. Change a single
content file and only that page re-renders. Your CI pipeline restores the same cache
that your laptop already built.
npx nx affected -t build # only build what changed
npx nx affected -t typecheckNx computes the dependency graph and skips everything untouched.
Projects carry tags in project.json. Add @nx/enforce-module-boundaries to
your ESLint config to prevent scope:docs code from importing scope:private libs,
keeping your architecture honest as the workspace grows.
Add more capabilities without manual config:
npx nx add @nx/react # React components
npx nx add @nx/storybook # Component stories
npx nx add @nx/cypress # E2E testingEach nx add command installs and wires the plugin at the correct version automatically.
Nx Cloud turns this local template into a team-scale platform.
- Remote cache - Share build/test results across every dev machine and CI runner.
- Distributed task execution (DTE) - Split long pipelines across many agents, stream results back.
- Flaky task detection - Automatically quarantine flaky tests so they don't block PRs.
- Self-healing CI - Retry only the failed tasks, not the entire pipeline.
Enable it:
npx nx connectFull CI guide: https://nx.dev/nx-cloud
| Path | Purpose |
|---|---|
apps/docs/ |
Astro Starlight site |
apps/docs/src/content/docs/ |
Markdown and MDX content |
apps/docs/astro.config.mjs |
Starlight sidebar and site config |
packages/ui-components/src/ |
Shared TypeScript utilities |
nx.json |
Nx workspace config, cache settings, target defaults |
package.json |
npm workspaces root |
Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
- Nx Documentation
- Crafting Your Workspace Tutorial
- Module Boundaries
- Astro Starlight Documentation
- Nx Cloud
Join the Nx community: