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.

9 commandsReference homeGuide: work from your terminal

On this page
  1. Set up
  2. Build an app
  3. pull
  4. push
  5. add
  6. migrate
  7. Run the platform (self-host)
  8. serve
  9. doctor
  10. owner
  11. backup
  12. version

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.

VariableWhat it does
APPBRICX_APIThe 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_TOKENA personal access token (apx_pat_…) with the scopes the command needs: read for pull, apply for push.
Shell
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/ --apply

Build 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.
Example
export APPBRICX_API=https://appbricx.com/api/dev/v1 APPBRICX_TOKEN=apx_pat_…
appbricx pull 3b7e9a52-6c1d-4f0e-9a8b-2c4d6e8f0a1b teamday/
Output
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

FlagTypeDescription
--checkoptionalbooleanAfter the push, check the draft and print the report (errors at file:line).
--applyoptionalbooleanAfter the push, apply the draft: dev is built from it.
--previewoptionalbooleanPush 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.
--deleteoptionalbooleanWith --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.
Example
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 --delete
Output
pushed 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

FlagTypeDescription
--diroptionalstringThe 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.
Example
appbricx add recharts date-fns@^4 --dir teamday
appbricx push "$PROJECT" teamday/ --check
Output
The 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

FlagTypeDescription
--tooptionalstringWhat to convert to: code (the only value).
--forceoptionalbooleanWrite 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.
Example
appbricx migrate --to code studio.json studio-code/
appbricx push "$NEW_PROJECT" studio-code/ --check
Output
wrote 34 files to studio-code/

To finish by hand (2):
  - …

Next: appbricx push <project> studio-code/ --check

Source: 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)
Example
APPBRICX_PLATFORM_DB=postgres://… APPBRICX_TENANT_ADMIN_DB=postgres://… appbricx serve

Source: 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

FlagTypeDescription
--jsonoptionalbooleanOne JSON object per check: name, level, detail, fix.
Scope
operator
Exit code
0 when nothing is red, 1 otherwise.
Example
docker exec appbricx-go-app appbricx doctor

Source: 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

FlagTypeDescription
--emailoptionalstringThe owner's email.
--nameoptionalstringTheir name.
--password-stdinoptionalbooleanRead the password from the first line of stdin (no terminal).
Scope
operator
Example
docker exec -it appbricx-go-app appbricx owner --email you@example.com --name "Your Name"
Output
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

FlagTypeDescription
--jsonoptionalbooleanstatus, list, show: print JSON.
--devoptionalbooleanrun: include the dev databases.
--idoptionalstringrestore: the backup's id, or latest.
--platformoptionalstringrestore: the platform database.
--projectoptionalstringrestore: one project's database.
--envoptionalstringrestore: with --project, prod (default) or dev.
--intooptionalstringrestore: the database to restore into.
--drilloptionalbooleanrestore: restore into a scratch database, check it and drop it.
--replaceoptionalbooleanrestore: replace the live database (needs --confirm).
--confirmoptionalstringrestore: the database's name, repeated.
Scope
operator
Example
appbricx backup status
appbricx backup restore --id latest --project 3b7e9a52-… --drill

Source: cmd/appbricx/backup.go:40

appbricx version

Prints the build's version.

appbricx version
Scope
none
Example
appbricx version

Source: cmd/appbricx/main.go:82