Skip to content
BunBase BunBase BunBase Docs Alpha v0.1.0

CLI

Terminal window
# npm
npm install -g @bunbase/cli
# bun
bun install -g @bunbase/cli
# one-shot (no install)
bunx @bunbase/cli <command>

Verify:

Terminal window
bunbase --version

CommandDescription
bunbase initScaffold a new BunBase project
bunbase backupDownload a database backup
bunbase restore <file>Upload and restore a backup
bunbase deployDeploy to a VPS via rsync + SSH
bunbase updateUpdate the CLI to the latest version

Run bunbase <command> --help for per-command options.


Scaffold a new self-hosted BunBase deployment in the target directory.

Terminal window
bunbase init
bunbase init --dir ./myapp --name myapp --port 3000

Creates:

FilePurpose
.envServer environment variables with generated secrets
docker-compose.ymlRun BunBase as a Docker service
bunbase.config.tsCLI config (URL, admin key, deploy settings)
data/Persistent data directory (mounted by Docker)

Options:

FlagDefaultDescription
--dir <path>Current directoryTarget directory
--name <name>Directory nameProject name
--port <port>3000Server port

Existing files are never overwritten — re-running init is safe.


Download a full database backup from your running server.

Terminal window
bunbase backup
bunbase backup --url https://api.example.com --key <admin-key> --out my-backup.db

Options:

FlagDefaultDescription
--url <url>Config / http://localhost:3000Server URL
--key <key>Config / BUNBASE_ADMIN_KEY envAdmin key
--out <file>bunbase-backup-<timestamp>.dbOutput filename

Upload a backup file and restore the database. The server restarts automatically.

Terminal window
bunbase restore bunbase-backup-1234567890.db
bunbase restore bunbase-backup-1234567890.db --yes # skip confirmation

Options:

FlagDefaultDescription
--url <url>Config / http://localhost:3000Server URL
--key <key>Config / BUNBASE_ADMIN_KEY envAdmin key
--yesfalseSkip confirmation prompt

Destructive. This replaces the live database. You will be asked to confirm unless --yes is passed.


Sync your project to a remote VPS via rsync, then SSH in to run the restart command.

Terminal window
bunbase deploy
bunbase deploy --host user@vps.example.com --path /opt/bunbase
bunbase deploy --dry-run # print commands without executing

Options:

FlagDefaultDescription
--host <user@host>Config deploy.hostSSH target
--path <path>Config deploy.path / /opt/bunbaseRemote path
--restart <cmd>Config deploy.restart / pm2 restart bunbasePost-sync command
--dry-runfalsePrint commands only

Automatically excluded from rsync: .git, node_modules, data/, *.db, *.db-shm, *.db-wal, dist/, .env

.env is never synced — manage secrets on the server separately.


Update the CLI to the latest version published on npm.

Terminal window
bunbase update

Detects which package manager installed the CLI (Bun, npm, or pnpm) and runs the appropriate global install command.


Place a bunbase.config.ts (or .json) in your project root to avoid repeating flags:

import type { BunBaseConfig } from '@bunbase/cli';
const config: BunBaseConfig = {
url: 'https://api.example.com',
adminKey: process.env.BUNBASE_ADMIN_KEY,
deploy: {
host: 'user@vps.example.com',
path: '/opt/bunbase',
restart: 'cd /opt/bunbase && docker compose pull && docker compose up -d',
},
};
export default config;

Resolution order: bunbase.config.tsbunbase.config.jsbunbase.config.mjsbunbase.config.json

Field priority: CLI flag → config file → built-in default


After every command, the CLI silently checks npm for a newer version (at most once per 24 hours). If one is available, a notice is printed:

Update available! 0.14.0 → 0.14.1
Run bunbase update to upgrade.

The check result is cached in ~/.bunbase/update-check.json and never blocks command execution.