Skip to content

CLI

The @butterbase/cli provides a command-line interface for managing your Butterbase apps, schemas, functions, storage, and deployments.

Terminal window
npm install -g @butterbase/cli
Terminal window
# Login with your API key
butterbase login
# Create a new app
butterbase apps create my-app
# Set as current app
butterbase apps use app_abc123
# Get current schema
butterbase schema get --output schema.json
# Apply schema changes
butterbase schema apply schema.json
# Deploy a function
butterbase functions deploy ./functions/hello.ts
# Upload a file
butterbase storage upload ./image.png
Terminal window
butterbase login
butterbase logout
Terminal window
# Show current config
butterbase config get
# Set endpoint
butterbase config set endpoint https://api.butterbase.ai
# Set API key
butterbase config set apiKey bb_sk_...

Configuration is stored in ~/.butterbase/config.json. Project-level config in .butterbase/config.json takes precedence.

Terminal window
butterbase apps list
butterbase apps create my-app
butterbase apps use app_abc123
butterbase apps delete app_abc123
Terminal window
# Get current schema
butterbase schema get
# Save to file
butterbase schema get --output schema.json
# Preview changes (dry-run)
butterbase schema apply schema.json --dry-run
# Apply changes
butterbase schema apply schema.json
# Apply with custom migration name
butterbase schema apply schema.json --name "add_users_table"
# Use specific app
butterbase schema get --app app_abc123
Terminal window
# List deployed functions
butterbase functions list
# Deploy function
butterbase functions deploy ./functions/hello.ts
# Deploy with custom name
butterbase functions deploy ./functions/hello.ts --name my-function
# Deploy cron function
butterbase functions deploy ./functions/cleanup.ts --trigger cron
# View logs
butterbase functions logs my-function
# Error logs only
butterbase functions logs my-function --level error
# Limit log count
butterbase functions logs my-function --limit 50
Terminal window
butterbase storage list
butterbase storage upload ./image.png
butterbase storage delete obj_abc123
Terminal window
butterbase data list # List tables
butterbase data query posts # Query rows from a table
Terminal window
butterbase deploy ./dist # Deploy frontend from a directory

Most commands support --app to target a specific app:

Terminal window
butterbase schema get --app app_abc123
butterbase functions list --app app_abc123
butterbase storage list --app app_abc123

If --app is not provided, the CLI uses the current app set with butterbase apps use.

VariableDescription
BUTTERBASE_API_KEYAPI key
BUTTERBASE_ENDPOINTAPI endpoint URL