CLI Reference
The Pulsabase CLI is your main tool for managing and deploying projects. It handles everything from authentication to schema migrations and deployments.
Installation
Section titled “Installation”npm install -g @pulsabase/cliVerify:
pulsabase --versionAuthentication Commands
Section titled “Authentication Commands”pulsabase login
Section titled “pulsabase login”Authenticate with your Pulsabase account. Opens a browser window using a secure OAuth2 PKCE flow — no password is stored locally.
pulsabase loginYour access and refresh tokens are saved to ~/.pulsabase/credentials.json (with strict 600 permissions). Tokens are automatically refreshed before they expire.
Options:
| Flag | Default | Description |
|---|---|---|
--idp-url <url> | http://localhost:4000 | IDP URL (for self-hosted setups) |
--auth-url <url> | http://localhost:8889 | Auth service URL |
--project-id <id> | — | Optionally scope the login to a specific project |
pulsabase logout
Section titled “pulsabase logout”Remove stored credentials and sign out.
pulsabase logoutpulsabase whoami
Section titled “pulsabase whoami”Display the currently authenticated user’s email and identity.
pulsabase whoamiProject Commands
Section titled “Project Commands”pulsabase init
Section titled “pulsabase init”Initialize a new Pulsabase project in the current directory or link to an existing one.
pulsabase initpulsabase init my-app # Provide the project name directlyThe interactive wizard will:
- Ask you to create a new project or link to an existing one
- Prompt for your API key (shown once on project creation)
- Ask your preferred language (TypeScript, Dart, Swift, Kotlin)
- Set up the models directory (default:
src/models) - Optionally configure OAuth client credentials
Generated files:
.pulsabase/config.json— local machine config (added to.gitignoreautomatically)src/config.ts— developer-facing config with URLs and API key
pulsabase link
Section titled “pulsabase link”Shorthand to link an existing project interactively (without creating a new one).
pulsabase linkSchema Commands
Section titled “Schema Commands”pulsabase db:sync
Section titled “pulsabase db:sync”Synchronize your local TypeScript models to the remote database schema. Pulsabase prioritizes safety: destructive changes (dropping a table or column) are blocked by default.
# Preview what SQL migrations will be generated (no changes applied)pulsabase db:sync --dry-run
# Apply safe migrations to the databasepulsabase db:sync
# Apply ALL changes, including destructive ones (requires confirmation)pulsabase db:sync --forceHow it works:
- Reads your TypeScript models from the configured
modelsDir - Resolves dependency order (foreign key dependencies sorted topologically)
- Sends the schema to the backend, which diffs against the current database
- Reports a plan: safe changes (adding columns, tables, indexes) vs. unsafe changes (dropping or altering)
- If
--forceis used, prompts for confirmation before applying destructive changes
Flags:
| Flag | Description |
|---|---|
--dry-run | Preview the migration plan without applying any changes |
--force | Bypass safety checks and apply destructive changes. Interactive confirmation required. |
Always run --dry-run before --force. Dropped columns cannot be recovered.
pulsabase db:pull
Section titled “pulsabase db:pull”Pull the existing schema from the database and generate local model files. This is the code-first → pull direction: you build tables in the Dashboard, then pull them as typed models.
# Pull all tables into src/models/pulsabase db:pull
# Overwrite local files without promptingpulsabase db:pull --force
# Specify a custom output directorypulsabase db:pull --output src/lib/models
# Only pull specific tablespulsabase db:pull --tables 'users,posts,comments'pulsabase db:rollback
Section titled “pulsabase db:rollback”Revert the remote database schema to a previous version.
# Revert the most recent migrationpulsabase db:rollback
# Rollback to a specific historical versionpulsabase db:rollback --to 5Model Generator
Section titled “Model Generator”pulsabase generate:model <ModelName>
Section titled “pulsabase generate:model <ModelName>”Scaffold a new TypeScript model file with the correct decorator structure.
pulsabase generate:model Postpulsabase generate:model Comment --table commentsThis creates src/models/Post.ts (or the equivalent in your configured modelsDir) with:
@primaryID column- Common column decorators
static schema: ModelSchemablock withtableName
Deployment Commands
Section titled “Deployment Commands”pulsabase deploy
Section titled “pulsabase deploy”Deploy your project — schema, RLS policies, edge functions, and static hosting — in a single command.
pulsabase deploypulsabase deploy --dir build # Specify a custom build directory| Flag | Description |
|---|---|
--dir <path> | Build output directory (default: dist) |
--dry-run | Preview changes without applying |
--force | Skip all confirmation prompts |
Utility Commands
Section titled “Utility Commands”pulsabase status
Section titled “pulsabase status”Show the current authentication status and linked project information.
pulsabase statuspulsabase --version
Section titled “pulsabase --version”Display the installed CLI version.
pulsabase --versionConfiguration Files
Section titled “Configuration Files”The CLI uses two config files:
| File | Scope | Contents |
|---|---|---|
~/.pulsabase/credentials.json | Global (machine-wide) | OAuth tokens, IDP URL |
.pulsabase/config.json | Per-project | Project ID, API key, language, models dir |
Both are created automatically by pulsabase login and pulsabase init. Neither should be committed to version control.