cli
@briven/cli— install as a dev dependency, or run one-off via each PM's remote-exec shim.
install
$ npm install -D @briven/cli
…or skip the install and invoke directly:
$ npx briven
setup · new project
Create a new cloud project only: browser sign-in, scaffold folder, mint CLI + S3 keys. To attach an existing project use briven connect (section below). Full walkthrough on the connect page. Bare briven with no linked project also starts setup.
$ npx briven setup $ npx briven setup --name my-app $ npx briven setup my-app $ npx briven setup --name my-app --template todo-app --region eu-west
init
Scaffold local files only (briven.json, schema, example function) — no cloud. Prefer briven setup when you want the full connect + project flow.
$ npx briven init
Pass --name to override the directory name. Pass --force to overwrite an existing briven.json.
connect
Sign this machine into the platform only (browser OAuth) without scaffolding. Usually you want briven setup instead.
$ npx briven connect $ npx briven connect p_xxx $ npx briven connect --project p_xxx $ npx briven connect status $ npx briven connect logout $ npx briven connect --force
Stores a user session in ~/.config/briven/credentials.json. connect logout clears only that session; project brk_… keys stay until briven logout.
login (manual key)
Store a dashboard-issued API key for a project — the manual alternative to briven projects use after connect.
$ npx briven login --project p_xxx --key brk_xxx
Credentials land at ~/.config/briven/credentials.json with mode 0600. Get a key from the dashboard under api keys.
whoami
Verify the stored key is still valid and which project it belongs to.
$ npx briven whoami
link
Associate the current directory with an existing briven project — writes the project id into briven.json so subsequent commands don't need --project.
$ npx briven link --project p_xxx
deploy
Loads briven/schema.ts, compares it to the currently deployed schema, and creates a new deployment. Destructive changes (drop table, drop column) are refused unless --confirm-destructive is passed.
$ npx briven deploy $ npx briven deploy --dry-run $ npx briven deploy --confirm-destructive
invoke
Call a deployed function and print the response. Reads the project id from briven.json; pass --body for an inline JSON body or --body-file path to read from disk. --raw prints just the unwrapped function value, jq-pipeable.
$ npx briven invoke poolStats
$ npx briven invoke createNote --body '{"body":"hello"}'
$ npx briven invoke getNotes --rawenv
Manage per-project environment variables. Values are encrypted at rest with the platform key and only decrypted into the function runtime at cold start; env list surfaces metadata only.
$ npx briven env list $ npx briven env put STRIPE_KEY sk_... $ npx briven env rm STRIPE_KEY
db
Open a psql shell against the project's data-plane schema. Issues a short-lived dsn via the api — the cli never sees the long-lived superuser credentials. Admin-tier; rate limited.
$ npx briven db shell
dev
Watch briven/schema.ts + briven/functions/* and push on change. Drives the inner-loop dev experience — same effect as running briven deploy after every save.
$ npx briven dev
logs
Stream function-invocation logs for the linked project. Shows the structured envelope per invocation: requestId, functionName, durationMs, status, and any logs the function wrote via ctx.log.
$ npx briven logs $ npx briven logs --follow
logout
$ npx briven logout $ npx briven logout --project p_xxx
projects
Full project lifecycle from the shell. Local commands read ~/.config/briven/credentials.json; remote / create / use need briven connect first.
$ npx briven projects list $ npx briven projects list --remote $ npx briven projects create --name my-app $ npx briven projects use p_xxx $ npx briven projects use p_xxx --link $ npx briven projects unlink p_xxx $ npx briven projects set-default p_xxx
list— keys on this machine;list --remote— account projectscreate --name …— create on the platform, mint a CLI key, set defaultuse <id>— mint/store key for an existing project;--linkwritesprojectIdintobriven.jsonunlink— drop the local key only;set-default— pick which project other commands fall back to
export / import
Move a project's schema + functions (and optionally its data) between projects or to disk. --with-data shells out to pg_dump --format=custom --compress=6 against a short-lived dsn; --restore-data on the import side looks for the sibling data dump and pipes it into pg_restore. No new cli deps, but assumes pg_dump + pg_restore on your PATH.
$ npx briven export $ npx briven export --out backup.json $ npx briven export --with-data
$ npx briven import backup.json $ npx briven import backup.json --restore-data
doctor
End-to-end health check against the linked api. Prints pass/fail for: api reachable, session valid, project reachable, runtime ready, an example function invoke (if any). Useful first-line triage when something feels off.
$ npx briven doctor $ npx briven doctor --origin https://api.example.com
environment
BRIVEN_API_ORIGIN— override the control-plane origin for a self-hosted deployment. Default:https://api.briven.tech.BRIVEN_DASHBOARD_ORIGIN— where browser OAuth opens (briven connect). Default:https://app.briven.tech.XDG_CONFIG_HOME— where credentials are stored, following the XDG spec.