@butterbase/cli
Command-line tool for Butterbase project scaffolding and backend management.
Installation
npm install -g @butterbase/cli
Quick Start
butterbase login
butterbase apps create my-app
butterbase apps use app_abc123
butterbase schema get --output schema.json
butterbase schema apply schema.json
butterbase functions deploy ./functions/hello.ts
butterbase storage upload ./image.png
Commands
Authentication
butterbase login
butterbase logout
Configuration
butterbase config get
butterbase config set endpoint https://api.butterbase.ai
butterbase config set apiKey bb_key_...
Configuration is stored in ~/.butterbase/config.json.
Apps
butterbase apps list
butterbase apps create my-app
butterbase apps use app_abc123
butterbase apps delete app_abc123
Schema
butterbase schema get
butterbase schema get --output schema.json
butterbase schema apply schema.json --dry-run
butterbase schema apply schema.json
butterbase schema apply schema.json --name "add_users_table"
butterbase schema get --app app_abc123
Functions
butterbase functions list
butterbase functions deploy ./functions/hello.ts
butterbase functions deploy ./functions/hello.ts --name my-function
butterbase functions deploy ./functions/hello.ts --description "Hello world function"
butterbase functions deploy ./functions/cleanup.ts --trigger cron
butterbase functions logs my-function
butterbase functions logs my-function --level error
butterbase functions logs my-function --limit 50
Storage
butterbase storage list
butterbase storage upload ./image.png
butterbase storage delete obj_abc123
Global Options
Most commands support the --app flag to specify an app ID:
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.
Configuration
The CLI stores configuration in two places:
Project config takes precedence over global config.
Environment Variables
You can also configure the CLI using environment variables:
BUTTERBASE_API_KEY - API key
BUTTERBASE_ENDPOINT - API endpoint URL
Examples
Complete Workflow
butterbase login
butterbase apps create my-grocery-app
butterbase apps use app_abc123
cat > schema.json <<EOF
{
"tables": {
"grocery_items": {
"columns": {
"id": { "type": "uuid", "primaryKey": true, "default": "gen_random_uuid()" },
"name": { "type": "text" },
"quantity": { "type": "integer", "default": "1" },
"purchased": { "type": "boolean", "default": "false" },
"user_id": { "type": "uuid" },
"created_at": { "type": "timestamptz", "default": "now()" }
}
}
}
}
EOF
butterbase schema apply schema.json
butterbase functions deploy ./functions/add-item.ts
butterbase storage upload ./logo.png
Working with Multiple Apps
butterbase apps create my-app-prod
butterbase apps create my-app-staging
butterbase functions deploy ./functions/api.ts --app app_prod123
butterbase functions deploy ./functions/api.ts --app app_staging456
butterbase apps use app_prod123
butterbase apps use app_staging456
Development
npm install
npm run build
node dist/bin/butterbase.js --help
Integrations
butterbase integrations list --app app_abc123
butterbase integrations list --search salesforce --app app_abc123
butterbase integrations config --app app_abc123
butterbase integrations configure gmail --app app_abc123
butterbase integrations disable gmail --app app_abc123
butterbase integrations connect gmail --redirect-url https://yourapp.com/settings --app app_abc123
butterbase integrations connections --app app_abc123
butterbase integrations disconnect <connection-id> --app app_abc123
butterbase integrations tools gmail --app app_abc123
butterbase integrations execute GMAIL_SEND_EMAIL --data '{"to":"x@y.com","subject":"Hi","body":"Hello"}' --app app_abc123
License
MIT