development, staging, production, test, and fixture.
Required Variables
.env.development
Database Names
Sonamu chooses the database name in this order:SONAMU_DB_NAMEfrom the active environment- A generated name based on
projectName
sonamu.config.ts
The config no longer needsdatabase.name or database.environments.
sonamu.config.ts
defaultOptions only for Knex options that should be shared by all generated presets: pool
settings, timeouts, SSL defaults, or debug settings. Sonamu fills host, port, user, password, and
database from SONAMU_DB_*.
Environment-Specific Files
- Development
- Staging
- Production
.env.development
Read-Only Replica
SetSONAMU_DB_READONLY_* when an environment has a separate read-only database. Any missing
read-only field uses the same environmentβs main database value.
.env.production
DB.getDB("r") for read-only queries. It resolves to development_readonly,
staging_readonly, production_readonly, or test_readonly based on NODE_ENV.
Fixture Database
Fixture variables apply only to the test fixture database..env.test
SONAMU_DB_FIXTURE_NAME is missing, Sonamu uses the generated fixture database name.