brick CLI Overview
Command-line developer and build tooling for Brick-TS applications.
The brick CLI ships with @brickkit/cli to provide development live reload, production servers, ahead-of-time compilation, and code generation tooling.
Installation
Install @brickkit/cli alongside @brickkit/core:
bun add @brickkit/cli @brickkit/coreRun commands with bunx brick or add them to your package.json scripts:
{
"scripts": {
"dev": "brick dev src/server.ts --port 4000",
"start": "brick start src/server.ts",
"build": "brick build src/server.ts --outdir dist/brick",
"gen:openapi": "brick gen openapi src/server.ts --output openapi.json",
"gen:client": "brick gen client src/server.ts --output src/_brick/contract.ts",
"info": "brick info src/server.ts"
}
}Command Summary
| Command | Arguments & Flags | Description |
|---|---|---|
brick dev | [entry] [--port <number>] [--dashboard-port <number>] [--history-days <number>] [--no-dashboard] [--client <file>] [--frontend <command>] | Start local development server with file watching, live reload, and a local dashboard. |
brick start | [entry] [--port <number>] | Start production server without file watchers. |
brick build | <entry> [--outdir <dir>] [--port <number>] [--no-aot] | Compile a default-exported BrickApp into a standalone Bun server bundle. |
brick gen openapi | <entry> [--output <file>] | Generate OpenAPI 3.1 JSON specification from services. |
brick gen client | <entry> [--output <file>] | Generate typed browser client contract file (_brick/contract.ts). |
brick info / brick services | <entry> | Export the complete runtime architecture JSON schema (ArchitectureSchema). |
Port Resolution Rules
For dev and start, the listening port is resolved in strict precedence order:
- CLI Flag:
--port <number>(e.g.brick dev --port 5000) - Environment Variable:
PORT(e.g.PORT=3000 brick dev) - Default:
4000
Port values must be valid integers between 1 and 65535. Out-of-range values or non-numeric strings cause the CLI to exit immediately with an error.
To generate contracts before frontend startup, see coordinated development. For typed query and mutation options, see TanStack Query.