@getstrata/cli
v2.2.35
Published
Strata CLI: framework commands for Bun apps (dev, start, migrate, run)
Readme
@getstrata/cli
The strata binary for Strata apps. Bun stays the runtime, installer, and test runner; strata owns the app lifecycle. Requires Bun >=1.4.3 (tested on 1.4.3).
Commands
strata dev
strata start
strata migrate
strata migrate:fresh
strata run src/scripts/backfill.ts
strata helpstrata --help and strata -h print the same list as strata help.
strata run <file> executes a file with the app preload. It is not an alias for bun run <script>.
strata start does not migrate when APP_ENV=production. Run strata migrate as an explicit deploy step.
App commands from src/cli/register.ts merge with this list. Generated apps add queue:work, failed-job commands, make:*, openapi:*, and schedule:run. User-auth starters also add explicit auth:provision-admin; its initialAdmin subpath reads bounded password input from a pipe and redacts provisioning errors. The app owns its transactional one-time claim and user schema. See initial-admin provisioning before adoption.
Running it
This package installs into your app, not globally, so strata lands in node_modules/.bin and is not on your PATH. Use the scripts a generated app already ships:
bun run dev
bun run db:migrateOr call it directly from inside the app directory:
bunx strata devRunning bunx strata from outside a Strata app resolves an unrelated npm package named strata and starts a static file server. Stay in the app directory.
How it finds your app
From the current working directory, strata loads strata.config.ts if present, then falls back to conventions:
| Setting | Convention |
| --- | --- |
| preload | src/bootstrap/preload.ts or src/bootstrap/preloadModules.ts |
| server | src/bootstrap/server.ts |
| modulesDirectory | src/modules |
| commands | src/cli/register.ts |
| migrate | src/db/migrate.ts |
| fresh | src/db/fresh.ts |
src/cli/register.ts can export commands or registerCommands() to add your own commands. Generated apps ship queue:work, which boots the app (bootstrapApp / createApp) rather than the monorepo provider stack, plus make:*, failed-job commands, openapi:*, and schedule:run. User-auth starters also add explicit auth:provision-admin; its initialAdmin subpath reads bounded password input from a pipe and redacts provisioning errors. The app owns its transactional one-time claim and user schema. See initial-admin provisioning before adoption.
Helpers live on package subpaths: @getstrata/cli/queueWorker, @getstrata/cli/queueFailed, @getstrata/cli/scaffold, @getstrata/cli/openapi, and @getstrata/cli/schedule. queue:work takes { boot, close } and does not call assertProductionSecrets() (that belongs in app boot). Scaffold commands resolve paths from the app working directory (src/modules, src/db/migrations, src/jobs, views/ or resources/views). See docs/BUILDING-APPS.md.
A migrate entry may export close(). The CLI calls it after migrate() and fresh() so pooled drivers such as mysql2 release the event loop instead of hanging the command.
Creating a new app
This package does not scaffold. Use the starter:
bunx create-strata my-app