CLI
Three commands: build compiles the app into dist/, start serves it, dev rebuilds and reloads while you edit.
The commands
usage:
brust build [entry=routes.tsx] [--out-dir dist] [--force] [--target bun|cloudflare|static] [--actions-only] [--strict] [--wasm-from-source] [--dev]
brust dev [entry=routes.tsx] [--port N] [--workers N] (Bun target: proxy + hot reload + inline TUI)
brust dev [entry=routes.tsx] --target cloudflare [--out-dir dist] [--port N] [--wasm-from-source] [-- <wrangler args>]
brust start [--port N] [--workers N] [--dist-dir dist] [--entry routes.tsx]Exit codes: 0 on success, 1 for a build or boot error, 2 for a usage error.
What they print
Real output, from the pokedex example and from this site's own build.
The pokedex example. Each React fallback prints once, with its rule and line.
$ brust build routes.tsx
warning hook-unsupported components/TeamBuilder.tsx:12:26 hook useReducer is not supported
warning hook-unsupported components/UnifiedIsland.tsx:11:25 hook useReducer is not supported
[brust] built dist in 73msReady once every worker has booted. Server log lines trimmed.
$ brust start
[brust] listening on 127.0.0.1:1337 (io: hyper(tokio))
[brust] ready (10 workers)start needs a built dist/ (the absolute path in the message is shortened to ~ here).
$ brust start
[brust] run brust build first (~/pokedex/dist/manifest.json not found)Plain output (a pipe or CI), recorded on the blank template: one page edit, then a stylesheet edit.
$ brust dev routes.tsx --port 4873
[brust] dev server on http://127.0.0.1:4873 — [r]eload [o]pen [w]arnings [c]lear [q]uit
[brust] building http://127.0.0.1:4873 gen 0
[brust] ready http://127.0.0.1:4873 gen 1 (55ms)
[brust] building http://127.0.0.1:4873 gen 1 (55ms)
[brust] ready http://127.0.0.1:4873 gen 2 (46ms)
[brust] css public/app.css (no reload)brust build
- Takes one entry,
routes.tsxby default. A build error printserror <rule> <message>and exits 1. - Writes to a temporary folder and swaps it in only on success.
- Refuses an out dir that is not empty and was not made by brust, unless you pass
--force, and never writes to the app root, your home or a folder with sources (out-dir-unsafe). --target cloudflarealso writesdist/cf/, a Worker ready for wrangler.
brust start
- Serves the built
dist/; it takes no entry argument. It setsNODE_ENV=productionunless you set it. SIGINTorSIGTERMdrain in-flight requests, then exit 0. A second signal exits at once.- If a worker dies, the server drains and exits 1. It does not respawn workers: run it under a supervisor that restarts the process.
brust dev
brust dev is the development server for the Bun target. It rebuilds when you save, boots the new build beside the old one and swaps it in, and shows build errors above the last good page. It takes an entry, --port and --workers. The whole loop, the terminal keys, the browser overlay and the dev trace are on the Dev mode page.
brust dev --target cloudflare builds, runs wrangler dev, watches the app and rebuilds on a change (no hot reload). A failed rebuild keeps the running Worker. Arguments after -- go to wrangler, and the Bun dev server refuses them.
Every flag
| Flag | Commands | What it does |
|---|---|---|
--out-dir | build, dev (cloudflare) | Where the build is written. Default dist. |
--force | build | Writes into an out dir that is not empty and was not made by brust. |
--target bun|cloudflare|static | build, dev | bun is the default. cloudflare also writes dist/cf/, a Worker for wrangler. static also renders every page to files in dist/static/ that you can upload to Cloudflare Pages (see Deployment). |
--strict | build --target static | A loader that reads the request (headers, cookies, query) fails the build instead of rendering the page a visitor with none of those would see. |
--actions-only | build | Builds only the [actions] app, with no pages. It combines with --target bun (the default) and --target cloudflare. See Actions. |
--dev | build | Also writes dev.json and builds the client runtime for dev. brust dev passes it for you; you rarely type it. |
--wasm-from-source | build, dev (cloudflare) | Builds the Cloudflare wasm host from the repository's Rust source instead of using the published package. |
--port, --workers | start, dev | The port (0 picks a free one) and the number of Bun workers. |
--dist-dir, --entry | start | Which built folder to serve and which routes module to load. Defaults dist and routes.tsx. |
A page-only build (pages that call actions on another origin) has no flag. It is what brust build does when brust.toml sets [actions] base_url and the project has no actions file.