Skip to main content

Introduction

The Fumadocs CLI (@fumadocs/cli) is a powerful command-line tool that streamlines the process of working with Fumadocs. It provides commands for installing components from the registry, customizing layouts, generating file trees, and managing your documentation project configuration.
Package: @fumadocs/cliVersion: 1.2.5Binary: fumadocs

Installation

Install the Fumadocs CLI as a development dependency in your project:
npm install -D @fumadocs/cli
pnpm add -D @fumadocs/cli
yarn add -D @fumadocs/cli

Quick Start

Initialize a CLI configuration file in your project:
npx fumadocs
This creates a cli.json file with sensible defaults based on your project structure.
The CLI automatically detects whether your project uses a src directory and adjusts the configuration accordingly.

Key Features

Component Installation

Install pre-built components from the Fumadocs registry with automatic dependency resolution.

Layout Customization

Clone and customize Fumadocs UI layouts including Docs, Home, Notebook, and Flux variants.

File Tree Generation

Generate file tree components from directory structures for documentation.

Multi-Registry Support

Access components from multiple registries including local directories and remote URLs.

Available Commands

The Fumadocs CLI provides the following commands:

fumadocs

Initialize a new configuration file.
npx fumadocs
Output:
Initialized a `./cli.json` config file.

fumadocs add

Install components from the registry.
npx fumadocs add [components...]

fumadocs customise

Customize Fumadocs UI layouts interactively.
npx fumadocs customise
Also available as fumadocs customize (American spelling).

fumadocs tree

Generate file tree components from directory structures.
npx fumadocs tree [path] [output]

Registry Shortcuts

The CLI supports convenient shortcuts for common registry sources:
ShortcutExpands To
:previewhttps://preview.fumadocs.dev/registry
:devhttp://localhost:3000/registry
(default)https://fumadocs.dev/registry
Example:
npx fumadocs add search-algolia --dir :preview

UI Library Support

Fumadocs CLI supports multiple UI libraries:
  • Radix UI (default): fumadocs/radix-ui
  • Base UI: fumadocs/base-ui
The CLI automatically fetches components from the appropriate registry based on your configuration.

Next Steps

Commands Reference

Detailed documentation for all CLI commands and their options.

Configuration

Learn how to configure the CLI for your project structure.

Build docs developers (and LLMs) love