brick.ts

@brickkit/cli

The brick command's building blocks: the dev and production servers, contract generation, and the OpenAPI pages.

llms.txt

@brickkit/cli exports 6 names: 4 functions, 2 interfaces.

import { buildApplication, emitCompiledApplication, generateClientContract } from "@brickkit/cli";

Functions

FunctionDescription
buildApplicationBundle an exported BrickApp with generated handlers and its original configuration.
emitCompiledApplicationAn ES module of real JS functions; it never stringifies application callbacks.
generateClientContractGenerate browser metadata and transport types from the app's selected services.
startDevServerWhat brick dev runs: start the application, restart it when its files change, and serve the dashboard beside it.

buildApplication

function buildApplication(
  options: BuildApplicationOptions,
): Promise<{ outdir: string; entry: string; ir: any; }>

Bundle an exported BrickApp with generated handlers and its original configuration.

Parameters

NameTypeDescription
optionsBuildApplicationOptions

Returns Promise<{ outdir: string; entry: string; ir: any; }>

Source: packages/cli/src/build.ts:17

emitCompiledApplication

function emitCompiledApplication(
  ir: BrickIR,
  runtimeImport = "@brickkit/core",
): string

An ES module of real JS functions; it never stringifies application callbacks.

Parameters

NameTypeDescription
irBrickIR
runtimeImport?string default "@brickkit/core"

Returns string

Source: packages/cli/src/compiler/emit.ts:4

generateClientContract

function generateClientContract(app: BrickApp): string

Generate browser metadata and transport types from the app's selected services.

Parameters

NameTypeDescription
appBrickApp

Returns string

Source: packages/cli/src/client-contract.ts:7

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

NameTypeDescription
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 frontend is given without clientOutput, or the dashboard would use the app's port.

Source: packages/cli/src/runner.ts:236

Interfaces

BuildApplicationOptions

interface BuildApplicationOptions

Properties

NameTypeDescription
entrystringA module whose default export is a BrickApp, without starting a server.
outdir?string
port?number
aot?booleanPrecompile Elysia's HTTP handlers at build time (default true).

Source: packages/cli/src/build.ts:7

DevServerOptions

interface DevServerOptions

Properties

NameTypeDescription
port?number
entry?string
prefix?string
clientOutput?stringGenerate a browser contract before starting the backend and frontend.
frontend?stringFrontend command, launched once after the first successful generation.
dashboard?{ port: number; historyDays?: number } | falseLocal dashboard with live requests, traces, errors, and reloads. Needs an entry. historyDays is how long finished requests are kept on disk (default 90); zero keeps live data only.

Source: packages/cli/src/runner.ts:26