Database Configuration

Field-by-field reference for configuring PostgreSQL and SQLite in Compozy.

database.driver

Select the backing store for Compozy metadata.

PropertyValue
Typestring
Optionspostgres | sqlite
Defaultpostgres
Environment VariableDB_DRIVER or COMPOZY_DB_DRIVER

Omitting driver keeps PostgreSQL as the default.

PostgreSQL Fields

Use these fields when driver: postgres (or omitted):

FieldTypeRequiredDescription
hoststringYes*Hostname or IP address of the PostgreSQL server (*omit when using conn_string).
portstringNoPort number (default 5432).
userstringYes*Database user used for migrations and runtime operations.
passwordstringYes*Password for the specified user.
dbnamestringYes*Name of the PostgreSQL database where Compozy stores metadata.
conn_stringstringNoPostgreSQL DSN (postgres://user:pass@host:port/db?sslmode=require). When provided, overrides individual connection fields.
sslmodestringNoSSL/TLS mode (disable, require, verify-ca, verify-full). Defaults to require in production builds.
max_open_connsintNoUpper bound for concurrent connections in the pool.
max_idle_connsintNoNumber of warm idle connections the pool maintains.
PostgreSQL Example
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: 10

SQLite Fields

Use these fields when driver: sqlite:

FieldTypeRequiredDescription
pathstringYesPath to the SQLite file. Use :memory: for ephemeral, in-memory deployments.
busy_timeoutintNoMilliseconds SQLite waits before returning database is locked.
journal_modestringNoTransaction journal mode. wal is recommended for moderate concurrency.
synchronousstringNoDurability level: full, normal, or off.
SQLite Example
database:
  driver: sqlite
  path: ./data/compozy.db
  busy_timeout: 5000
  journal_mode: wal
  synchronous: normal

Environment Variables

CLI flags and environment variables override configuration values:

VariableDescription
COMPOZY_DB_DRIVEROverrides database.driver.
COMPOZY_DB_HOSTPostgreSQL host.
COMPOZY_DB_PORTPostgreSQL port.
COMPOZY_DB_NAMEPostgreSQL database name.
COMPOZY_DB_USERPostgreSQL user.
COMPOZY_DB_PASSWORDPostgreSQL password.
COMPOZY_DB_CONN_STRINGPostgreSQL connection string.
COMPOZY_DB_PATHSQLite file or :memory: path.
COMPOZY_DB_BUSY_TIMEOUTMillisecond timeout for SQLite locks.

CLI precedence follows the order: flags → environment → configuration file → defaults.