---
title: Why DocsLit
description: Why DocsLit ships less JavaScript than React-based docs tools, why it uses web components, and how every site works for AI agents without extra setup.
tag: Overview
readtime: 6 min read
---
> For AI agents: the complete documentation index is at [llms.txt](https://docs.docslit.com/0.3/llms.txt). This page as Markdown: [getting-started/why-docslit.md](https://docs.docslit.com/0.3/getting-started/why-docslit.md).


<!-- docslit-lint-disable raw-html-block -->

# Why DocsLit

Your docs have two kinds of readers now. People read them in a browser. AI agents read them for people: coding assistants, chat search and IDE agents that fetch a page, take what they need and move on.

DocsLit is built for both. Pages are plain HTML that loads fast on any device, and every build publishes a Markdown copy of your docs that agents can read directly. You don't install a plugin or configure anything to get either.

## The numbers

These figures come from DocsLit 0.3.0 and from building this site, which has 66 pages.

<wc-tiles>
<wc-tile icon-name="package" title="57 KB per page" description="JavaScript a typical page loads, gzipped: Lit, the DocsLit core, the site shell and the components on the page."></wc-tile>
<wc-tile icon-name="zap" title="1.5 s build" description="A full build of this 66-page site on a laptop. No webpack, no Vite, no framework compiler."></wc-tile>
<wc-tile icon-name="bot" title="0 plugins for agents" description="llms.txt, Markdown copies, agent.json and an MCP server come with every build."></wc-tile>
<wc-tile icon="right-left" title="7 importers" description="Move from Mintlify, Fern, GitBook, MkDocs, Docusaurus, VitePress or Starlight with one command."></wc-tile>
</wc-tiles>

## Docs don't need an app framework

Most documentation tools are built on React. To show you a page of text, they send your browser a JavaScript application. The browser downloads it, runs it, and then rebuilds in memory the page the server already sent. This step is called hydration, and on a docs page it buys almost nothing: headings, paragraphs and code samples don't change after they load.

DocsLit starts from what a docs page is: a document with a few interactive parts. It writes each page as finished HTML at build time. The interactive parts, such as tabs, code groups and the API playground, are web components that the browser runs directly. There's no framework runtime underneath and nothing to hydrate.

## Less JavaScript, faster pages

Every kilobyte of JavaScript costs your readers twice: once to download it, and again to parse and run it. On a fast laptop you barely notice. On a mid-range phone on a train, it decides whether the page shows up in one second or five.

| Framework | Client JS (gzipped) | React required | Hydration |
|---|---|---|---|
| DocsLit | 57 KB typical, 80 KB with every component | No | None |
| Nextra 4 | 106 KB | Yes (React 19) | Full page |
| Fumadocs | 161 KB | Yes (React 19) | Partial (RSC) |
| Docusaurus 3 | 250 to 400 KB | Yes (React 18) | Full page |
| Mintlify | More than 100 KB | Yes (Next.js) | Full page |

Figures for other tools are approximate and change with the version and the site.

DocsLit keeps that number low by loading only what a page uses:

- **Components load by family.** A page that has tabs and code blocks loads those two families and nothing else. The build adds a `modulepreload` link for each one, so the browser fetches them in parallel.
- **Block components render when they come near the viewport.** A long reference page doesn't pay for the content the reader hasn't scrolled to.
- **Search loads on first use.** The 17 KB search engine downloads the first time a reader opens search, not on every page.
- **Everything comes from your own site.** Lit ships in `docslit-vendor/`, so there's no CDN request. The one exception is Mermaid, which `wc-mermaid` loads only on pages that have a diagram.

Here's what a page loads:

| File | What it does | Gzipped |
|---|---|---|
| `docslit-vendor/lit.js` | The Lit runtime, plus a 0.5 KB directive | 6.5 KB |
| `docslit-core.js` | Shared code for every component | 5.3 KB |
| `docslit-app.js` | The site shell: navigation, table of contents, theme and the search dialog | 19.3 KB |
| `docslit-c-<family>.js` | One file per component family, only when the page uses it | 1.7 to 10.5 KB each |

For comparison, React and ReactDOM alone are about 45 KB gzipped, before a docs site adds its router, its components or a single word of content.

## Web components are part of the browser

React components only work inside React. Web components are a browser standard: every modern browser runs them natively, the same way it runs a `<video>` or `<details>` element. That one difference changes how you write and keep your docs.

<wc-steps>
<wc-step title="You write Markdown, not code">

With a React-based tool, a callout needs an import and JSX:

```jsx title="React / MDX"
import { Callout } from '@/components/Callout'

<Callout type="warning">
  You need to restart the server after changing config.
</Callout>
```

With DocsLit, it's an HTML tag in your Markdown:

```markdown title="DocsLit"
<wc-callout type="warning" title="Restart required">
You need to restart the server after changing config.
</wc-callout>
```

There's no import and no file-level setup. The browser registers every component once, so any page can use any of the 67 built-in components.

</wc-step>
<wc-step title="Your content stays in the HTML">

The text inside a component is part of the page's HTML, not data hidden in a JavaScript bundle. Search engines and AI crawlers that don't run JavaScript still read every word.

</wc-step>
<wc-step title="Styles can't leak">

Each component keeps its styles in its own shadow DOM, so a rule in your stylesheet can't break a component by accident, and a component can't restyle your page. You still control the look through [design tokens](../customization/design-tokens) and `::part()` selectors.

</wc-step>
<wc-step title="Your docs outlive the framework">

Markdown and custom elements are standards, so there's no framework major version to upgrade every two years. When you need your own component, write it with Lit or plain JavaScript. See [Custom components](../customization/custom-components).

</wc-step>
</wc-steps>

## Agents read your docs, and DocsLit is ready for them

More and more of the reading on a docs site happens without a browser. A developer asks a coding assistant how to call your API, and the assistant fetches your docs. Agents don't want your navigation, your scripts or your styling. They want the text, in a form they can trust, at a URL they can find.

Most docs tools add that later, through a plugin, a paid tier or a third-party service. In DocsLit it's the default. Run `docslit build` and the output already includes:

| What agents get | How it works |
|---|---|
| `llms.txt` and `llms-full.txt` | An index of every page, and the full text of the site in one file |
| A Markdown copy of every page | `getting-started/quickstart.md` next to `getting-started/quickstart.html`, linked from each page with `<link rel="alternate" type="text/markdown">` |
| Content negotiation | A request with `Accept: text/markdown` gets Markdown back. The build writes the rules for Cloudflare Pages and Vercel |
| `sitemap.md` and `changes.md` | The site map and recent changes, in Markdown |
| `.well-known/agent.json` | A machine-readable description of the site and where to find each of these files |
| `mcp-server.js` | A standalone MCP server with tools to search your docs, read pages and pull code examples |
| `robots.txt` | Rules for the major AI crawlers, including `GPTBot`, `ClaudeBot` and `PerplexityBot` |

There's nothing to install and nothing to configure. Agents also get the same structure people do: the Markdown copies keep your headings, code blocks and tables, so an assistant quotes your docs instead of guessing.

To go further, you can [publish agent skills](../ai-and-agents/agent-skills), give a page a [separate version for agents](../components/conditional-content#replace-a-whole-page-for-agents), or set content signals. See [How agents read your site](../ai-and-agents/reading-agents).

### Agents can write your docs too

The same design helps the agents on your team. The DocsLit commands an agent needs print JSON, so an AI coding tool can learn the components, write a page and check its own work without guessing:

```bash
docslit agents init                  # write AGENTS.md, skills and MCP config for your AI tools
docslit components wc-tabs --json    # attributes, allowed values and nesting rules
docslit validate --format json       # broken links, bad markup, each with a line and a fix
```

`docslit agents init` sets up Claude Code, Cursor, Copilot, Windsurf, Codex and Gemini in one step. DocsLit itself never calls a language model and never sends your content anywhere. See [Built for AI agents](../ai-and-agents/overview).

## Builds in seconds

A React-based build runs a bundler, a JavaScript compiler, the MDX compiler and React's server renderer, and its build time grows with the size of the bundle graph. A new Docusaurus project installs more than 1,000 npm packages before you write a page.

DocsLit renders Markdown to HTML with `unified`, `remark` and `rehype`, writes the files and stops. This site's 66 pages build in about 1.5 seconds. DocsLit has 26 direct dependencies and installs about 300 packages in total. `docslit build --incremental` reuses unchanged pages, and the output is plain files that any static host can serve.

## Included with every site

You don't add these with plugins, accounts or paid tiers:

<wc-accordion-group>
<wc-accordion title="Full-text search">

The build generates a search index and the browser searches it locally. There's no Algolia account, no DocSearch application and no external API call.

</wc-accordion>
<wc-accordion title="Offline builds">

Run `docslit build --offline` for a self-contained site that works from a `file://` URL or on an air-gapped network. It makes no external requests and uses no inline event handlers, so it suits locked-down environments.

</wc-accordion>
<wc-accordion title="Validation and linting">

`docslit validate` checks links, assets, components and frontmatter. `docslit lint` checks quality: descriptions, headings, code languages, alt text and link text. Both run in CI with `--format github`.

</wc-accordion>
<wc-accordion title="API reference">

Point DocsLit at an OpenAPI spec and it generates endpoint pages, with an interactive playground for trying requests.

</wc-accordion>
</wc-accordion-group>

## One more thing

Moving docs is usually the reason teams stay where they are. DocsLit takes that off the table.

```bash
docslit import ./my-docs --out ./docs-site
```

`docslit import` detects Mintlify, Fern, GitBook, MkDocs, Docusaurus, VitePress and Starlight projects and converts them: pages, components, code blocks, navigation, branding and redirects. Whatever it can't convert goes into a `MIGRATION.md` report, with the file and line, so you know exactly what's left. Hand that report to your AI coding tool and it can finish the job. See [Migrate from Mintlify](../migration/from-mintlify) and [Migrate with AI](../migration/migrate-with-ai).

## When to choose something else

DocsLit produces static sites for documentation. Pick a React-based tool instead if:

- Your docs embed full React applications, such as drag-and-drop editors, and you want the React ecosystem on the page.
- Your team maintains a React design system and wants to reuse those components without porting them.
- You need server-side code that runs on every page request.

For everything else, start here:

<wc-columns cols="2">

<wc-card title="Quickstart" href="quickstart" icon="rocket" cta="Build a site">
Go from an empty folder to a running docs site.
</wc-card>

<wc-card title="Built for AI agents" href="../ai-and-agents/overview" icon="bot" cta="See how">
Everything agents get from a DocsLit site, and how to set up your AI tools.
</wc-card>

</wc-columns>
