Get started
Install the Fakebase CLI to run a local PostgreSQL database with migrations, and download Fakebase Studio to work with it on macOS.
Fakebase gives you a local PostgreSQL database for development and migrations you write in plain SQL and keep in your repository. There are two ways to use it:
You can use either one, or both. They share the same project files, so a project you set up with the CLI opens in Studio and the other way around.
Fakebase CLI
Install the CLI
npm install -g @fakebase/cli
To try it without installing, put npx @fakebase/cli in front of any command instead of fakebase.
Set up your project
In the root of your project, run:
fakebase init --start
This creates fakebase.toml and a migrations/ folder, then starts PostgreSQL in Docker. The first start downloads PostgreSQL, so it can take a minute.
Connect your app
fakebase db env
This writes DATABASE_URL to .env.local and makes sure git ignores the file. Your app reads the connection URL from there.
If something doesn't work, run fakebase doctor. It checks your setup and tells you what to fix.
Next, write your first migration. See Migrations in the CLI docs.
Fakebase Studio
Download the app
Fakebase Studio runs on macOS.
Open the downloaded file and drag Fakebase into your Applications folder.
Open your project
Choose Open project folder and pick the folder that has your fakebase.toml, for example a project you set up with fakebase init. Studio shows your tables, data, and migrations.
Don't have a project yet? You can create one or connect to a database you already have, right from Studio. See Databases.