Complete reference for the BetterBase CLI (bb).
bun add -g @betterbase/cliVerify:
bb --version| Option | Description |
|---|---|
--version |
Show version |
--help |
Show help |
--project |
Specify project path |
Initialize a new BetterBase project.
bb init [project-name]
bb init my-app
bb init my-app ./pathStart development server with auto-regeneration.
bb dev
bb dev ./my-projectManage database migrations.
# Apply pending migrations
bb migrate
# Preview changes
bb migrate preview
# Apply to production (with confirmation)
bb migrate production
# Rollback last migration
bb migrate rollback
# Rollback N migrations
bb migrate rollback -s 3
# Show migration history
bb migrate historyInstall and configure BetterAuth.
bb auth setup
bb auth setup ./my-projectAdd OAuth provider.
bb auth add-provider github
bb auth add-provider google
bb auth add-provider discord
# Available: google, github, discord, apple, microsoft, twitter, facebookAuthenticate CLI with BetterBase.
bb loginSign out CLI.
bb logoutInitialize storage.
bb storage init
bb storage init ./my-projectList storage buckets.
bb storage list
bb storage bucketsUpload file to storage.
bb storage upload <file> [options]
bb storage upload ./image.jpg
bb storage upload ./doc.pdf -b my-bucket -p uploads/doc.pdfOptions:
-b, --bucket- Bucket name-p, --path- Path in bucket
Create new function.
bb function create <name>
bb function create hello-worldRun function locally.
bb function dev <name>
bb function dev hello-worldBuild function for deployment.
bb function build <name>
bb function build hello-world --target aws-lambda --minifyOptions:
--target- Build target (node, aws-lambda, vercel, etc.)--minify- Enable minification
Deploy function.
bb function deploy <name>
bb function deploy hello-world --sync-envOptions:
--sync-env- Sync environment variables
List all functions.
bb function listView function logs.
bb function logs <name>
bb function logs hello-world -l 50Options:
-l, --limit- Number of log lines
Create new webhook.
bb webhook create
bb webhook create ./my-projectList webhooks.
bb webhook listTest webhook.
bb webhook test <webhook-id>
bb webhook test wh_12345View webhook logs.
bb webhook logs <webhook-id>
bb webhook logs wh_12345 -l 100Options:
-l, --limit- Number of log lines
Create preview environment.
bb branch create <name>
bb branch create feature/login-formList preview environments.
bb branch listDelete preview environment.
bb branch delete <name>
bb branch delete feature/login-formCheck branch status.
bb branch status <name>Sleep preview environment.
bb branch sleep <name>Wake preview environment.
bb branch wake <name>Generate GraphQL schema.
bb graphql generate
bb graphql generate ./my-projectOpen GraphQL Playground.
bb graphql playgroundGenerate CRUD routes.
bb generate crud <table-name>
bb generate crud users
bb generate crud posts ./my-projectCreate RLS policy.
bb rls create --table <name> --name <policy-name> --command <command> [--check <expression>]
bb rls create --table posts --name users-own-posts --command SELECT --check "user_id = auth.uid()"List RLS policies.
bb rls listEnable RLS on table.
bb rls enable --table <name>Disable RLS on table.
bb rls disable --table <name>Test RLS policies.
bb rls test --table <name>
bb rls test --table posts| Command | Aliases | Description |
|---|---|---|
bb init |
Initialize project | |
bb dev |
Start dev server | |
bb migrate |
db | Database migrations |
bb auth setup |
Setup auth | |
bb auth add-provider |
Add OAuth | |
bb function create |
Create function | |
bb function dev |
Run function locally | |
bb function deploy |
Deploy function | |
bb storage upload |
Upload file | |
bb webhook create |
Create webhook | |
bb webhook test |
Test webhook | |
bb branch create |
Create preview | |
bb graphql generate |
Generate schema | |
bb generate crud |
Generate CRUD | |
bb rls create |
Create policy |
The CLI respects:
BB_PROJECT- Project pathBB_API_KEY- API key for authentication
CLI reads from:
- Command line arguments
.betterbase-context.jsonbetterbase.config.ts
- CLI Overview - CLI introduction
- Deployment - Deployment guides