Building the next Node.js API docs

The docs toolkit
for APIs.

doc-kit reads your API from Markdown, MDX, TypeScript and JSDoc, and keeps its signatures, typed parameters, stability and history as data. From there it builds a fast, searchable site, JSON, LLMs.txt and anything else a generator can write.

npm i -D @doc-kit/cli @doc-kit/generator-react

Documenting the JavaScript ecosystem

5B+

requests a month to the Node.js API docs, built with doc-kit

12

built-in generators, from the website to LLMs.txt. Yours is one module

10kB

of gzipped JavaScript up front. Islands load the rest as they hydrate

Performance

Parse once. Build in parallel.

doc-kit parses your docs once and builds every output from that one parse. So JSON, the search index and LLMs.txt add only a little to the time the site takes on its own.

  • Works in chunks. The heavy stages split the work across a pool of worker threads, and the site and JSON are written chunk by chunk.
  • Runs side by side. Outputs that don't depend on each other run at the same time, all from the same API entries.
  • Frees as it goes. A stage's result is dropped once its last reader is done, so memory is reclaimed while the rest of the build runs.

This site, start to finish34 pages · 48,316 words

  • LLMs.txt

    0.5 s

  • The search index

    0.6 s

  • 34 JSON documents

    0.6 s

  • The site: 34 pages, bundled with Vite

    2.8 s

  • All of it in one run

    3.0 s

Median of five clean builds on an AMD Ryzen 9 8945HX (16 cores, 4 worker threads) with Node.js 24.18 and doc-kit ec7751f. How we measured

One source, many formats

Write it once. Every output agrees.

Document an API in Markdown, where a heading is a signature, a list holds typed parameters and a comment records history. Use MDX for pages that need components, or let the TypeDoc plugin write the Markdown from your TypeScript and JSDoc. doc-kit parses it all once into typed API entries and builds every output from them.

# Kittens

<!--introduced_in=v1.0.0-->

The `kittens` module adopts, feeds, and pets kittens.

## `kittens.adopt(name[, options])`

<!-- YAML
added: v1.0.0
changes:
  - version: v2.0.0
    pr-url: https://github.com/acme/kittens/pull/42
    description: Returns a promise.
-->

> Stability: 1 - Experimental

- `name` {string} The kitten's name.
- `options` {Object}
  - `color` {string} Coat color. **Default:** `'tabby'`.
  - `signal` {AbortSignal} Cancels the adoption.
- Returns: {Promise} Fulfills with the adopted kitten.

Adopts a kitten, once the paperwork is done.
M

kittens.adopt

Added in v1.0.0

kittens.adopt(name, options?): Promise

Stability: 1 Experimental

name: stringThe kitten's name.

options?: Object

color?: stringCoat color. Default: 'tabby'.

signal: AbortSignalCancels the adoption.

Returns: PromiseFulfills with the adopted kitten.

Features

Made for API reference.

Knows a method when it sees one

Classes, methods, events, properties and constructors are recognized by how you write their headings. Parameters, defaults, return values, stability and history become data, not decoration.

Types that link themselves

Write {string|Buffer} and each type links to its docs, found in your type map first, then on MDN for JavaScript built-ins and Web APIs, then in your own pages.

Static pages, interactive islands

Pages are rendered to static HTML at build time and load 10 kB of gzipped JavaScript up front. The search box, theme switch and sidebar hydrate once the browser is idle, and code blocks the first time you reach for one. Links between pages swap the content in place.

For people and for models

The search index, a sitemap and LLMs.txt, in a short and a full version, come out of the same build as the site. People and models read the same docs.

Make it yours

Swap any part of the page for your own component, use components in MDX, restyle it with CSS or hand Vite your plugins. This site is doc-kit, themed.

TypeScript and JSDoc, too

The experimental @doc-kit/typedoc plugin turns TypeScript and JSDoc-annotated JavaScript into Markdown, so your reference lives next to your guides.

Getting started

Docs in three steps.

  1. 1Install

    The CLI and the generators that build the site.

    npm i -D @doc-kit/cli @doc-kit/generator-react
  2. 2Write

    Markdown, with headings written like signatures and lists like parameters. Or let @doc-kit/typedoc write it from your TypeScript or JSDoc.

    # Kittens
    
    The `kittens` module adopts, feeds, and pets kittens.
    
    ## `kittens.pet(kitten[, times])`
    
    - `kitten` {Kitten} The kitten to pet.
    - `times` {number} **Default:** `1`.
    - Returns: {boolean} Whether it purred.
  3. 3Generate

    The site and its search index, then a local preview.

    $ npx doc-kit generate -t html -t orama-db -i "docs/*.md" -o out
    $ npx serve out

Built in the open.

doc-kit is an open source project of the Node.js organization, shaped by the people who use it. Bring an issue, an idea, a generator or a pull request.