OrbitDocs packages are coming to npm soon. Until then, run it from the GitHub repo →
Get started

Project structure

Every file orbitdocs init creates, what it does, and which ones you edit.

orbitdocs init writes a complete Next.js app into a folder of your Nest project, docs/ by default. This page lists every file. Most of the time you only touch orbitdocs.config.ts, content/ and reference/.

Run init

npx orbitdocs init

Run it from the root of your Nest project. It accepts these flags:

FlagDefaultWhat it does
-d, --dir <dir>docsFolder for the docs app.
-t, --title <title>From package.jsonSite title.
--routes <routes>Asks, or opt-inopt-in documents routes marked with @DocsOperation. all documents every route @nestjs/swagger sees.
-f, --forceOffWrite into a folder that is not empty. Existing files with the same name are overwritten.
--workspaceOffUse workspace:* versions. Only for the OrbitDocs monorepo itself.

What init reads from your project

SourceUsed for
package.json nameThe API id and the site title. @acme/orbit-travel-api becomes the id orbit-travel and the title Orbit Travel.
nest-cli.jsonIts presence sets build: 'nest build'. Its sourceRoot (default src) locates main.ts, and is the folder orbitdocs dev watches.
main.tsapp.setGlobalPrefix('…') becomes globalPrefix. app.enableVersioning(…) becomes versioning, with its prefix and defaultVersion.
@ApiOperation( in your .ts filesCounted to suggest routes: 'all' in the prompt.

The compiled module is always set to dist/app.module.js. Check that path against your dist/ folder after the first build.

The files

docs/
├── orbitdocs.config.ts        the site config: APIs, theme, navigation, features
├── package.json               scripts: dev, build, extract, check, typecheck
├── next.config.ts             withOrbitDocs(config): static export, basePath, MDX
├── proxy.ts                   private docs and Ask AI in Next server mode
├── tsconfig.json
├── postcss.config.mjs         Tailwind CSS 4
├── .gitignore
├── content/                   your guides (MDX)
│   ├── index.mdx              the home page
│   ├── quickstart.mdx
│   └── meta.json              sidebar order
├── reference/                 extra content inside the API reference (MDX)
│   └── .gitkeep
├── lib/
│   ├── orbit.ts               the validated config, shared by every page
│   ├── overrides.tsx          React-only Fumadocs options (slots, custom links, search dialog)
│   └── source.ts              the content/ and reference/ collections
└── app/
    ├── layout.tsx             <html>, fonts, metadata, <OrbitRoot>
    ├── global.css             Tailwind, HeroUI and OrbitDocs styles
    ├── (home)/page.tsx        renders content/index.mdx at /
    ├── (guides)/layout.tsx    sidebar layout for guides
    ├── (guides)/[...slug]/page.tsx   every other guide
    ├── ~/[variant]/…          private docs: the guides with the sidebar of readers who may see more
    ├── reference/[api]/[[...slug]]/page.tsx   the API reference
    ├── reference/[api]/sections/[file]/route.ts   the rest of the reference, loaded as you scroll
    ├── reference-samples/[file]/route.ts      code samples on demand
    ├── client/[[...variant]]/page.tsx   the API client at /client
    ├── api/search/route.ts    the search index
    ├── llms.txt/route.ts
    ├── llms-full.txt/route.ts
    ├── md/[[...slug]]/route.ts        each guide as Markdown
    ├── orbitdocs-access.json/route.ts internal: private docs rules
    └── orbitdocs-ai.json/route.ts     internal: Ask AI index

Files you edit

FileEdit it to
orbitdocs.config.tsAdd APIs, change the theme, layout and navigation, turn on private docs, AI, SDKs or the mock server. Every key is in Configuration.
content/Write guides. See Write docs.
reference/<api id>/Add notes, warnings and examples inside the reference. See Operation content.
app/global.cssOverride CSS variables, such as --accent, below the imports.
public/icon.png, public/apple-icon.pngReplace the favicons (the OrbitDocs mark by default).
app/(guides)/[...slug]/page.tsxRegister your own MDX components in orbitMdxComponents(orbit, { … }).
public/Add images and logos; files in it are served from the site root.

You can edit any other file too. It is a normal Next.js app.

package.json scripts

ScriptRunsDoes
npm run devorbitdocs devExtracts, starts next dev and re-extracts when the API changes.
npm run buildorbitdocs buildExtracts, checks links, then builds the site.
npm run extractorbitdocs extractWrites openapi/<api id>.json only.
npm run checkorbitdocs checkFinds broken op: links and <Endpoint>s (guides and reference/ content) and missing specs.
npm run typechecknext typegen && tsc --noEmitType-checks the app.

Every command and flag is in the CLI reference.

Generated files

These are written by the CLI or by next.config.ts. They are in .gitignore; don't edit them.

PathWritten byContains
openapi/<api id>.jsonorbitdocs extractThe spec the reference renders.
public/openapi/<api id>.jsonorbitdocs extractA copy for the download link.
.orbitdocs/theme.cssnext.config.tsCSS for theme and layout in the config.
.orbitdocs/access.jsonorbitdocs extractPrivate docs rules, when access is set.
.orbitdocs/ai.jsonorbitdocs extractThe Ask AI and MCP index, when ai is set.
.orbitdocs/sdk-samples.jsonorbitdocs sdkSDK code samples for the reference.
.orbitdocs/build.jsonorbitdocs buildThe base path and output mode of the last build.
.source/fumadocs-mdxThe compiled MDX collections.
out/orbitdocs buildThe static site.
.next/Next.jsBuild cache, or the server build in server mode.

Commit the specs when you build elsewhere

openapi/ is ignored because orbitdocs build regenerates it. If you build the docs where the Nest app can't compile, remove openapi/ from .gitignore, commit it, and build with orbitdocs build --skip-extract.

Next steps

Last updated on

On this page