@brickkit/cli
The brick command's building blocks: the dev and production servers, contract generation, and the OpenAPI pages.
@brickkit/cli exports 12 names: 4 functions, 4 interfaces, 3 types, 1 variable.
import { buildApplication, defineConfig, generateClientContract } from "@brickkit/cli";Functions
| Function | Description |
|---|---|
buildApplication | Bundle an exported BrickApp with its compiled IR and its original configuration. |
generateClientContract | Generate browser metadata and transport types from the app's selected services. |
startDevServer | What brick dev runs: start the application, restart it when its files change, and serve the dashboard beside it. |
startWorker | What brick worker runs: load the app, deliver its events and run its schedules from this process, without serving HTTP. |
buildApplication
function buildApplication(
options: BuildApplicationOptions,
): Promise<{ outdir: string; entry: string; ir: any; dashboard: string | undefined; workflows: string | undefined; }>Bundle an exported BrickApp with its compiled IR and its original configuration.
Parameters
| Name | Type | Description |
|---|---|---|
options | BuildApplicationOptions |
Returns Promise<{ outdir: string; entry: string; ir: any; dashboard: string \| undefined; workflows: string \| undefined; }>
Source: packages/cli/src/build.ts:51
generateClientContract
function generateClientContract(app: BrickApp): stringGenerate browser metadata and transport types from the app's selected services.
Parameters
| Name | Type | Description |
|---|---|---|
app | BrickApp |
Returns string
Source: packages/cli/src/client-contract.ts:16
startDevServer
function startDevServer(options: DevServerOptions = {}): Promise<any>What brick dev runs: start the application, restart it when its files
change, and serve the dashboard beside it. With an entry, the app runs in
a worker process that restarts on every change to the entry or the files it
imports, and reports its requests to the dashboard; without one, a server
with the registered services starts in this process.
Parameters
| Name | Type | Description |
|---|---|---|
options? | DevServerOptions default {} | entry, port (else PORT, else 4000), prefix, clientOutput to regenerate the typed client's contract on each start, frontend to launch a frontend command once, and dashboard (port and historyDays, or false). |
Returns Promise<any> — The application, when started in this process.
Throws
- When
frontendis given withoutclientOutput, or the dashboard would use the app's port.
Source: packages/cli/src/runner.ts:145
startWorker
function startWorker(options: { entry: string }): Promise<unknown>What brick worker runs: load the app, deliver its events and run its
schedules from this process, without serving HTTP. Run it beside API processes that only record
events (events: { dispatch: false }), or alone for an app with no routes.
Workflow listeners run here too: the world starts and the steps of every run
in it execute in this process.
Parameters
| Name | Type | Description |
|---|---|---|
options | { entry: string } | entry: the app file, which must default-export a brick() app. |
Returns Promise<unknown> — The app.
Throws
- When the entry is missing, has no
events, or only records events.
Source: packages/cli/src/runner.ts:96
Interfaces
BuildApplicationOptions
interface BuildApplicationOptionsProperties
| Name | Type | Description |
|---|---|---|
entry | string | A module whose default export is a BrickApp, without starting a server. |
outdir? | string | |
port? | number | |
aot? | boolean | Precompile Elysia's HTTP handlers at build time (default true). |
dashboard? | DashboardExtensionOptions | The dashboard's extension, built into <outdir>/dashboard with those of the app's plugins for the production dashboard to serve; its theme is checked here too. |
Source: packages/cli/src/build.ts:17
DashboardExtensionOptions
interface DashboardExtensionOptionsWhat dashboard accepts wherever the dashboard starts or is built.
Properties
| Name | Type | Description |
|---|---|---|
extension? | string | A module whose default export is defineDashboard({ ... }), or the dashboard folder brick build wrote it to. |
theme? | DashboardTheme |
Source: packages/cli/src/dashboard-extension.ts:33
DashboardTheme
interface DashboardThemeToken values for the dashboard's light and dark themes, its radius and fonts.
Properties
| Name | Type | Description |
|---|---|---|
light? | Record<string, string> | Colour tokens in light mode, by name: { primary: "oklch(0.55 0.2 260)" }. |
dark? | Record<string, string> | Colour tokens in dark mode. |
radius? | string | The base corner radius, such as "0.5rem". |
fonts? | { sans?: string; mono?: string } | CSS font stacks. The page must be able to load the font. |
Source: packages/cli/src/dashboard-extension.ts:21
DevServerOptions
interface DevServerOptionsProperties
| Name | Type | Description |
|---|---|---|
port? | number | |
entry? | string | |
prefix? | string | Deprecated. Only used without an entry; an exported app sets its own prefix in brick({ prefix }). |
clientOutput? | string | Generate a browser contract before starting the backend and frontend. |
frontend? | string | Frontend command, launched once after the first successful generation. |
dashboard? | | ({ port?: number; historyDays?: number } & DashboardExtensionOptions) | false | Local dashboard with live requests, traces, errors, and reloads. Needs an entry. port is where it listens and historyDays how long finished requests are kept on disk; zero keeps live data only. extension and theme customise it (see DashboardExtensionOptions). |
manifest? | { services: string; generated: string } | Keep <generated>/services.gen.ts importing every definition file under services: written before the app starts and again when files change. |
Source: packages/cli/src/runner.ts:27
Types
BrickConfig
type BrickConfig = Static<typeof BrickConfigSchema>;Source: packages/cli/src/config.ts:141
LintPreset
type LintPreset = (typeof PRESET_NAMES)[number];Source: packages/cli/src/config.ts:21
LintSeverity
type LintSeverity = (typeof SEVERITIES)[number];Source: packages/cli/src/config.ts:22
Variables
defineConfig
const defineConfig: typeof defineProjectConfigDeprecated. Import it from
@brickkit/cli/config, which loads less. This one keeps everything index reaches loadable under Node.
Source: packages/cli/src/index.ts:14