Environment setup

How developers and operators configure local and deployed environments. Never put secret values in documentation—only names and intent.

Local development

  • Package manager: Yarn in each app directory (yarn install, yarn dev, etc.).
  • API: Copy ethica-api/.env.example to .env and fill in values for your machine. DATABASE_URL should point at a local or shared dev PostgreSQL instance.
  • Frontends: Each Next.js app uses its own env files (e.g. .env.local) for public NEXT_PUBLIC_* variables and API base URLs so the browser calls the correct ethica-api origin.

Deployed environments

  • Netlify (frontends): Set environment variables in the Netlify UI per site (preview vs production as needed).
  • DigitalOcean (API + database): Set secrets on the app and managed database; the API process receives DATABASE_URL and integration keys the same way as locally, without committing them.

Variable categories (ethica-api)

The authoritative list with comments is ethica-api/.env.example. Grouped by concern:

CategoryExamples (names only)
DatabaseDATABASE_URL, PORT
Staff auth / sessionsJWT_SECRET, JWT_EXPIRES_IN, SESSION_IDLE_MINUTES, BCRYPT_SALT_ROUNDS
Staff MFAMFA_ENCRYPTION_KEY, MFA_STEP_UP_HOURS, MFA_ISSUER_NAME, MFA_DISABLED, SKIP_MFA_IN_DEV, MFA_DEV_ALWAYS_STEP_UP, MFA_ENFORCEMENT_REQUIRED
Customer auth / MFACUSTOMER_MFA_ISSUER, CUSTOMER_MFA_ENCRYPTION_KEY
EmailRESEND_API_KEY, MAIL_FROM, optional SEND_TEST_EMAIL_TO (dev)
UploadsCLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET
SMSINFO_BIP_API_KEY, INFO_BIP_BASE_URL
Customer portal links / legalCUSTOMER_PORTAL_BASE_URL, CUSTOMER_PORTAL_TERMS_VERSION
Feature modulesMODULE_CUSTOMERS, MODULE_INVESTMENTS, MODULE_FINANCE, MODULE_ANALYTICS — set to false to disable a module (see ethica-api/src/app.module.ts).

Frontends may define their own variables (e.g. terms version must stay aligned with API expectations where documented in .env.example).

See also