Dashboard/Database

Database

ProxyOS uses SQLite (via better-sqlite3) stored at /data/proxyos/proxyos.db on the proxyos-data volume.

What it does

The database is the source of truth for all ProxyOS configuration. When ProxyOS starts, it runs any pending database migrations automatically (additive-only — existing data is never modified by migrations).

The schema is managed by Drizzle ORM. Tables are defined in packages/db/src/schema.ts.

Key tables

TableContents
routesProxy route configuration
redirect_hostsRedirect host configuration
error_hostsError host configuration
streamsTCP/UDP stream configuration
usersDashboard user accounts
audit_logAll mutating actions
access_logPer-request access records (recent)
traffic_metricsAggregated request metrics by time bucket
health_checksHealth check results history
certificatesCertificate status and metadata
sso_providersSSO forward-auth providers
dns_providersDNS challenge providers
api_keysAPI key credentials
agentsFederation agent registrations

How to access the database

Interactive SQLite shell (read-only queries):

docker compose exec proxyos sqlite3 /data/proxyos/proxyos.db

Quick query:

docker compose exec proxyos sqlite3 /data/proxyos/proxyos.db \
  "SELECT domain, sync_status, enabled FROM routes ORDER BY created_at;"

Check integrity:

docker compose exec proxyos sqlite3 /data/proxyos/proxyos.db "PRAGMA integrity_check;"

Output should be ok. Any other output indicates corruption.

Migrations

Migrations are applied automatically on startup. They are append-only: existing migration entries in packages/db/src/migrations.ts are never modified. New schema changes always add a new migration entry.

If a migration fails on startup, the container will not start cleanly. Check logs:

docker compose logs proxyos | grep -i migration

Troubleshooting

  • Database corruption: Restore from backup (see Backup and Restore)
  • Disk full: Check available space on the volume. SQLite will fail all writes when disk is full.
  • Migration failure: Check the logs for the specific SQL error. Do not modify existing migration entries — create a corrective migration instead.
ProxyOS