> For AI agents: the complete documentation index is available at https://rspress.rs/llms.txt, the full documentation bundle is available at https://rspress.rs/llms-full.txt.

# Commands

This page introduces the built-in Rspress commands and their common options.

For `dev`, `build`, and `preview`, the optional `[root]` argument specifies the docs root directory. If omitted, Rspress uses `root` from the config file, or `docs` in the current directory when `root` is not configured.

## rspress dev

The `rspress dev` command starts a local development server for previewing and debugging your docs.

```txt
Usage:
  $ rspress dev [root]

Options:
  --port <port>          Set the port number for the server
  --host [host]          Set the host that the server listens to
  --base <base>          Set the base path and override config.base
  -v, --version          Display version number
  -h, --help             Display this message
  -c, --config <config>  Set the configuration file (relative or absolute path)
```

## rspress build

The `rspress build` command builds the documentation site for production.

```txt
Usage:
  $ rspress build [root]

Options:
  --base <base>          Set the base path and override config.base
  -h, --help             Display this message
  -c, --config <config>  Set the configuration file (relative or absolute path)
```

## rspress preview

The `rspress preview` command is used to preview the output files of the `rspress build` command locally.

```txt
Usage:
  $ rspress preview [root]

Options:
  --port <port>          Set the port number for the server
  --host [host]          Set the host that the server listens to
  --base <base>          Set the base path and override config.base
  -h, --help             Display this message
  -c, --config <config>  Set the configuration file (relative or absolute path)
```

## rspress eject

The `rspress eject` command copies a built-in theme component to your project so you can customize it.

```txt
Usage:
  $ rspress eject [component]

Options:
  -h, --help             Display this message
  -c, --config <config>  Set the configuration file (relative or absolute path)
```

The optional `[component]` argument is the theme component to eject. If omitted, Rspress lists all ejectable components.

After ejection, the component files are placed in `theme/components/<ComponentName>`. Re-export the component in `theme/index.tsx` to use your customized version.
