CLI
appbricx is the platform's single binary. For app developers it moves a project's files between your editor and the dev draft (pull, push), adds npm packages and converts a JSON app; for operators it runs and checks a self-hosted platform. Checking, applying, verifying and deploying are MCP tools and developer-API routes: push --check and push --apply cover the first two.
On this page
Set up
pull and push call the developer API with a personal access token (Workspace settings, Coding agents). Exit code 0 is success, 1 means the server or a tool said no, 2 is a usage error.
| Variable | What it does |
|---|---|
APPBRICX_API | The developer API base: https://appbricx.com/api/dev/v1 on Appbricx Cloud, https://<your platform host>/dev/v1 self-hosted (default http://localhost:8080/api/dev, a local platform). |
APPBRICX_TOKEN | A personal access token (apx_pat_…) with the scopes the command needs: read for pull, apply for push. |
export APPBRICX_API=https://appbricx.com/api/dev/v1
export APPBRICX_TOKEN=apx_pat_…
appbricx pull "$PROJECT" teamday/
$EDITOR teamday/routes/bookings.tsx
appbricx push "$PROJECT" teamday/ --check
appbricx push "$PROJECT" teamday/ --applyBuild an app
appbricx pull
Writes the project's dev draft (the files agents and people edit, before apply) into a directory. Files the directory has and the draft doesn't are left alone, so pull into a clean checkout.
appbricx pull <project> <dir>- Scope
- read
- Calls
GET /api/dev/v1/projects/:id/files- Exit code
- 0 on success, 1 when the server refuses (unknown project, missing scope), 2 on a usage error.
export APPBRICX_API=https://appbricx.com/api/dev/v1 APPBRICX_TOKEN=apx_pat_…
appbricx pull 3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b teamday/pulled 27 files (draft rev 14) to teamday/Source: cmd/appbricx/files.go:120
appbricx push
Makes the dev draft equal to the directory: deletes draft files the directory doesn't have, writes every file it has (dot-files, dot-directories and node_modules are skipped), then optionally checks or applies the draft. It overwrites with no merge: pull first if someone else may have changed the draft. With --preview it sends what git sees as a preview environment of its own (named after the branch) and leaves the dev draft alone.
appbricx push <project> <dir> [--check | --apply]
appbricx push <project> <dir> --preview[=<name>] [--delete]Flags
| Flag | Type | Description |
|---|---|---|
--checkoptional | boolean | After the push, check the draft and print the report (errors at file:line). |
--applyoptional | boolean | After the push, apply the draft: dev is built from it. |
--previewoptional | boolean | Push as a preview (its own database cloned from dev, its own address preview-<name>--<app>), named after the git branch or the name given. Not with --check or --apply. |
--deleteoptional | boolean | With --preview: remove the preview (when the branch is merged). |
- Scope
- apply
- Calls
GET /api/dev/v1/projects/:id/filesDELETE /api/dev/v1/projects/:id/files/*POST /api/dev/v1/projects/:id/filesPOST /api/dev/v1/projects/:id/files/checkPOST /api/dev/v1/projects/:id/files/applyPOST /api/dev/v1/projects/:id/previewsDELETE /api/dev/v1/projects/:id/previews/:name- Exit code
- 0 on success, 1 when the server refuses (a stale draft, a binary file, a failed check request), 2 on a usage error. A report with errors is printed, not an exit code: read report.ok.
appbricx push "$PROJECT" teamday/ --check
appbricx push "$PROJECT" teamday/ --apply
# per branch, from a git checkout (a pre-push hook or a CI job)
appbricx push "$PROJECT" . --preview
appbricx push "$PROJECT" . --preview --deletepushed 27 files, deleted 1 (draft rev 15, dirty true)
{
"report": { "ok": true, "errors": [], "warnings": [] },
…
}Source: cmd/appbricx/files.go:150
appbricx add
Adds npm packages to a code-first project. npm writes package.json and package-lock.json only (no node_modules, no install scripts), choosing versions at least 7 days old, and the lockfile is read the way the build will read it. React and the @appbricx packages come with the platform and are refused, as are git, file and URL sources. Needs npm on your machine; push the two files afterwards.
appbricx add <package>[@range] … [--dir <project>]Flags
| Flag | Type | Description |
|---|---|---|
--diroptional | string | The project directory, where app.config.ts is (default the current directory). |
- Scope
- none (local)
- Exit code
- 0 on success, 1 when npm fails or the lockfile isn't one the platform installs, 2 on a usage error.
appbricx add recharts date-fns@^4 --dir teamday
appbricx push "$PROJECT" teamday/ --checkThe project's packages (38 installed in all, none younger than 168h0m0s):
date-fns 4.1.0
recharts 3.1.2
Next: push the project (package.json and package-lock.json go with it); the build installs from the lockfile.Source: cmd/appbricx/add.go:35
appbricx migrate
Converts a JSON-contract app (a contract.json or a JSON project directory) into a new code-first project directory: app.config.ts, one db/schema and db/access file per table, queries, seeds, workflows, actions and routes. What doesn't carry over is printed and written to MIGRATION.md. Then push it to a new project.
appbricx migrate --to code <contract.json | project dir> <new project dir> [--force]Flags
| Flag | Type | Description |
|---|---|---|
--tooptional | string | What to convert to: code (the only value). |
--forceoptional | boolean | Write into a directory that isn't empty. |
- Scope
- none (local)
- Exit code
- 0 on success, 1 when the source doesn't read or assemble, 2 on a usage error.
appbricx migrate --to code studio.json studio-code/
appbricx push "$NEW_PROJECT" studio-code/ --checkwrote 34 files to studio-code/
To finish by hand (2):
- …
Next: appbricx push <project> studio-code/ --checkSource: cmd/appbricx/migrate_code.go:20
Run the platform (self-host)
appbricx serve
Runs the platform: every service in one process by default, or the ones APPBRICX_ROLES names. This is the self-hosted install's entry point (the Docker image runs it).
appbricx serve- Scope
- operator (APPBRICX_PLATFORM_DB, JWT_SECRET, INTERNAL_SECRET and the rest of the platform's settings)
APPBRICX_PLATFORM_DB=postgres://… APPBRICX_TENANT_ADMIN_DB=postgres://… appbricx serveSource: cmd/appbricx/main.go:70
appbricx doctor
Checks the platform's configuration, databases, NATS, tools (Chromium, pg_dump, Node, Bun), the sandbox's network isolation and disk, and exits 1 when something is red. --json prints each check.
appbricx doctor [--json]Flags
| Flag | Type | Description |
|---|---|---|
--jsonoptional | boolean | One JSON object per check: name, level, detail, fix. |
- Scope
- operator
- Exit code
- 0 when nothing is red, 1 otherwise.
docker exec appbricx-go-app appbricx doctorSource: cmd/appbricx/main.go:84
appbricx owner
Creates or updates the platform owner's account (password, verified email, platform admin, an owned workspace), safely beside a running server. Asks for the password twice without echo, or reads it from stdin.
appbricx owner --email <email> [--name <name>] [--password-stdin]Flags
| Flag | Type | Description |
|---|---|---|
--emailoptional | string | The owner's email. |
--nameoptional | string | Their name. |
--password-stdinoptional | boolean | Read the password from the first line of stdin (no terminal). |
- Scope
- operator
docker exec -it appbricx-go-app appbricx owner --email you@example.com --name "Your Name"owner you@example.com ready (platform admin, workspace Your Name's workspace)Source: cmd/appbricx/owner.go:27
appbricx backup
Offsite backups of the platform and every project's databases: status, list, show, run now, prune, and restore (into a scratch database for a drill, or replacing one with --replace --confirm).
appbricx backup status|list|show|run|prune|restore …Flags
| Flag | Type | Description |
|---|---|---|
--jsonoptional | boolean | status, list, show: print JSON. |
--devoptional | boolean | run: include the dev databases. |
--idoptional | string | restore: the backup's id, or latest. |
--platformoptional | string | restore: the platform database. |
--projectoptional | string | restore: one project's database. |
--envoptional | string | restore: with --project, prod (default) or dev. |
--intooptional | string | restore: the database to restore into. |
--drilloptional | boolean | restore: restore into a scratch database, check it and drop it. |
--replaceoptional | boolean | restore: replace the live database (needs --confirm). |
--confirmoptional | string | restore: the database's name, repeated. |
- Scope
- operator
appbricx backup status
appbricx backup restore --id latest --project 3b7e9a52-… --drillSource: cmd/appbricx/backup.go:40
appbricx version
Prints the build's version.
appbricx version- Scope
- none
appbricx versionSource: cmd/appbricx/main.go:82