@backwrite/cli
v0.1.1
Published
Official Backwrite developer CLI — authenticate, manage Copy-on-Write branches, execute SQL, and generate ORM schemas for Prisma and Drizzle
Maintainers
Readme
@backwrite/cli
The official developer CLI for Backwrite — the programmable distributed backend platform.
Installation
Install globally using npm:
npm install -g @backwrite/cliOr run directly without installation via npx:
npx @backwrite/cli --helpBoth backwrite and bw commands will be available globally in your PATH.
Quickstart
1. Authenticate with Your Browser
backwrite loginSpawns a local loopback callback and opens https://console.backwrite.dev/auth/cli-login. Once authorized, credentials are saved securely to ~/.config/backwrite/credentials.json.
2. Verify Session
backwrite whoami3. List Copy-on-Write Branches
backwrite branch list4. Execute Transactional SQL
backwrite sql "SELECT id, name, status FROM users LIMIT 10;"5. Generate ORM Models (Prisma & TypeScript)
backwrite gen types
backwrite gen prisma6. Interactive Terminal Cockpit (TUI)
backwrite tuiCommand Reference
| Command | Description |
|---|---|
| backwrite login | Authenticate your terminal via browser loopback |
| backwrite logout | Clear saved machine credentials |
| backwrite whoami | Show current authenticated account and project |
| backwrite branch list | Enumerate all Copy-on-Write database branches |
| backwrite sql "<query>" | Execute arbitrary SQL with latency timing and table formatting |
| backwrite gen types | Generate TypeScript interfaces from database tables |
| backwrite gen prisma | Generate Prisma schema models from database tables |
| backwrite tui | Launch the interactive terminal user interface cockpit |
Configuration Flags
All commands support overriding defaults via command-line flags or environment variables:
| Flag | Env Variable | Default | Description |
|---|---|---|---|
| --project <id> | BACKWRITE_PROJECT_ID | Active bound project | Target Project ID |
| --branch <id> | BACKWRITE_BRANCH_ID | Active bound branch | Target Branch ID |
| --url <url> | BACKWRITE_URL | https://api.backwrite.dev | Control plane endpoint |
| --key <key> | BACKWRITE_SERVICE_KEY | Saved login token | API key / Service key |
License
Apache-2.0 © Backwrite
