This is a Next.js application generated with Create Fumadocs.
Run development server:
npm run dev
# or
pnpm dev
# or
yarn devOpen http://localhost:3000 with your browser to see the result.
In the project, you can see:
lib/source.ts: Code for content source adapter,loader()provides the interface to access your content.lib/layout.shared.tsx: Shared options for layouts, optional but preferred to keep.
| Route | Description |
|---|---|
app/(home) |
The route group for your landing page and other pages. |
app/docs |
The documentation layout and pages. |
app/api/search/route.ts |
The Route Handler for search. |
A source.config.ts config file has been included, you can customise different options like frontmatter schema.
Read the Introduction for further details.
To learn more about Next.js and Fumadocs, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
- Fumadocs - learn about Fumadocs
This repo can ingest docs content from other statelyai/* repos and mount it
under stately.ai/docs/packages/....
The external docs manifest lives in docs-sources.json:
[
{
"name": "Agent",
"package": "agent",
"source": "agent",
"include": ["README.md", "docs/**/*.md", "docs/**/*.mdx"]
},
{ "name": "Graph", "package": "graph", "source": "graph" },
{
"name": "SDK",
"package": "sdk",
"source": "viz/packages/sdk",
"mode": "snapshot"
},
{
"name": "CLI",
"package": "cli",
"source": "viz/packages/cli",
"mode": "snapshot"
},
{
"name": "MCP",
"package": "mcp",
"source": "viz/packages/mcp",
"mode": "snapshot"
}
]Each entry means:
name: display name in the docs sidebarpackage: public route segment under/docs/packages/<package>source: repo root or repo subpath to scan for docs contentinclude: optional Markdown glob allowlist relative tosourcemode: optional; use"snapshot"to commit generated docs for private sources instead of fetching the repo during deployment
The sync pipeline is implemented in scripts/docs-sync.mjs.
For each manifest entry, it:
- Resolves the source repo locally from
../<repo>when available. - Falls back to a cached remote checkout in
.cache/docs-repos/<repo>when the local repo is missing. - Scans the configured
sourceroot using itsincludeallowlist. Without one, it includes only the rootREADME.md/readme.mdanddocs/**/*.{md,mdx}. - Flattens those pages into
.cache/docs-workspaces/<package>/docs. - Generates Fumadocs frontmatter when it is missing.
- Uses the source repo's optional
docs/meta.jsonto order and select navigation pages.
The generated workspace is what source.config.ts points Fumadocs at. The app
never copies external docs into content/docs.
Snapshot sources are different: they write to external-docs/<package> so the
generated docs can be committed. In CI, if the private local source repo is not
available, the sync step uses the committed snapshot instead of cloning GitHub.
- Root
README.mdbecomesindex.mdand maps to/docs/packages/<package>. - Included nested
**/README.md(x)are treated as index-like and flatten to their parent path:src/formats/adjacency-list/README.md->src-formats-adjacency-list.md
docs/**/*.{md,mdx}also flatten into the same package namespace.- Optional frontmatter
slugoverrides the flattened route segment. - Duplicate flattened slugs fail the sync.
- A Fumadocs
docs/meta.jsonpagesarray controls navigation order and visibility using the flattened page slugs.
For synced external docs, the pipeline also derives:
titleif frontmatter is missingdescriptionif frontmatter is missingsourcePathandsourceUrlpointing to the original file in GitHub
The first H1 in synced pages is stripped so the page title only renders once.
Sources can overlap inside the same repo. More specific sources win.
Example:
{ "name": "SDK", "package": "sdk", "source": "viz/packages/sdk" }{ "name": "Viz", "package": "viz", "source": "viz" }
In that case, viz automatically skips the packages/sdk subtree so the SDK
docs are not indexed twice.
pnpm docs:sync: refresh external workspaces onlypnpm docs:generate: sync external workspaces and regenerate Fumadocs outputpnpm docs:watch: watch local source repos and regenerate on changespnpm dev: run the app after a sync passpnpm build: run sync and then a production build