Welcome back

Sign in to your Fakebase account.

or

Don't have an account? Create one

CLI

Overview

The Fakebase CLI runs a local PostgreSQL database for your project and manages its schema with plain-SQL migrations.

View as markdown

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
  1. fakebase init --start sets up the project and starts PostgreSQL in Docker.
  2. fakebase db env writes DATABASE_URL to .env.local for your app.
  3. fakebase migrate create add_users creates a migration file. Write your SQL in it.
  4. fakebase migrate up previews the migration, asks you to confirm, and applies it.

Commands

CommandWhat it does
fakebase initSets up Fakebase in the current folder
fakebase db startStarts the database
fakebase db stopStops the database. Your data is kept.
fakebase db statusShows whether the database is running
fakebase db envWrites the connection URL to .env.local
fakebase db inspectShows tables, columns, keys, and indexes
fakebase migrate createCreates a new migration file
fakebase migrate validateChecks migration files for mistakes
fakebase migrate diffPreviews pending migrations without applying them
fakebase migrate upApplies pending migrations
fakebase migrate statusLists applied and pending migrations
fakebase migrate historyLists applied migrations and when they ran
fakebase migrate importConverts migrations from the older Fakebase format
fakebase studioOpens the project, or one migration, in Fakebase Studio
fakebase doctorChecks your setup and tells you what to fix
fakebase agent installTeaches 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.


Next steps