Build a Docs Site

Build a docs site

Build a docs site

Leadtype offers two integration shapes for a docs site. Pick the one that fits how your app is built — both produce the same content, just at different layers of your stack.

Pick your path

Rendering diagram...
PathWhen to chooseWhat you wire
Source primitiveMost cases. You're building a Next, Vite, Astro, or Fumadocs app and compile MDX with your bundler.createDocsSource() (or leadtype/fumadocs) + createMdxSourcePlugins()
Static artifactsYour runtime needs flat files on disk (CDN-only deploy, static export, agent-only consumption, multi-app sharing).leadtype generate CLI in your build script

The two paths are not mutually exclusive — you can use the source primitive for your UI and still run leadtype generate for the llms.txt and agent-readability artifacts.

Source primitive: the common path

If your docs app compiles MDX through a bundler, use the source primitive. It gives your runtime:

  • loadPage(slug) returning frontmatter + AST + serialized markdown + TOC
  • getNavigation() returning the resolved group tree
  • buildSearchIndex() returning a static search index
  • resolveInclude() for programmatic partial loading

Use the source primitive — generic recipe → Integrate with Fumadocs — first-party adapter

Static artifacts: the CLI path

If your runtime needs files on disk — for a CDN-only deploy, a static export, a separate agent-only service, or to share artifacts across multiple sibling apps — run the CLI. It writes:

  • public/llms.txt and public/llms-full.txt
  • public/docs/*.md (markdown mirrors)
  • public/docs/search-index.json + search-content.json
  • public/docs/sitemap.xml, sitemap.md, robots.txt, agent-readability.json

Generate static artifacts — CLI workflow

Add the cross-cutting features

Whichever path you pick, the same follow-on guides apply:

Configure product and groups

Both paths read the same docs/docs.config.ts. Source repos own this file so groups and product metadata version with the docs:

Pages declare group: in frontmatter; the config declares titles, order, and descriptions. See Frontmatter for the page-level schema.