• English
  • Quick start

    Rstack CLI brings the Rstack toolchain together with one CLI and one configuration file. This guide adds Rstack to an existing project and introduces the available workflows.

    Environment preparation

    Rstack supports using Node.js, Deno, or Bun as the JavaScript runtime.

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

    Version requirements

    Rstack requires Node.js 22.12.0 or higher when using Node.js as the runtime.

    Install Rstack

    Install rstack as a development dependency in a project that has a package.json:

    npm
    yarn
    pnpm
    bun
    npm install -D rstack

    CLI commands

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

    package.json
    {
      "scripts": {
        "dev": "rs dev",
        "build": "rs build",
        "preview": "rs preview",
        "test": "rs test",
        "lint": "rs lint"
      }
    }

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

    The following commands are available:

    • rs dev: Start the application development server.
    • rs build: Build the application for production.
    • rs preview: Preview the application's production build locally.
    • rs lib: Build a library with Rslib.
    • rs doc: Develop, build, or preview a documentation site with Rspress.
    • rs test: Run tests with Rstest.
    • rs lint: Lint source code with Rslint.
    • rs staged: Run tasks against files staged in Git with lint-staged.

    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:

    rstack.config.ts
    import { define } from 'rstack';
    
    define.app({
      // Rsbuild configuration
    });
    
    define.test({
      // Rstest configuration
    });
    
    define.lint({
      // Rslint configuration
    });

    See Configuration for all available configuration APIs.