# Get started

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:

- **Fakebase CLI** runs the database and migrations from your terminal. Coding
    agents use it too.
- **Fakebase Studio** is the desktop app for macOS. Browse tables, edit rows,
    and review migrations.

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

> **Prerequisites**
>
> You need [Node.js](https://nodejs.org) 22 or later, and [Docker
> Desktop](https://www.docker.com/products/docker-desktop/) if Fakebase should
> run the database for you.

### Install the CLI

```bash
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:

```bash
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

```bash
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](https://fakebase.studio/docs/cli-migrations.md) in the CLI docs.

---

## Fakebase Studio

### Download the app

Fakebase Studio runs on macOS.

[Download Fakebase Studio for macOS](https://fakebase.studio/)

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](https://fakebase.studio/docs/studio-databases.md).

---

## Next steps

- [Overview](https://fakebase.studio/docs/cli.md): The Fakebase CLI runs a local PostgreSQL database for your project and manages its schema with plain-SQL migrations.
- [Overview](https://fakebase.studio/docs/studio.md): Fakebase Studio is the desktop app for working with your PostgreSQL database on macOS.
- [Build with Agents](https://fakebase.studio/docs/build-with-agents.md): Set up Cursor, Claude Code, or Codex to change your database for you with the Fakebase CLI.
