Database Configuration
Field-by-field reference for configuring PostgreSQL and SQLite in Compozy.
database.driver
Select the backing store for Compozy metadata.
| Property | Value |
|---|---|
| Type | string |
| Options | postgres | sqlite |
| Default | postgres |
| Environment Variable | DB_DRIVER or COMPOZY_DB_DRIVER |
Omitting driver keeps PostgreSQL as the default.
PostgreSQL Fields
Use these fields when driver: postgres (or omitted):
| Field | Type | Required | Description |
|---|---|---|---|
host | string | Yes* | Hostname or IP address of the PostgreSQL server (*omit when using conn_string). |
port | string | No | Port number (default 5432). |
user | string | Yes* | Database user used for migrations and runtime operations. |
password | string | Yes* | Password for the specified user. |
dbname | string | Yes* | Name of the PostgreSQL database where Compozy stores metadata. |
conn_string | string | No | PostgreSQL DSN (postgres://user:pass@host:port/db?sslmode=require). When provided, overrides individual connection fields. |
sslmode | string | No | SSL/TLS mode (disable, require, verify-ca, verify-full). Defaults to require in production builds. |
max_open_conns | int | No | Upper bound for concurrent connections in the pool. |
max_idle_conns | int | No | Number of warm idle connections the pool maintains. |
database:
driver: postgres
host: postgres.internal
port: 5432
user: compozy
password: ${DB_PASSWORD}
dbname: compozy
sslmode: verify-full
max_open_conns: 50
max_idle_conns: 10SQLite Fields
Use these fields when driver: sqlite:
| Field | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Path to the SQLite file. Use :memory: for ephemeral, in-memory deployments. |
busy_timeout | int | No | Milliseconds SQLite waits before returning database is locked. |
journal_mode | string | No | Transaction journal mode. wal is recommended for moderate concurrency. |
synchronous | string | No | Durability level: full, normal, or off. |
database:
driver: sqlite
path: ./data/compozy.db
busy_timeout: 5000
journal_mode: wal
synchronous: normalEnvironment Variables
CLI flags and environment variables override configuration values:
| Variable | Description |
|---|---|
COMPOZY_DB_DRIVER | Overrides database.driver. |
COMPOZY_DB_HOST | PostgreSQL host. |
COMPOZY_DB_PORT | PostgreSQL port. |
COMPOZY_DB_NAME | PostgreSQL database name. |
COMPOZY_DB_USER | PostgreSQL user. |
COMPOZY_DB_PASSWORD | PostgreSQL password. |
COMPOZY_DB_CONN_STRING | PostgreSQL connection string. |
COMPOZY_DB_PATH | SQLite file or :memory: path. |
COMPOZY_DB_BUSY_TIMEOUT | Millisecond timeout for SQLite locks. |
CLI precedence follows the order: flags → environment → configuration file → defaults.