CLI reference

Install @primdb/cli, authenticate, and drive projects, deploys, data, env, logs, and notes from the terminal.

The primdb CLI is the primary developer interface for managing projects, deployments, environment variables, logs, data services, and feedback notes. It is a single Bun-compiled binary with no runtime dependency on the target machine.

Install

npm install -g @primdb/cli
# or
bun install -g @primdb/cli

Config and credentials live under ~/.primdb/ (token encrypted at rest with a machine-specific key, files chmod 600, never cloud-synced).

Auth

primdb login                 # interactive browser login
primdb login --token primdb_...  # non-interactive (CI/CD)
primdb logout                # delete stored credentials
primdb whoami                # print the authenticated user

Projects

Each command resolves the active project in order: the --project flag, then .primdb.json in the current directory, then defaultProject in ~/.primdb/config.json.

primdb init                  # create a new project + write .primdb.json
primdb link                  # link an existing project (picker)
primdb link --project <id|slug>  # link non-interactively

Command groups

GroupWhat it does
deploy / deployments / promote / rollbackTrigger builds, list deployments, approve previews, roll back. See Deploy.
devOpen a public tunnel to a local port with the feedback overlay injected. See Preview feedback.
envSet, list, remove, pull, and push environment variables.
logsStream production or per-deployment logs (SSE), or print the last N lines.
db / redis / storageWork with Postgres, Redis, and object storage. See Data.
notesList, resolve, and export feedback notes. See Preview feedback.
domainsAdd, verify, and remove custom domains (TLS via Let’s Encrypt once DNS verifies).
usersManage the end-users of your deployed app. See Auth.

Environment variables

primdb env set KEY=VALUE            # set a variable
primdb env set KEY=VALUE --secret   # mark as secret (masked in dashboard + logs)
primdb env list                     # list all vars (values masked)
primdb env list --reveal            # list with values visible
primdb env rm KEY                   # delete a variable
primdb env pull                     # download all vars to .env.local
primdb env push                     # upload vars from .env.local

Global flags

FlagShortDescription
--project <id|slug>-pOverride the project (default: from .primdb.json)
--token <token>Override the auth token (default: from ~/.primdb/credentials.json)
--jsonOutput raw JSON instead of formatted text (for scripting/CI)
--no-colorDisable ANSI color codes
--debugVerbose logging (requests, responses, timing)

Exit codes

CodeMeaning
0Success
1General error (build failed, resource not found, etc.)
2Auth error (not logged in, token expired or revoked)
3Network error (relay unreachable, timeout)
4Validation error (bad arguments, missing required flags)

CI/CD

Authenticate non-interactively with a repository secret, then deploy and wait. Exit code reflects the build outcome.

- name: Deploy to PrimDB
  env:
    PRIMDB_TOKEN: ${{ secrets.PRIMDB_TOKEN }}
  run: |
    primdb login --token $PRIMDB_TOKEN
    primdb deploy --wait

View as Markdown