Rex Documentation

CLI Reference

Rex provides a command-line interface for development, building, and running your application.

rex init

Create a new Rex project.

rex init <name>

Scaffolds a new project directory with a basic page, package.json, and tsconfig.json.

rex init my-app
cd my-app
npm install
rex dev

rex dev

Start the development server with hot module replacement (HMR).

rex dev [options]
OptionDescription
--port <port>, -pPort to listen on (default: 3000)
--host <addr>, -HHost to bind to (default: 127.0.0.1)
--root <path>Project root directory (default: current directory)
--no-tuiDisable TUI, use plain log output

The dev server watches your files and automatically rebuilds when you make changes. HMR updates are pushed to the browser over a WebSocket connection — no full page reload needed for most changes.

rex dev --port 8080 --host 0.0.0.0

rex build

Create a production build.

rex build [options]
OptionDescription
--root <path>Project root directory

This produces optimized bundles in .rex/build/:

  • Server bundle — single IIFE for V8 SSR
  • Client bundles — code-split ESM chunks
  • Manifest — route map and build metadata
  • CSS — extracted and optimized stylesheets
rex build && rex start

rex start

Start the production server using a pre-built bundle.

rex start [options]
OptionDescription
--port <port>, -pPort to listen on (default: 3000)
--host <addr>, -HHost to bind to (default: 0.0.0.0)
--root <path>Project root directory

Requires rex build to have been run first. Static pages are pre-rendered at startup for zero-latency serving.

Note: rex start defaults to 0.0.0.0 (all interfaces) while rex dev defaults to 127.0.0.1 (localhost only).

rex live

Start a live mode server that compiles and serves projects on-demand from source.

rex live [options]
OptionDescription
-m, --mount <prefix>=<path>Mount a project at a URL prefix (repeatable)
--port <port>, -pPort to listen on (default: 4000)
--host <addr>, -HHost to bind to (default: 127.0.0.1)
--workers <n>V8 worker threads per project (default: 4)

Projects are compiled on the first request and cached. Source file changes automatically invalidate the cache. Mount multiple projects under different prefixes:

rex live -m /=./my-app -m /admin=./admin-app

See Live Mode for details.

rex typecheck

Run the TypeScript compiler to check for type errors.

rex typecheck [options] [-- <tsc args>]
OptionDescription
--root <path>Project root directory

Runs tsc --noEmit against your project. Additional arguments are passed through to tsc.

rex lint

Run the linter on your TypeScript and JavaScript files.

rex lint [options] [paths...]
OptionDescription
--root <path>Project root directory
--fixAuto-fix fixable problems
--deny-warningsTreat warnings as errors

Uses OxLint for fast, zero-config linting. No ESLint setup required. Optionally pass specific paths to lint.

rex fmt

Format your source files.

rex fmt [options]
OptionDescription
--root <path>Project root directory
--checkCheck formatting without writing (exits with error if unformatted)

Formats TypeScript, JavaScript, CSS, and JSON files.

Environment variables

VariableDescription
PORTOverride the default port (same as --port)
HOSTOverride the default host (same as --host)
RUST_LOGSet log level — e.g., RUST_LOG=rex=debug for verbose output