
# Deploy Sovrium with Docker Compose and PostgreSQL

You want the app and its PostgreSQL database to come up together as one stack, with the database wired in by a single `DATABASE_URL`.

## Define the stack

```yaml
# compose.yaml
services:
  db:
    image: postgres:17
    environment:
      POSTGRES_PASSWORD: sovrium
      POSTGRES_DB: sovrium
    volumes: ['db-data:/var/lib/postgresql/data']
  app:
    image: ghcr.io/sovrium/sovrium:latest
    command: start /app/app.ts
    depends_on: [db]
    ports: ['3000:3000']
    volumes: ['./app.ts:/app/app.ts:ro']
    environment:
      DATABASE_URL: postgres://postgres:sovrium@db:5432/sovrium
      AUTH_SECRET: change-me-to-32-byte-hex
      SOVRIUM_ENCRYPTION_KEY: change-me-to-32-byte-hex
      BASE_URL: http://localhost:3000
volumes:
  db-data:
```

## Run and verify

```bash
docker compose up -d
curl -fsS http://localhost:3000/ >/dev/null && echo "up"
```

Because `DATABASE_URL` is set, Sovrium runs on Postgres and applies its schema on boot.

## Next

- [Database Infrastructure](/en/docs/database-infrastructure) — the Postgres engine Sovrium targets.
- [Schema Migrations](/en/docs/migrations) — how the schema evolves on each boot.
- [Security Hardening](/en/docs/security-hardening) — replace the placeholder secrets before production.
