1 min read

Quickstart

document0 is framework-agnostic. The core packages (@document0/core and @document0/mdx) work anywhere Node.js runs. Pick your framework to get started:

Framework guides

adding a test here for HMR

FrameworkStatus
Next.jsAvailable
React (Vite)Coming soon
VueComing soon
SvelteComing soon
AstroComing soon
AngularComing soon

Scaffold with create-document0

The fastest way to get started with Next.js:

npx create-document0 my-docs
cd my-docs
npm run dev

This scaffolds a complete working docs site. See create-document0 for details.

The basics (any framework)

Regardless of framework, the core workflow is the same:

1. Install

npm install @document0/core @document0/mdx shiki @mdx-js/mdx

2. Create a source

import { DocsSource } from "@document0/core";

const source = new DocsSource({
  rootDir: "./content/docs",
  baseUrl: "/docs",
});

3. Get pages and render

import { processMdx } from "@document0/mdx";

const page = await source.getPage("installation");
const { code, frontmatter, toc } = await processMdx(page.content, options);

4. Build navigation

const tree = await source.getPageTree();   // sidebar tree
const crumbs = getBreadcrumbs(tree, url); // breadcrumbs
const { previous, next } = getPageNeighbours(tree, url);
import { createSearchRoute } from "@document0/core/search";

export const { GET } = createSearchRoute(source);

Each framework guide covers how to wire these pieces into your specific routing and rendering layer.

Next steps