CLI
Overview
The Fakebase CLI runs a local PostgreSQL database for your project and manages its schema with plain-SQL migrations.
The Fakebase CLI gives your project a local PostgreSQL database for development and keeps its schema as plain SQL migration files in your repository. You run it from your terminal, and coding agents run the same commands.
Fakebase is for development databases. It never touches production.
Quick start
With the CLI installed, run these in the root of your project:
fakebase init --start
fakebase db env
fakebase migrate create add_users
fakebase migrate up
fakebase init --startsets up the project and starts PostgreSQL in Docker.fakebase db envwritesDATABASE_URLto.env.localfor your app.fakebase migrate create add_userscreates a migration file. Write your SQL in it.fakebase migrate uppreviews the migration, asks you to confirm, and applies it.
Commands
| Command | What it does |
|---|---|
fakebase init | Sets up Fakebase in the current folder |
fakebase db start | Starts the database |
fakebase db stop | Stops the database. Your data is kept. |
fakebase db status | Shows whether the database is running |
fakebase db env | Writes the connection URL to .env.local |
fakebase db inspect | Shows tables, columns, keys, and indexes |
fakebase migrate create | Creates a new migration file |
fakebase migrate validate | Checks migration files for mistakes |
fakebase migrate diff | Previews pending migrations without applying them |
fakebase migrate up | Applies pending migrations |
fakebase migrate status | Lists applied and pending migrations |
fakebase migrate history | Lists applied migrations and when they ran |
fakebase migrate import | Converts migrations from the older Fakebase format |
fakebase studio | Opens the project, or one migration, in Fakebase Studio |
fakebase doctor | Checks your setup and tells you what to fix |
fakebase agent install | Teaches Cursor, Claude Code, and Codex to use Fakebase |
Scripts and agents
Every command takes --json for one machine-readable result, and --yes to skip prompts. Migrations that can delete data also need --allow-destructive, even with --yes.
Add --help to any command for its flags.