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

# preview

The `rs preview` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) to preview an application's production build locally.

## Usage

```bash
rs preview [options]
```

The command loads the application configuration registered with [`define.app()`](/guide/configuration.md#define-app). Run [`rs build`](/guide/cli/build.md) before starting the preview server to generate the production output:

```bash
rs build
rs preview
```

`rs preview` is intended for local preview only. Do not use it as a production server.

## Options

`rs preview` supports the same preview server options as Rsbuild. See the [Rsbuild CLI documentation](https://rsbuild.rs/guide/basic/cli#rsbuild-preview) for details.

Examples:

```bash
# Start the preview server and open the page in the browser
rs preview --open

# Use port 8080 and fail if it is already in use
rs preview --port 8080 --strict-port

# Make the preview server available on the local network
rs preview --host
```

## Configuration

Configure the preview server through [`define.app()`](/guide/configuration.md#define-app) in the [Rstack configuration file](/guide/configuration.md#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/):

```ts title="rstack.config.ts"
import { define } from 'rstack';

define.app({
  server: {
    open: true,
    port: 8080,
  },
});
```
