---
layout: 'page'
uri: '/getting-started/commands'
position: 3
slug: 'getting-started-commands'
parent: 'getting-started'
navTitle: 'Commands'
title: 'Commands'
description: 'Overview of all Documan CLI commands for managing documentation.'
---

# Commands

Documan provides several CLI commands for managing your documentation. Run any command with `./documan <command>`.

## serve

Start the webserver that serves the documentation site, REST API, and MCP server.

```bash
./documan serve
```

After starting, access your documentation at `http://localhost:3000` (or your configured port). The MCP server endpoint is available at `/mcp`.

See [General configuration](/configuration/general) for port settings.

## import

Import markdown files into the database based on configured glob patterns.

```bash
./documan import
```

This command:
- Validates all markdown files (runs lint automatically)
- Imports valid files into the database
- Marks removed files as deleted

Run this command after adding or modifying documentation files. Configuration options `DOCUMAN_DOCS_FILES` and `DOCUMAN_EXCLUDED_FILES` control which files are imported. See [General configuration](/configuration/general).

## lint

Validate markdown files without modifying the database.

```bash
./documan lint
```

Checks for:
- Required frontmatter fields (layout, uri, slug, title)
- Duplicate slugs and URIs
- Circular parent references
- Parent slug existence
- Broken internal links (target page must exist)
- Broken image references (file must exist on disk)
- Broken file link references (static file must exist on disk)

Use this in CI/CD pipelines to catch documentation errors before deployment. See [CI/CD integration](/deployment/ci-cd-integration) for pipeline examples.

## fix

Auto-generate and fix missing frontmatter metadata in markdown files.

```bash
./documan fix
```

This command:
- Reorders frontmatter fields to standard order
- Generates missing `uri` from file path
- Generates missing `slug` from URI
- Extracts `title` from first H1 heading
- Generates `navTitle` from filename
- Sets `layout` based on file type (`.list.md` = list, others = page)
- Preserves all existing values

See [Markdown Frontmatter](/getting-started/markdown-frontmatter) for field documentation.

## vectorize

Generate vector embeddings for semantic search capabilities.

```bash
./documan vectorize
```

**Requires:** `DOCUMAN_OPENAI_API_KEY` environment variable. See [Semantic search](/configuration/semantic-search).

This command processes all imported documents and creates embeddings using OpenAI's API. The embeddings enable semantic search via the MCP `search_in_documentation` tool.

**Note:** The API key is also required at runtime — each MCP search query calls OpenAI to convert the query text into an embedding for similarity matching.

**Cost:** The default `text-embedding-3-small` model is extremely cost-effective — $1 covers approximately 62,500 pages of text. This applies to both vectorization and runtime search queries.

### Rate limiting

Documan automatically adapts to your OpenAI API tier:

- **Higher tiers** (more API spend) = faster processing with more concurrent requests
- **Lower tiers** = slower but still runs at maximum allowed speed

The system reads OpenAI's rate limit headers and dynamically adjusts the number of parallel workers. If you hit rate limits, it automatically backs off and retries. You don't need to configure anything - it just works optimally for your tier.

| Tier | Approximate speed |
|------|-------------------|
| Free/Tier 1-2 | ~200 pages/min |
| Tier 3 | ~1,300 pages/min |
| Tier 4+ | ~6,500+ pages/min |

Run `import` before `vectorize` - documents must exist in the database first.

---

[← Showcase](/getting-started/markdown-showcase.md) | [⚙️ Configuration →](/configuration.md)
