Skip to main content
bunny db provides full lifecycle management for Bunny Database: creating databases, linking them to local projects, running SQL interactively, generating auth tokens, and viewing tables in a browser.

Database resolution

Most db commands accept an optional <database-id> positional argument. When omitted, the CLI resolves the target in this order:
  1. Explicit <database-id> argument
  2. .bunny/database.json manifest written by bunny db link
  3. BUNNY_DATABASE_URL in a .env file (walked up from the current directory) matched against your database list
  4. Interactive selection prompt
For bunny db shell, the CLI also reads BUNNY_DATABASE_AUTH_TOKEN from .env to skip token generation. Both variables can be written automatically by bunny db create or bunny db quickstart.

bunny db create

Create a new database. Interactively prompts for name and region selection (automatic, single region, or manual) when flags are omitted. After creation, prompts to link the directory, generate an auth token, and save credentials to .env.
In --output json mode, prompts are suppressed entirely. Flags are the only way to opt in to linking, token creation, and .env writes. The JSON output gains linked, token, and saved_to_env fields reflecting what happened.

bunny db list

List all databases. Shows ID, name, status, primary region, and size.

bunny db show

Show details for a single database.
Link the current directory to a database. Writes { id, name } to .bunny/database.json so subsequent db commands resolve the target without BUNNY_DATABASE_URL in .env. With no argument, lists all databases for interactive selection.
bunny db create offers to link the new database, and bunny db delete automatically removes a stale link when it points at the deleted database.

bunny db delete

Permanently delete a database. Requires double confirmation (or --force to skip).

bunny db regions

Manage primary and replica regions for a database.

bunny db regions list

bunny db regions add

bunny db regions remove

bunny db regions update

Interactively update region configuration. Shows all available regions with current ones pre-selected. Toggle on/off and confirm.

bunny db usage

Show usage statistics for a database.

bunny db quickstart

Generate a quickstart guide for connecting to a database from your preferred language.

bunny db shell

Open an interactive SQL shell for a database. Supports multiple output modes, sensitive column masking, persistent history, and dot-commands for quick introspection.
When no --token is supplied and BUNNY_DATABASE_AUTH_TOKEN is not set, the shell session is active for 30 minutes. Re-run the command to reconnect, or pass --token / set BUNNY_DATABASE_AUTH_TOKEN to use your own credentials.

Dot-commands

Available in interactive mode:

Sensitive column masking

Columns matching patterns like password, secret, api_key, auth_token, ssn, etc. are masked by default (********). Email columns are partially masked (a••••e@example.com). Use .unmask or the --unmask flag to reveal values.

bunny db studio

Open a read-only table viewer in your browser. Spins up a local server, generates a short-lived auth token if needed, and opens the studio UI.

bunny db tokens

Generate and invalidate database auth tokens.

bunny db tokens create

Generate an auth token for a database. The database ID can be provided as a positional argument or auto-detected from BUNNY_DATABASE_URL in a .env file.

bunny db tokens invalidate

Invalidate all auth tokens for a database. Prompts for confirmation unless --force is passed.