CLI
appbricx 0.1.0: one command per developer-API verb, for your terminal, scripts, CI and coding agents with a shell. Exit code 0 is success, 1 means the server said no (an invalid contract, a red verify), 2 is a usage error.
On this page
Install and sign in
The CLI lives in cli/ of the public appbricx-examples repository (it isn't published to npm yet). It signs in through your browser by default and keeps its state in ~/.config/appbricx/config.json; a directory is linked to a project through .appbricx/project.json and the contract you edit is ./appbricx.json.
git clone https://github.com/Naveenbhargav-m/appbricx-examples
alias appbricx="node $PWD/appbricx-examples/cli/bin/appbricx.mjs"
appbricx login
appbricx create "Tablefor"
appbricx pull && $EDITOR appbricx.json
appbricx check && appbricx apply && appbricx verify
appbricx deploy --subdomain tableforGlobal flags and env
| Flag or variable | What it does |
|---|---|
--json | Print the server's raw JSON instead of the human summary (errors too). |
--project | Use this project id instead of the directory's link (.appbricx/project.json). |
--help | Print the usage text. |
APPBRICX_API | The API base URL (default https://appbricx.com/api; self-hosted: your own). Overrides the saved config. |
APPBRICX_TOKEN | A token to use instead of the saved sign-in: what CI and coding agents set. |
APPBRICX_PROJECT | The project id, instead of the directory's link. |
APPBRICX_CONFIG | Where the config lives (default ~/.config/appbricx/config.json, mode 0600). |
Setup
appbricx login
Sign in. By default it opens Appbricx in your browser, you click Authorize, and the CLI stores an OAuth token pair that refreshes itself. --token stores a personal access token instead (CI, headless machines); --email and --password sign in with a password and mint a token with all three scopes.
appbricx login [--api <url>] [--no-browser] | login --token <pat> | login --email <e> --password <p> [--workspace <id>]Flags
| Flag | Type | Description |
|---|---|---|
--apioptional | string | The API base URL (default https://appbricx.com/api). |
--tokenoptional | string | A personal access token (apx_pat_…). |
--emailoptional | string | Password sign-in: the account email (needs --password). |
--passwordoptional | string | Password sign-in: the password. |
--workspaceoptional | string | Password sign-in: which workspace the minted token reaches (default the first). |
--no-browseroptional | boolean | Print the sign-in URL instead of opening a browser. |
- Scope
- None needed. Password sign-in mints read, apply and deploy.
- Exit code
- 0 signed in; 1 the server refused; 2 usage error (for example --email without --password).
appbricx login
# CI
appbricx login --token "$APPBRICX_TOKEN"✓ signed in as dev@example.com (scopes: read, apply, deploy). Saved to ~/.config/appbricx/config.jsonSource: packages/cli/src/main.mjs:187
appbricx logout
Revoke the browser sign-in and forget the saved tokens. A personal access token stays valid until you revoke it in Workspace settings, Coding agents.
appbricx logout- Scope
- None.
appbricx logout✓ signed out; this CLI's authorization is revokedSource: packages/cli/src/main.mjs:223
appbricx whoami
The signed-in user, credential kind, scopes and workspaces.
appbricx whoami- Scope
- any
- Calls
GET /api/dev/v1/me
appbricx whoamidev@example.com (pat; scopes: read, apply)
workspace Acme — 6a1f… (owner)Source: packages/cli/src/main.mjs:272
appbricx projects
List the projects you can reach.
appbricx projects- Scope
- any
- Calls
GET /api/dev/v1/projects
appbricx projects3b7e… TableforSource: packages/cli/src/main.mjs:281
appbricx create
Create a project and link this directory to it (.appbricx/project.json).
appbricx create <name>- Scope
- apply
- Calls
POST /api/dev/v1/projects
appbricx create Tablefor✓ created Tablefor (3b7e…) and linked this directorySource: packages/cli/src/main.mjs:286
appbricx link
Link this directory to an existing project.
appbricx link <project-id>- Scope
- any
- Calls
GET /api/dev/v1/projects/:id
appbricx link 3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1bSource: packages/cli/src/main.mjs:294
Contract
appbricx pull
Write the project's contract to ./appbricx.json (or the file you name).
appbricx pull [file]- Scope
- any
- Calls
GET /api/dev/v1/projects/:id/contract
appbricx pull✓ wrote appbricx.jsonSource: packages/cli/src/main.mjs:302
appbricx check
Normalize the contract file and print errors, fixes and warnings. No changes.
appbricx check [file]- Scope
- any
- Calls
POST /api/dev/v1/projects/:id/check- Exit code
- 0 when the report has no errors, else 1.
appbricx checkSource: packages/cli/src/main.mjs:314
appbricx apply
Build the dev environment from the contract file and print the report, the build summary (demo sign-ins per role) and warnings.
appbricx apply [file] [--force]Flags
| Flag | Type | Description |
|---|---|---|
--forceoptional | boolean | Overwrite compiled files you edited by hand (they are backed up first). |
- Scope
- apply
- Calls
POST /api/dev/v1/projects/:id/apply- Exit code
- 0 built; 1 the contract is invalid (422) or the project is busy.
appbricx applySource: packages/cli/src/main.mjs:320
appbricx patch
Apply typed edit ops from a JSON file (an array, or one op) to the current contract, then rebuild. Ops include add_entity, add_field and adopt_table (make a table you created with sql part of the contract).
appbricx patch <ops.json> [--dry-run]Flags
| Flag | Type | Description |
|---|---|---|
--dry-runoptional | boolean | Report what would change without building. |
- Scope
- apply
- Calls
POST /api/dev/v1/projects/:id/patch
echo '[{"op":"add_field","entity":"bookings","field":{"name":"party_size","type":"number"}}]' > ops.json
appbricx patch ops.json --dry-runSource: packages/cli/src/main.mjs:326
Runtime
appbricx verify
Run verify on dev and print the report.
appbricx verify- Scope
- any
- Calls
POST /api/dev/v1/projects/:id/verify- Exit code
- 0 when the report is pass, else 1.
appbricx verify || echo "fix the failing checks"Source: packages/cli/src/main.mjs:334
appbricx query
Rows from a dev table (equality filters, 200 max).
appbricx query <table> [--where col=value ...] [--limit n]Flags
| Flag | Type | Description |
|---|---|---|
--whereoptional | string | col=value; repeat for more (ANDed). |
--limitoptional | string | 1 to 200 (default 50). |
- Scope
- any
- Calls
POST /api/dev/v1/projects/:id/data/query
appbricx query bookings --where status=confirmed --where date=2026-10-12 --limit 10Source: packages/cli/src/main.mjs:340
appbricx logs
Recent workflow runs (status and error) and notifications.
appbricx logs [--workflow id] [--limit n]Flags
| Flag | Type | Description |
|---|---|---|
--workflowoptional | string | Only this workflow's runs. |
--limitoptional | string | 1 to 200 (default 30). |
- Scope
- any
- Calls
GET /api/dev/v1/projects/:id/logs${qs.size > 0 ? `?${qs}` : ""}
appbricx logs --workflow send-invoice --limit 5Source: packages/cli/src/main.mjs:350
appbricx deploy
Publish (runs verify first and refuses on red).
appbricx deploy [--subdomain <name>] [--skip-verify] [--preview]Flags
| Flag | Type | Description |
|---|---|---|
--skip-verifyoptional | boolean | Publish even when verify is red. |
--previewoptional | boolean | Deploy to the preview environment instead of production. |
--subdomainoptional | string | The published host name (one DNS label). |
- Scope
- deploy
- Calls
POST /api/dev/v1/projects/:id/deploy- Exit code
- 0 deployed; 1 verify red, subdomain taken or the pipeline failed.
appbricx deploy --subdomain tablefor✓ deployed: https://tablefor.apps.appbricx.com (live)Source: packages/cli/src/main.mjs:360
Operate the running app
appbricx sql
Run SQL like the builder's SQL editor: several statements in one transaction, past row-level security. Prod writes take a snapshot first.
appbricx sql "<sql>" | appbricx sql --file <f.sql> [--env dev|prod]Flags
| Flag | Type | Description |
|---|---|---|
--fileoptional | string | Read the SQL from a file. |
--envoptional | string | dev (default) or prod. |
- Scope
- read for reads; apply on dev, deploy on prod for writes
- Calls
POST /api/dev/v1/projects/:id/sql
appbricx sql "select status, count(*) from bookings group by 1"
appbricx sql --file migrations/add_index.sql --env prodSource: packages/cli/src/main.mjs:366
appbricx rows
Insert, update or delete rows through the app's rules, row-level security and change events.
appbricx rows <insert|update|delete> <table> [--data <json|@file>] [--id <id>] [--ids a,b] [--patch <json|@file>] [--as admin|<role>] [--env dev|prod]Flags
| Flag | Type | Description |
|---|---|---|
--dataoptional | string | insert: a row or an array of rows (inline JSON or @file.json). |
--patchoptional | string | update: the columns to set (JSON or @file). |
--idsoptional | string | update / delete: comma-separated row ids. |
--asoptional | string | admin (default, past row-level security) or a persona role id. |
--idoptional | string | update / delete: one row id. |
--envoptional | string | dev (default) or prod. |
- Scope
- apply on dev, deploy on prod
- Calls
POST /api/dev/v1/projects/:id/rows- Exit code
- 0 when every row succeeded, else 1.
appbricx rows insert bookings --data '{"date":"2026-10-13","party_size":4}' --as customer
appbricx rows update bookings --ids b_1,b_2 --patch '{"status":"cancelled"}'Source: packages/cli/src/main.mjs:375
appbricx schema
The real database schema: tables, keys, indexes, views, functions and triggers, and which tables the contract manages.
appbricx schema [--env dev|prod]Flags
| Flag | Type | Description |
|---|---|---|
--envoptional | string | dev (default) or prod. |
- Scope
- read
- Calls
GET /api/dev/v1/projects/:id/schema${qs({ env })}
appbricx schema --env prodSource: packages/cli/src/main.mjs:392
appbricx snapshots
List, take or restore database snapshots.
appbricx snapshots [list | create | restore <id>] [--env dev|prod]Flags
| Flag | Type | Description |
|---|---|---|
--envoptional | string | list: only this environment; create: which database (default prod). |
- Scope
- list: read; create: apply; restore: deploy
- Calls
GET /api/dev/v1/projects/:id/snapshots${qs({ env })}POST /api/dev/v1/projects/:id/snapshotsPOST /api/dev/v1/projects/:id/snapshots/:snapshotId/restore
appbricx snapshots --env prod
appbricx snapshots restore prod-2026-10-12T09-00-00Z-a1b2✓ restored prod from prod-2026-10-12T09-00-00Z-a1b2 (undo: appbricx snapshots restore prod-…)Source: packages/cli/src/main.mjs:398
appbricx deploys
Deploy history, or roll what's live back to an earlier deployment (files only).
appbricx deploys [list | rollback <deployment-id>] [--limit n] [--preview]Flags
| Flag | Type | Description |
|---|---|---|
--limitoptional | string | How many to list. |
--previewoptional | boolean | List preview deployments. |
- Scope
- list: read; rollback: deploy
- Calls
GET /api/dev/v1/projects/:id/deploysPOST /api/dev/v1/projects/:id/deploys/:deploymentId/rollback
appbricx deploys --limit 5
appbricx deploys rollback 5c1d…Source: packages/cli/src/main.mjs:419
appbricx run
Run a workflow now, read a run, list dead letters or replay them.
appbricx run workflow <id> [--input <json|@file>] [--as <role>] [--env dev|prod] | run get <run-id> | run dead-letters [--limit n] | run replay [job-id ...]Flags
| Flag | Type | Description |
|---|---|---|
--inputoptional | string | The workflow's input (JSON or @file). |
--asoptional | string | Act as an app user holding this role. |
--limitoptional | string | dead-letters: how many. |
--envoptional | string | dev (default) or prod. |
- Scope
- workflow: apply on dev, deploy on prod; get and dead-letters: read; replay: apply
- Calls
POST /api/dev/v1/projects/:id/workflows/:workflowId/runGET /api/dev/v1/projects/:id/runs/:runIdGET /api/dev/v1/projects/:id/dead-letters${qs({ limit })}POST /api/dev/v1/projects/:id/dead-letters/replay
appbricx run workflow send-invoice --input '{"order":"b_1"}'
appbricx run get 4f0a1c2d-…Source: packages/cli/src/main.mjs:435
appbricx tail
Recent change events and topic messages, runtime requests, or only errors.
appbricx tail <events|requests|errors> [--since 15m] [--limit n] [--env dev|prod]Flags
| Flag | Type | Description |
|---|---|---|
--sinceoptional | string | 15m, 2h, 1d or an ISO time. |
--limitoptional | string | 1 to 500. |
--envoptional | string | dev (default) or prod. |
- Scope
- read
- Calls
GET /api/dev/v1/projects/:id/tail
appbricx tail errors --env prod --since 2hSource: packages/cli/src/main.mjs:467
appbricx secrets
The app's secrets: names only, never values. set reads the value from stdin when you pass - (keeps it out of shell history).
appbricx secrets [list | set <name> <value|-> | delete <name>] [--env dev|prod|all]Flags
| Flag | Type | Description |
|---|---|---|
--envoptional | string | set: dev, prod or all (default all); delete: limit to one environment. |
- Scope
- list: read; set and delete: apply plus a workspace owner or admin token
- Calls
GET /api/dev/v1/projects/:id/secretsPUT /api/dev/v1/projects/:id/secrets/:nameDELETE /api/dev/v1/projects/:id/secrets/:name${qs({ env })}
printf %s "$SHIPPO_KEY" | appbricx secrets set SHIPPO_KEY -
appbricx secretsSource: packages/cli/src/main.mjs:475
Agents
appbricx mcp-config
Print the .mcp.json entry for Claude Code, Cursor or any MCP client, pinned to the linked project. On first connect the agent opens a browser window to authorize.
appbricx mcp-config [--token-header] [--project <id>]Flags
| Flag | Type | Description |
|---|---|---|
--projectoptional | string | Pin this project instead of the directory's link. |
--token-headeroptional | boolean | Add Authorization: Bearer ${APPBRICX_TOKEN} for CI (the file stays secret-free). |
- Scope
- None (no request is made).
appbricx mcp-config > .mcp.json{ "mcpServers": { "appbricx": { "type": "http", "url": "https://appbricx.com/api/mcp?project=3b7e…" } } }Source: packages/cli/src/main.mjs:231
appbricx docs
Print the contract guide (markdown). Pipe it to your agent.
appbricx docs- Scope
- any
appbricx docs > CONTRACT_GUIDE.mdSource: packages/cli/src/main.mjs:277