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

# Quick start

Rstack CLI brings the Rstack toolchain together with one CLI and one configuration file. This guide shows how to create a new Rstack project or add Rstack CLI to an existing project, and introduces the available workflows.

## Environment preparation

Rstack CLI supports using [Node.js](https://nodejs.org/), [Deno](https://deno.com/), or [Bun](https://bun.sh/) as the JavaScript runtime.

Use one of the following installation guides to set up a runtime:

- [Install Node.js](https://nodejs.org/en/download)
- [Install Bun](https://bun.com/docs/installation)
- [Install Deno](https://docs.deno.com/runtime/getting_started/installation/)

:::tip Version requirements

Rstack CLI requires Node.js 22.18.0+ or 24.3.0+.

:::

## Create a Rstack project

[create-rstack](https://www.npmjs.com/package/create-rstack) lets you quickly create an application, library, documentation site, or monorepo with Rstack configured. We recommend using [pnpm](https://pnpm.io/) as your package manager.


```sh [pnpm]
pnpm create rstack@latest
```

```sh [npm]
npm create rstack@latest
```

```sh [yarn]
yarn create rstack
```

```sh [bun]
bun create rstack@latest
```

```sh [deno]
deno init --npm rstack@latest
```

Follow the prompts to complete the setup.

After creating the project, do the following:

- Run `pnpm install` (or your package manager's install command) to install dependencies.
- Run `pnpm run dev` to start the development server or watch mode.

### Templates

When creating a project, choose from the following templates provided by `create-rstack`:

| Project type       | Templates                                                  |
| ------------------ | ---------------------------------------------------------- |
| Web application    | Vanilla JavaScript, React, Preact, Vue, Lit, Svelte, Solid |
| Library            | Node.js, React, Vue, Svelte, Solid                         |
| Documentation site | Single language, multilingual                              |
| Monorepo           | Turborepo                                                  |

All application and library templates are available in both JavaScript and TypeScript.

### Current directory

To create a project in the current directory, set the project name or path to `.`:

```
◆  Create Rstack Project
│
◇  Project name or path
│  .
│
◇  "." is not empty, please choose:
│  Continue and override files
```

### Non-interactive mode

[create-rstack](https://www.npmjs.com/package/create-rstack) supports a non-interactive mode via command-line options. This mode skips prompts and creates the project directly, which is useful for scripts, CI, and automation.

For example, the following command creates a TypeScript React application in the `my-project` directory:

```bash
npx -y create-rstack@latest my-project --template app-react-ts

# Using abbreviations
npx -y create-rstack@latest my-project -t app-react-ts

# Skip Git repository initialization
npx -y create-rstack@latest my-project -t app-react-ts --no-git
```

All CLI flags supported by `create-rstack`:

```text wrapCode
Usage: create-rstack [dir] [options]

Options:
  -h, --help                display help for command
  -d, --dir <dir>           create project in specified directory
  -t, --template <tpl>      specify the template to use
  --no-git                  skip Git repository initialization
  --override                override files in target directory
  --package-name <name>     specify the package name
  --template-version <ver>  specify the npm template version

Available templates: app-vanilla, app-vanilla-ts, app-react, app-react-ts, app-preact, app-preact-ts, app-vue, app-vue-ts, app-lit, app-lit-ts, app-svelte, app-svelte-ts, app-solid, app-solid-ts, lib-node, lib-node-ts, lib-react, lib-react-ts, lib-vue, lib-vue-ts, lib-svelte, lib-svelte-ts, lib-solid, lib-solid-ts, doc, doc-i18n, turborepo
```

## Migrate an existing project

To migrate an existing project to Rstack CLI, see the [migration guide](/guide/migration.md) for supported tools and how to use the migration skill.

## Install Rstack CLI \{#install-rstack}

Install [`rstack`](https://www.npmjs.com/package/rstack) as a development dependency in a project that has a `package.json`:


```sh [npm]
npm install -D rstack
```

```sh [yarn]
yarn add -D rstack
```

```sh [pnpm]
pnpm add -D rstack
```

```sh [bun]
bun add -d rstack
```

## CLI commands

Add the commands your project needs to the `scripts` field in `package.json`. For example:

```json title="package.json"
{
  "scripts": {
    "dev": "rs dev",
    "build": "rs build",
    "preview": "rs preview",
    "test": "rs test",
    "check": "rs check",
    "lint": "rs lint",
    "format": "rs fmt"
  }
}
```

Package scripts use the project-local `rs` binary, so Rstack CLI does not need to be installed globally.

The following commands are available:

- [`rs dev`](/guide/cli/dev.md): Start the application development server.
- [`rs build`](/guide/cli/build.md): Build the application for production.
- [`rs preview`](/guide/cli/preview.md): Preview the application's production build locally.
- [`rs lib`](/guide/cli/lib.md): Build a library with Rslib.
- [`rs doc`](/guide/cli/doc.md): Develop, build, or preview a documentation site with Rspress.
- [`rs test`](/guide/cli/test.md): Run tests with Rstest.
- [`rs check`](/guide/cli/check.md): Run linting and formatting checks, with optional TypeScript type checking.
- [`rs lint`](/guide/cli/lint.md): Lint source code with Rslint.
- [`rs fmt`](/guide/cli/fmt.md): Format code.
- [`rs hooks`](/guide/cli/hooks.md): Install, update, or uninstall repository-level Git hooks.
- [`rs staged`](/guide/cli/staged.md): Run tasks against files staged in Git with lint-staged.

## Configure Rstack CLI \{#configure-rstack}

Create `rstack.config.ts` in the project root and register the configurations your project needs. The following is a minimal example for an application with testing and linting:

```ts title="rstack.config.ts"
// Configuration guide: https://rstack.rs/config
import { define } from 'rstack';

define.app({
  // Rsbuild configuration
});

define.test({
  // Rstest configuration
});

define.lint({
  // Rslint configuration
});
```

See [Configuration](/guide/configuration.md) for all available configuration APIs.

## AI

To learn how to use Rstack CLI with coding agents, see the [AI guide](/guide/ai.md).
