CLI
The @butterbase/cli provides a command-line interface for managing your Butterbase apps, schemas, functions, storage, and deployments.
Installation
Section titled “Installation”npm install -g @butterbase/cliQuick start
Section titled “Quick start”# Login with your API keybutterbase login
# Create a new appbutterbase apps create my-app
# Set as current appbutterbase apps use app_abc123
# Get current schemabutterbase schema get --output schema.json
# Apply schema changesbutterbase schema apply schema.json
# Deploy a functionbutterbase functions deploy ./functions/hello.ts
# Upload a filebutterbase storage upload ./image.pngAuthentication
Section titled “Authentication”butterbase loginbutterbase logoutConfiguration
Section titled “Configuration”# Show current configbutterbase config get
# Set endpointbutterbase config set endpoint https://api.butterbase.ai
# Set API keybutterbase config set apiKey bb_sk_...Configuration is stored in ~/.butterbase/config.json. Project-level config in .butterbase/config.json takes precedence.
butterbase apps listbutterbase apps create my-appbutterbase apps use app_abc123butterbase apps delete app_abc123Schema
Section titled “Schema”# Get current schemabutterbase schema get
# Save to filebutterbase schema get --output schema.json
# Preview changes (dry-run)butterbase schema apply schema.json --dry-run
# Apply changesbutterbase schema apply schema.json
# Apply with custom migration namebutterbase schema apply schema.json --name "add_users_table"
# Use specific appbutterbase schema get --app app_abc123Functions
Section titled “Functions”# List deployed functionsbutterbase functions list
# Deploy functionbutterbase functions deploy ./functions/hello.ts
# Deploy with custom namebutterbase functions deploy ./functions/hello.ts --name my-function
# Deploy cron functionbutterbase functions deploy ./functions/cleanup.ts --trigger cron
# View logsbutterbase functions logs my-function
# Error logs onlybutterbase functions logs my-function --level error
# Limit log countbutterbase functions logs my-function --limit 50Storage
Section titled “Storage”butterbase storage listbutterbase storage upload ./image.pngbutterbase storage delete obj_abc123butterbase data list # List tablesbutterbase data query posts # Query rows from a tableDeployments
Section titled “Deployments”butterbase deploy ./dist # Deploy frontend from a directoryGlobal options
Section titled “Global options”Most commands support --app to target a specific app:
butterbase schema get --app app_abc123butterbase functions list --app app_abc123butterbase storage list --app app_abc123If --app is not provided, the CLI uses the current app set with butterbase apps use.
Environment variables
Section titled “Environment variables”| Variable | Description |
|---|---|
BUTTERBASE_API_KEY | API key |
BUTTERBASE_ENDPOINT | API endpoint URL |