---
title: Run Kovlet locally (kovletd --dev)
overline: HOW-TO
nav: Run Kovlet locally
updated: 2026-12
minutes: 6
next: quickstart-web
---

# Run Kovlet locally (kovletd --dev)

Run the Kovlet server on your own machine, so you can build and test apps without the hosted service. It takes one command and needs no other services.

> **At a glance**
>
> - **Docker** (API and console): the image `ghcr.io/kovlethq/kovletd`. The API is on `http://127.0.0.1:8080` and the console on `http://localhost:5173`.
> - **Binary** (API only, no console): download `kovletd` from `https://github.com/kovlethq/kovletd/releases/latest`, then run `kovletd --dev`.
> - Point your app at it: `url: "http://127.0.0.1:8080"` and `consoleUrl: "http://localhost:5173"`.
> - Add `--dev-auto-approve` to approve every device code at once, or approve one with `kovletd dev approve <code>`.
> - With no mail provider, emails (end-user sign-in codes too) go to the log. `KOVLET_SECRETS_KEY` is optional in `--dev`.

The server is called [kovletd](/docs/glossary#kovletd "The Kovlet server. Hosted at https://api.kovlet.com; runs locally with kovletd --dev."). The `--dev` flag sets it up for local use. The console is Kovlet's web app, where you sign in, approve apps at `/activate`, and see your Data Spaces.

## Before you start

- Docker or Podman (`docker --version`). Or a machine to run the `kovletd` binary on: Linux or macOS on x86-64 or ARM64, or Windows on x86-64.
- Ports `8080` and `5173` free on `127.0.0.1`.

## 1. Start kovletd

Pick one way. Use Docker if you want the console too.

### With Docker (API and console)

```sh
docker run --rm --name kovletd \
  -p 127.0.0.1:8080:8080 -p 127.0.0.1:5173:8080 \
  -v kovlet-data:/var/lib/kovlet \
  ghcr.io/kovlethq/kovletd --dev --public-url http://127.0.0.1:8080 --console-url http://localhost:5173
```

One kovletd serves both addresses:

- `http://127.0.0.1:8080` is the API that apps call.
- `http://localhost:5173` is the console. The SDK examples use it for sign-in and consent.

Your Data Spaces and files are kept in the `kovlet-data` volume across restarts. Podman takes the same command, with `podman` in place of `docker`.

> **You should see**
>
> - A `database migrated` line, and two `WARN` lines. Both warnings are expected in `--dev`.
> - A last line that says `kovletd ready`.

The log, one JSON line each (shortened):

```text
{"level":"INFO","msg":"database migrated","dialect":"sqlite","applied":[1,2,3,4,5,6,7,8,9,10,11,12,13,14],"version":14}
{"level":"WARN","msg":"--dev: KOVLET_SECRETS_KEY is not set; using an ephemeral key, so end-user OAuth secrets stored now won't open after a restart"}
{"level":"INFO","msg":"auth configured","providers":[],"passkeys":true,"email_login":false,"mailer":"log"}
{"level":"WARN","msg":"dev mode: passwordless email login is enabled (POST /v1/auth/dev/login); never expose this server"}
{"level":"INFO","msg":"dev helpers: `kovletd dev approve <user_code>`, `kovletd dev seed`, consent at {base}/v1/dev/oauth/consent","auto_approve":false,"dev_user":"dev@example.com"}
{"level":"INFO","msg":"kovletd ready","addr":"[::]:8080","dev":true,"database":"sqlite","web_dir":"/srv/web","public_url":"http://127.0.0.1:8080"}
```

Open `http://localhost:5173/signin` and sign in with any email. There is no code to enter.

- Sign in as `dev@example.com` to see what the dev helpers approved. It is the dev user that `--dev-auto-approve` and `kovletd dev` act as.
- A consumer domain (`gmail.com`, …) gets a Personal Workspace.
- Any other domain gets that domain's Organization Workspace.

> **Caution:** The `-p 127.0.0.1:…` mappings keep the server reachable from your machine only. Never publish a `--dev` server on a network.

### With the binary (API only)

Download the archive for your platform from [the kovletd releases](https://github.com/kovlethq/kovletd/releases/latest). Unpack it, and put `kovletd` on your `PATH`. Then run:

```sh
kovletd --dev
```

> **You should see**
>
> - The same lines as with Docker, as plain text, ending in `kovletd ready`.

```text
level=INFO msg="database migrated" dialect=sqlite applied="[1 2 3 4 5 6 7 8 9 10 11 12 13 14]" version=14
level=WARN msg="--dev: KOVLET_SECRETS_KEY is not set; using an ephemeral key, so end-user OAuth secrets stored now won't open after a restart"
level=INFO msg="auth configured" providers=[] passkeys=true email_login=false mailer=log
level=WARN msg="dev mode: passwordless email login is enabled (POST /v1/auth/dev/login); never expose this server"
level=INFO msg="dev helpers: `kovletd dev approve <user_code>`, `kovletd dev seed`, consent at {base}/v1/dev/oauth/consent" auto_approve=false dev_user=dev@example.com
level=INFO msg="kovletd ready" addr=127.0.0.1:8080 dev=true database=sqlite blob_store=local blob_dir=.kovlet/blobs region=local web_dir="" public_url=http://127.0.0.1:8080
```

The binary has no console, so you approve apps from the terminal ([step 3](#3-approve-your-app)). The database and files go to `./.kovlet` in the current directory.

### Check that it runs

```sh
curl http://127.0.0.1:8080/healthz
```

```json
{"mode":"dev","status":"ok","version":"dev"}
```

The two warnings in the log are expected in `--dev`. [Email and OAuth secrets](#email-and-oauth-secrets) explains them.

## 2. Point your app at the local server

Every SDK defaults to `https://api.kovlet.com` and `https://kovlet.com`. Pass the local addresses instead:

| SDK | API base | Console (consent, `/activate`) |
| --- | --- | --- |
| `@kovlet/client`, `@kovlet/react`, Vue, Svelte, React Native | `url: "http://127.0.0.1:8080"` | `consoleUrl: "http://localhost:5173"` |
| Rust, `tauri-plugin-kovlet` | `.base_url("http://127.0.0.1:8080")` | `.console_url("http://localhost:5173")` |
| Swift (`KovletClient`) | `baseURL: URL(string: "http://localhost:8080")` | `consoleURL: URL(string: "http://localhost:5173")` |
| Android (`Kovlet.client`) | `baseUrl = "http://10.0.2.2:8080"` (emulator) | `consoleUrl = "http://10.0.2.2:5173"` |
| REST + WebSocket | `http://127.0.0.1:8080`, WebSocket `ws://127.0.0.1:8080/v1/sync` | `http://localhost:5173/activate` |

The [Android](https://kovlet.com/docs/quickstart-android#local-development) and [iOS](https://kovlet.com/docs/quickstart-ios#local-development) quickstarts cover emulator networking and cleartext HTTP.

## 3. Approve your app

The first time an app connects, Kovlet asks the user to approve it. Locally, you have four ways to do that.

- **In the console (Docker).** A [device-code](/docs/glossary#device-code "A sign-in for apps without a browser redirect: the app shows a short code, and the user approves it at https://kovlet.com/activate. Codes expire after 10 minutes.") app (Node, Rust, native, REST) prints a line like `[kovlet] To connect Todos, open http://localhost:5173/activate?user_code=7V2J-43KQ and confirm code 7V2J-43KQ`. Open it while signed in to the console. Pick the Data Spaces and approve. A browser app opens the consent popup on the console instead.
- **Automatically.** Start kovletd with `--dev-auto-approve`, added after `--dev` in either command. Every device code is approved as `dev@example.com`, with editor on every Data Space in the dev user's workspace. So an app that pins the `spaceId` of an existing space syncs at once.
- **From the terminal.** `kovletd dev approve <user_code>` approves one code as the dev user. Add `--space-id <id>` to share a specific space, or `--role viewer`.
- **Consent pages without a click.** Set the app's console URL to `http://127.0.0.1:8080/v1/dev`, for example `consoleUrl: "http://127.0.0.1:8080/v1/dev"`. kovletd approves the consent as the dev user and redirects straight back with the code. Use this for browser apps when you run the binary.

The `kovletd dev` helpers talk to `http://127.0.0.1:8080`. For another address, pass `--server <url>` or set `KOVLET_URL`. With Docker, run them inside the container:

```sh
docker exec kovletd kovletd dev approve 7V2J-43KQ --space-id 01a23612-fdbc-7990-a6ce-42d94a8918ab
```

```json
{
  "status": "approved",
  "user_id": "01a23612-fdbb-768e-be94-f7076f8b104a",
  "app_id": "01a23613-02ac-7360-9620-adc70a828d5e",
  "machine_id": "01a23613-02ac-70a3-9bdc-1711bb86eee5",
  "space_id": "01a23612-fdbc-7990-a6ce-42d94a8918ab"
}
```

With the binary, run `kovletd dev approve …` directly.

### Get a space and a token in one step

For `curl` or a test script, `kovletd dev seed` gives you a Data Space and an app token:

```sh
eval "$(docker exec kovletd kovletd dev seed --env)"   # binary: eval "$(kovletd dev seed --env)"
echo "$KOVLET_SPACE_ID"
```

`kovletd dev seed` does three things:

- It signs in the dev user.
- It finds or creates the space "Dev Space" and the app "Dev App".
- With `--env`, it prints `KOVLET_URL`, `KOVLET_TOKEN`, `KOVLET_SPACE_ID` and `KOVLET_APP_ID` as `export` lines.

Use `KOVLET_SPACE_ID` as the pinned `spaceId` in the [Node quickstart](https://kovlet.com/docs/quickstart-node). Approve the app with any of the ways above.

## What `--dev` does

`--dev` (or `KOVLET_DEV=1`) switches kovletd to a local setup with no other services:

| Setting | In `--dev` | Without `--dev` |
| --- | --- | --- |
| Database (`--database-url`) | SQLite at `<data-dir>/kovlet.db` | required, `postgres://…` |
| Files (`--blob-dir`) | `<data-dir>/blobs` (`--data-dir`: `.kovlet`, or `/var/lib/kovlet` in the image) | `<data-dir>/blobs`, or S3 with `--blob-store s3` |
| Listen address (`--addr`) | `127.0.0.1:8080` (the image listens on `:8080` inside the container) | `:8080` |
| Console URL (`--console-url`) | `http://localhost:5173` | unset; the public URL when `--web-dir` is set |
| Public URL (`--public-url`) | `http://<addr>` | required, `https://` |
| Sign-in | passwordless dev login: any email, no code | Google, Apple, GitHub, Microsoft, passkeys, email |
| Logs (`--log-format`) | `text` (the image sets `json`) | `json` |

Sessions are real in `--dev`. Apps still sign in with a device code or a consent page, and access is checked as in production. The dev-only routes (`/v1/auth/dev/login`, `/v1/dev/*`) exist only with `--dev`.

`kovletd -h` lists every flag with its `KOVLET_*` environment variable. Flags win over the environment.

### Dev-only flags

| Flag | Environment | What it does |
| --- | --- | --- |
| `--dev` | `KOVLET_DEV` | The local setup above. |
| `--dev-auto-approve` | `KOVLET_DEV_AUTO_APPROVE` | Approves every new device code as the dev user (`dev@example.com`) the moment an app asks for it, so scripts, tests and native apps connect with no browser. The app gets editor on the dev user's space named after it (created if needed) and on every other Data Space in the dev user's workspace. Needs `--dev`. |
| `--dev-permissive` | `KOVLET_DEV_PERMISSIVE` | Also accepts unsigned dev tokens and allows every request. Kept for older test setups; leave it off. Needs `--dev`. |

To start from an empty server, stop kovletd and delete its data:

- Docker image: `docker volume rm kovlet-data`
- Binary: `rm -rf .kovlet`

## Email and OAuth secrets

Pass settings to the image with `-e NAME=value` on `docker run`. For the binary, export them in your shell.

### Email codes

Kovlet sends email through Resend or SMTP. With neither configured, kovletd uses its log mailer. Every email is written to the kovletd log instead of being sent (`docker logs kovletd` for the image). Each one appears as `email (not sent: no mail provider configured)`, with the recipient, subject and text.

An end user's sign-in code is in the subject: `<code> is your <app> sign-in code`. So you can test [end-user email sign-in](https://kovlet.com/docs/end-users) from the log.

With the log mailer, email sign-in to the console itself is off (`email_login` is `false` in the startup log). The dev login replaces it.

To send real email, set one provider and a sender. With Resend:

```sh
export KOVLET_RESEND_API_KEY=re_...
export KOVLET_EMAIL_FROM="Kovlet <hello@example.com>"
```

Or with SMTP:

```sh
export KOVLET_SMTP_HOST=smtp.example.com
export KOVLET_SMTP_USERNAME=apikey
export KOVLET_SMTP_PASSWORD=...
export KOVLET_EMAIL_FROM="Kovlet <hello@example.com>"
```

`KOVLET_SMTP_PORT` defaults to 587 with `KOVLET_SMTP_SECURITY=starttls` (the default), or 465 with `tls`. `none` is also accepted.

> **Caution:** Configure one provider, not both, and always set `KOVLET_EMAIL_FROM`. Otherwise kovletd refuses to start.

### OAuth client secrets for end users

An owner can add Google, Apple, GitHub or LinkedIn sign-in for an app's end users. kovletd then encrypts the provider's client secret with `KOVLET_SECRETS_KEY`.

In `--dev` without that key, kovletd makes an ephemeral key at startup (the warning in step 1). OAuth providers work. But a secret saved now can't be read after kovletd restarts, and you have to enter it again. Set a key to keep them:

```sh
export KOVLET_SECRETS_KEY="$(openssl rand -base64 32)"   # 32 random bytes, base64 or hex; keep it with your data
```

For Docker, add `-e KOVLET_SECRETS_KEY` to the `docker run` command. It passes the exported value into the container.

`KOVLET_SECRETS_KEY` is an environment variable only, never a flag. Email codes, guests and ID tokens (Clerk, Firebase) don't need it. Outside `--dev`, owners can't store OAuth secrets at all without the key.

## Troubleshooting

- **`address already in use` (binary) or `port is already allocated` (Docker).** Another process has the port. Change the host side of the mapping (`-p 127.0.0.1:9090:8080` and `--public-url http://127.0.0.1:9090`), or start the binary with `--addr 127.0.0.1:9090`. Then use that address as your app's `url`.
- **The app prints an `/activate` link on `https://kovlet.com`.** You didn't pass the console URL. Set `consoleUrl` (or the SDK's equivalent) to `http://localhost:5173`.
- **The `/activate` link on `http://localhost:5173` doesn't load.** You run the binary, which has no console. Approve with `kovletd dev approve <code>` or `--dev-auto-approve`, or use the Docker image.
- **`is kovletd --dev running at http://127.0.0.1:8080?` from `kovletd dev`.** The server isn't running there, or runs on another address. Pass `--server`.
- **`http://127.0.0.1:8080 has no dev helpers: they exist only on kovletd --dev`.** The server was started without `--dev`.
- **`a database is required: set --database-url or KOVLET_DATABASE_URL, or use --dev`.** You started kovletd without `--dev`. Add it. With `--database-url` set, the same mistake with `--dev-auto-approve` or `--dev-permissive` reports `--dev-auto-approve needs --dev` or `--dev-permissive needs --dev`.

## Next

- [Quickstart: web and React](https://kovlet.com/docs/quickstart-web), [Node and Electron](https://kovlet.com/docs/quickstart-node), [Rust and Tauri](https://kovlet.com/docs/quickstart-tauri), [iOS](https://kovlet.com/docs/quickstart-ios), [Android](https://kovlet.com/docs/quickstart-android) or [REST + WebSocket](https://kovlet.com/docs/quickstart-rest) against your local server.
- [Connect a coding agent (MCP)](https://kovlet.com/docs/connect-coding-agent): point `kovlet-mcp` at `http://127.0.0.1:8080` with `--url`.
- [Let strangers sign in to your app (end users)](https://kovlet.com/docs/end-users): email codes and OAuth providers, which you can now test locally.
