# Quickstart

> Install the PrimDB CLI, log in, link a project, and ship your first deployment in a few minutes.

This gets you from an empty terminal to a live preview URL. You need a repo and a PrimDB account at [dash.primdb.com](https://dash.primdb.com).

## 1. Install the CLI

The CLI ships as `@primdb/cli` and installs a single `primdb` binary. It runs on Bun and has no runtime dependency on the target machine.

```bash
npm install -g @primdb/cli
# or
bun install -g @primdb/cli
```

## 2. Log in

`primdb login` opens your browser, you authenticate on the web UI, and the CLI stores an encrypted token under `~/.primdb/`. For CI, pass a token directly.

```bash
primdb login                     # interactive, opens the browser
primdb login --token primdb_...  # non-interactive (CI/CD)
primdb whoami                    # confirm who you are logged in as
```

## 3. Create or link a project

`primdb init` creates a new project and writes `.primdb.json` to the current directory. If the project already exists, use `primdb link` instead. Add `.primdb.json` to `.gitignore` — the CLI appends it automatically when a `.gitignore` is present.

```bash
primdb init                          # create a new project (interactive)
primdb link                          # or link an existing one (picker)
primdb link --project myapp          # link non-interactively
```

## 4. Deploy

`primdb deploy` reads the current git branch and HEAD commit automatically, queues a build, and prints a preview URL. Add `--wait` to block until the build finishes and stream the logs.

```bash
primdb deploy            # deploy the current branch
primdb deploy --wait     # block until the build completes, stream logs
```

Each build lands on a preview subdomain of the form `{branch}-{hash}.test.{slug}.primdb.dev`. Your first-ever deployment auto-promotes because there is no previous production to protect.

## 5. Promote to production

By default new builds wait on the preview URL for a human to approve. Promote from the dashboard or the CLI.

```bash
primdb deployments        # list deployments and their status
primdb promote <id>       # approve a preview to production
primdb rollback           # roll back to the previous production build
```

## Or let an agent do it

Everything above is also available over MCP. Point Claude Desktop, Cursor, or any MCP client at `mcp.primdb.com` with a project token and ask it to deploy, promote, or roll back. See [MCP](https://primdb.com/docs/mcp).

---

Source: https://primdb.com/docs/quickstart
