Build the docs pipeline

Generate reference docs, chunk the index, and wire the docs pages the same way this repo does.

What you'll build

  • Generated Markdown and a chunked index manifest.
  • Reference routes powered by the docs loader.
  • Versioned outputs you can publish per release.

1) Generate contract docs

generate-contract-docs
contractspec generate

Expected output: Markdown in generated/docs.

2) Build the docs index

docs-generate
bun docs:generate
# versioned output
bun docs:generate -- --version v1.0.0

This writes docs-index.manifest.json and chunkeddocs-index.*.json files in the generated docs bundle.

3) Wire reference routes

docs-reference-route
import { notFound } from "next/navigation";
import {
  DocsReferenceIndexPage,
  DocsReferencePage,
  getGeneratedDocById,
  listGeneratedDocs,
} from "@contractspec/bundle.library";

export async function generateStaticParams() {
  const docs = await listGeneratedDocs();
  return docs.map((doc) => ({ slug: doc.id.split("/") }));
}

export default async function Page({ params }: { params: { slug?: string[] } }) {
  const slug = params.slug?.join("/") ?? "";
  const doc = await getGeneratedDocById(slug);
  if (!doc) notFound();
  return <DocsReferencePage entry={doc.entry} content={doc.content} />;
}

Use the index page on /docs/reference to render the searchable list.

Repo reference

This repo wires docs under packages/apps/web-landing/src/app/docs/reference.

Need hosted docs releases?

Studio can publish versioned docs bundles with approvals and audit trails.

Join Studio waitlist