> ## Documentation Index
> Fetch the complete documentation index at: https://docs.opendot.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Database inspection

> Inspect the local PostgreSQL schema and platform data with Drizzle Studio.

OpenDot uses PostgreSQL for durable platform data and Drizzle for schema and migrations.

## Start the local database

From the repository root:

```bash theme={null}
cp .env.example .env
docker compose up -d postgres migrate
```

This starts the local PostgreSQL container on `127.0.0.1:5432` and applies the Drizzle migrations.

## Open Drizzle Studio

From the repository root:

```bash theme={null}
pnpm --filter ./platform run db:studio
```

Open:

```text theme={null}
https://local.drizzle.studio
```

Drizzle Studio reads `platform/drizzle.config.ts`, loads the root `.env`, and connects through `POSTGRES_URI` when set or the local Postgres defaults when it is empty. Use it to inspect the OSS core schema: `app_users`, `local_auth_credentials`, `user_preferences`, SDK API keys, versioned agents and pipelines, devices, device activation requests, device credentials, runtime session tokens, device state, and deployments.

## Connection defaults

The local Compose database uses:

```bash theme={null}
POSTGRES_PORT=5432
POSTGRES_SSL=false
```

For Supabase, set `POSTGRES_URI` to the Supabase Postgres connection string and use:

```bash theme={null}
POSTGRES_SSL=true
```

OpenDot keeps product data in its own tables even when Supabase Auth is used. In Supabase-backed deployments, `auth.users.id` maps to `app_users.id`; devices, agents, pipelines, deployments, settings, SDK API keys, device credentials, and runtime session tokens remain OpenDot-owned data.

## Stop inspection services

Stop Drizzle Studio with `Ctrl+C` in the terminal where it is running.

Stop the local database:

```bash theme={null}
docker compose down
```
