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

Deploy

Pick an output mode, set the base path, and ship the docs to any host with one command.

One OrbitDocs app can be deployed four ways. Pick the mode that matches where the docs will live and which features you need. You can switch modes later by changing one line of config.

Choose an output mode

StaticNext serverInside your Nest appSelf-hosted platform
Configoutput.mode: 'static'output.mode: 'server'output.mode: 'static'output.mode: 'static'
Build outputout/ (plain files).next/ (a Next app)out/out/, uploaded
Runs onAny static hostVercel, any Node host, a containerYour Nest serverYour own servers
Private docsNo (every file is public)Yes, through proxy.tsYes, through mountOrbitDocsYes
Ask AI and MCPNoYesYesYes
RedirectsRedirect pages + a _redirects fileReal HTTP redirectsRedirect pagesRedirect pages
GuideStatic hostsServer modeNestPlatform

Pick static unless you need private docs or Ask AI. Static files are the cheapest and fastest to host. URLs, search and llms.txt are the same in every mode.

Private docs need a server

Access rules are checked by the server that serves the docs. A plain static host serves every file to everyone. orbitdocs build prints a warning when the config has an access section and the mode is static.

Set the mode and base path

Both settings live in output:

orbitdocs.config.ts
import { defineConfig } from '@orbitdocs/next/config';

export default defineConfig({
  site: { title: 'Acme API' },
  apis: [/* … */],
  output: {
    mode: 'static', // 'static' (default) or 'server'
    basePath: '/docs', // '' (default) serves the site at the root
  },
});
KeyTypeDefaultWhat it does
output.mode'static' | 'server''static'static builds plain files into out/. server builds a Next app you start with next start.
output.basePathstring''URL path the site lives under, such as /docs. Empty, or /segment with more /segments. No trailing slash.

basePath is baked into every link and asset URL at build time. Set it to the exact path the host serves the site on, then build. A site built for /docs breaks when it is served at /, and the other way round.

Serving the docs from your Nest app at /docs? Set basePath: '/docs' and pass the same path to mountOrbitDocs.

Build and deploy

orbitdocs build extracts the specs, checks every op: link, then runs next build. orbitdocs deploy runs the same build and ships it:

npx orbitdocs build                          # out/ (static) or .next/ (server)
npx orbitdocs deploy --target vercel --prod  # build, then vercel deploy
npx orbitdocs deploy --target static         # build, then print where to upload out/
npx orbitdocs deploy --target nest           # build, then print the mountOrbitDocs call
npx orbitdocs deploy --target docker         # build, then write a Dockerfile + nginx.conf
TargetNeeds modeWhat it does
vercelstatic or serverRuns npx vercel@latest deploy on out/ (static) or on the docs app folder (server). Add --prod for production.
staticstaticBuilds out/ and tells you to upload it. It uploads nothing itself.
neststaticBuilds out/ and prints the mountOrbitDocs line for your main.ts.
dockerstaticWrites a Dockerfile and nginx.conf that serve out/ (only if no Dockerfile exists yet).

Add --skip-build to any target to deploy the build that is already there. Every flag is listed on the CLI reference.

Only the vercel target accepts output.mode: 'server'. The other targets stop with Target "…" needs output.mode 'static'.

What a build writes

PathModeContents
out/staticThe whole site: HTML per page (page/index.html), assets, 404.html, llms.txt, openapi/<id>.json.
out/_redirectsstaticRedirect rules for Netlify and Cloudflare Pages. Only written when redirects is set.
.next/serverThe Next build. Start it with next start.
openapi/<id>.jsonbothThe extracted spec of each API.
.orbitdocs/bothBuild metadata: the access manifest, the AI index and the theme CSS. Never served.

out/ also holds orbitdocs-access.json and orbitdocs-ai.json. mountOrbitDocs and the platform read them to enforce access and answer Ask AI. Both servers refuse to serve these two files.

Next steps

Last updated on

On this page