CLI Reference
Complete reference for the Postbase command-line interface.
Installation
npm install -g postbaseGlobal Options
postbase [command] [options]
Options:
-V, --version Output version number
-h, --help Display help for command
--json Output in JSON format (where supported)
--quiet Suppress non-essential outputCommands Overview
Local Development
| Command | Description |
|---|---|
postbase start | Start the Postbase daemon |
postbase stop | Stop the daemon |
postbase status | Show daemon status |
postbase db | Database management |
postbase migrate | Migration operations |
postbase connect | Get connection details |
postbase types | Generate TypeScript types |
Cloud Platform
| Command | Description |
|---|---|
postbase cloud login | Authenticate with GitHub |
postbase cloud logout | Clear credentials |
postbase cloud projects | Manage projects |
postbase cloud provision | Create cloud database |
postbase cloud url | Get connection string |
postbase cloud destroy | Delete cloud database |
postbase cloud backups | Backup operations |
postbase cloud pitr | Point-in-Time Recovery |
Command Reference
postbase start
Start the Postbase daemon and PostgreSQL container.
postbase start [options]
Options:
--port <port> Daemon API port (default: 9432)
--pg-port <port> PostgreSQL port (default: 5432)
--data-dir <dir> Data directory (default: ~/.postbase)# Start with defaults
postbase start
# Custom ports
postbase start --port 9000 --pg-port 5433postbase stop
Stop the Postbase daemon.
postbase stop [options]
Options:
--force Force stop without confirmation
--keep-container Keep PostgreSQL container runningpostbase status
Show daemon and database status.
postbase status [options]
Options:
--json Output in JSON formatPostbase Status
Daemon: Running (PID: 12345)
API: http://localhost:9432
PostgreSQL: Running (Port: 5432)
Databases: 3
Databases:
- myapp (12.5 MB)
- demo (3.2 MB)
- test (1.1 MB)postbase db
Database management commands.
postbase db <command>
Commands:
list List all databases
create <name> Create a new database
drop <name> Delete a database
info <name> Show database details# List databases
postbase db list
# Create database
postbase db create myapp
# Create from template
postbase db create myapp_test --template myapp
# Get database info
postbase db info myapp
# Delete database
postbase db drop myapp
postbase db drop myapp --forcepostbase migrate
Migration management commands.
postbase migrate <command>
Commands:
new <name> Create new migration files
up Apply pending migrations
down Rollback migrations
status Show migration status# Common options
--database <name> Target database (default: from config)
--schema <name> Target schema (default: public)
--dir <path> Migrations directory (default: ./migrations)# Create migration
postbase migrate new create_users
# Apply all pending
postbase migrate up
# Apply to specific database
postbase migrate up --database myapp
# Apply to specific schema
postbase migrate up --schema auth
# Dry run
postbase migrate up --dry-run
# Rollback last migration
postbase migrate down
# Rollback multiple
postbase migrate down --count 3
# Check status
postbase migrate statuspostbase connect
Get database connection details.
postbase connect <database> [options]
Options:
--copy Copy connection string to clipboard
--json Output in JSON formatpostbase connect myappDatabase: myapp
Connection Details:
Host: localhost
Port: 5432
Database: myapp
User: postgres
Password: postgres
Connection String:
postgresql://postgres:postgres@localhost:5432/myapppostbase types
Generate TypeScript types from database schema.
postbase types generate [options]
Options:
--database <name> Database name
--output <path> Output file path
--all Include functions, views, enums
--include-functions Include PostgreSQL functions
--include-views Include views
--include-enums Include enum types
--schema <name> Target schema (default: public)
--dates-as-strings Map timestamps to stringpostbase types generate \
--database myapp \
--all \
--output ./src/db/types.tspostbase cloud login
Authenticate with GitHub OAuth.
postbase cloud loginOpens browser for GitHub authentication using device flow.
postbase cloud projects
Manage cloud projects.
postbase cloud projects <command>
Commands:
list List all projects
create <name> Create a new project
delete <id> Delete a project# List projects
postbase cloud projects list
# Create project
postbase cloud projects create myapp
# Delete project
postbase cloud projects delete proj_xxx --forcepostbase cloud provision
Create a cloud PostgreSQL database.
postbase cloud provision <name> [options]
Options:
-p, --project <id> Project ID
--region <region> Deployment region
--cpu <vCPUs> CPU cores (1, 2, 4, 8)
--memory <MB> Memory in MB (1024, 2048, 4096, 8192)
--storage <GB> Storage in GB (10, 25, 50, 100)# Basic provisioning
postbase cloud provision production -p myapp
# With configuration
postbase cloud provision production \
-p myapp \
--region us-west1 \
--cpu 2 \
--memory 4096 \
--storage 50postbase cloud url
Get cloud database connection string.
postbase cloud url <database> [options]
Options:
-p, --project <id> Project ID
--copy Copy to clipboardpostbase cloud backups
Backup management commands.
postbase cloud backups <command>
Commands:
list List backups
create Create manual backup
download <id> Download backup file
restore <id> Restore from backup
delete <id> Delete manual backup-p, --project <id> Project ID
-d, --database <name> Database name# List backups
postbase cloud backups list -p myapp -d production
# Create backup
postbase cloud backups create -p myapp -d production
# Download backup
postbase cloud backups download bkp_xxx \
-p myapp -d production \
-o backup.sql
# Restore from backup
postbase cloud backups restore bkp_xxx \
-p myapp -d production
# Delete backup
postbase cloud backups delete bkp_xxx \
-p myapp -d production --forcepostbase cloud pitr
Point-in-Time Recovery commands.
postbase cloud pitr <command>
Commands:
status Show PITR status
enable Enable PITR
disable Disable PITR
wal List WAL archives
restore Restore to point in time
restores List restore operations
receiver Show WAL receiver status
restart-receiver Restart WAL receiver
service-status Show backup service status-p, --project <id> Project ID
-d, --database <name> Database name# Check status
postbase cloud pitr status -p myapp -d production
# Enable PITR
postbase cloud pitr enable -p myapp -d production
# List WAL archives
postbase cloud pitr wal -p myapp -d production
# Restore to specific time
postbase cloud pitr restore \
-p myapp -d production \
--target-time "2026-01-25T14:30:00Z" \
--force
# Restore to latest
postbase cloud pitr restore \
-p myapp -d production \
--target-time latest \
--force
# Check restore status
postbase cloud pitr restores -p myapp -d production
# Check WAL receiver health
postbase cloud pitr receiver -p myapp -d production
# Restart WAL receiver
postbase cloud pitr restart-receiver -p myapp -d productionEnvironment Variables
| Variable | Description | Default |
|---|---|---|
POSTBASE_API_URL | Cloud API URL | https://api.postbase.sh |
POSTBASE_DAEMON_URL | Local daemon URL | http://localhost:9432 |
POSTBASE_DATA_DIR | Data directory | ~/.postbase |
DATABASE_URL | Default connection string | - |
Configuration File
postbase.toml:
[project]
name = "myapp"
[database]
name = "myapp"
[migrations]
directory = "./migrations"
schema = "public"
[daemon]
port = 9432
[postgresql]
port = 5432