CLI Reference

The Kolaybase CLI lets you manage projects, push schemas, run migrations, generate types, and more — all from your terminal.

Installation

npm install -g kolaybase-cli

Authentication

kb login

Log in to your Kolaybase account. The CLI opens your default browser, where you authenticate via Keycloak. After signing in you are shown a confirmation page — click Allow access to connect the CLI to your account, or Cancel to abort. The browser tab can be closed once the terminal confirms you are logged in.

kb login

# Custom API URL
kb login --api-url https://api.your-domain.com

Credentials are stored in ~/.kolaybase/config.json. Run kb login again at any time to switch accounts.

Project Setup

kb init

Create a new project and link the current directory.

kb init
# Interactive — prompts for name, team, etc.

kb init --name my-app

kb link

Link current directory to an existing project.

kb link --project-id <uuid>

kb unlink

Remove project link from current directory.

kb unlink

kb status

Show project info, credentials, and connection strings.

kb status

# Show API keys (masked by default)
kb status --show-keys

Project Management

kb projects

List all projects in your active team.

kb projects
# or
kb list

kb projects:create

kb projects:create --name "My App" --description "Production app"

kb projects:delete

kb projects:delete <projectId>

Database

kb db push

Push a local schema to the remote database. Supports Prisma schema files and raw SQL.

# Push Prisma schema
kb db push

# Push SQL file
kb db push --file schema.sql

kb db pull

Introspect the remote database and save schema locally.

kb db pull

kb db reset

Drop all tables in the project database.

kb db reset
# Skips confirmation
kb db reset --force

kb db seed

Run a seed file against the database.

kb db seed

kb db dump

Export database schema as SQL.

kb db dump
kb db dump --output schema.sql

kb db diff

Show differences between local Prisma schema and remote database.

kb db diff

kb db execute

Run arbitrary SQL.

# From file
kb db execute --file query.sql

# Inline
kb db execute --query "SELECT * FROM users LIMIT 5"

Inspect

kb inspect

Show tables with row counts and sizes.

# All tables
kb inspect

# Specific table
kb inspect --table users

Migrations

kb migration new

Create a new migration file.

kb migration new add_orders_table

kb migration up

Apply pending migrations.

# Apply all pending
kb migration up

# Apply one step
kb migration up --step 1

# Dry run (show SQL without executing)
kb migration up --dry-run

kb migration down

Rollback migrations.

kb migration down
kb migration down --step 2
kb migration down --dry-run

kb migration status

Show applied and pending migrations.

kb migration status

Code Generation

kb gen types

Generate TypeScript type definitions from your database schema.

kb gen types
kb gen types --output src/types/database.ts

kb gen client

Generate a typed API client.

kb gen client
kb gen client --lang typescript --output src/lib/client.ts

Utilities

kb logs

View SQL audit logs.

kb logs
kb logs --tail 50

kb secrets

Manage project environment variables.

# List (values are masked)
kb secrets list

# Set
kb secrets set DATABASE_URL "postgres://..."

# Remove
kb secrets unset DATABASE_URL

Configuration

The CLI stores configuration in .kolaybase in your project directory and credentials in ~/.kolaybase/config.json.

# .kolaybase (project config)
{
  "projectId": "uuid",
  "apiUrl": "https://api.kolaybase.com"
}