Skip to main content

Environment Variables

This reference is based on these source files:

  • cashlytics/.env.example
  • cashlytics/docker-compose.selfhost.yml

Required baseline for self-hosting

Set these before first boot:

POSTGRES_PASSWORD=replace_with_long_random_password
AUTH_SECRET=replace_with_long_random_secret
NEXT_PUBLIC_APP_URL=https://your-domain.tld
AUTH_TRUST_HOST=true
SINGLE_USER_MODE=true

Full variable reference

VariableRequiredDefaultPurposeRecommended value
DATABASE_URLYes (manual setup)Generated in Compose from POSTGRES_PASSWORDPostgreSQL connection string used by the apppostgresql://cashlytics:<password>@postgres:5432/cashlytics
POSTGRES_PASSWORDYesNonePassword for PostgreSQL container userLong random secret (32+ chars)
NEXT_PUBLIC_APP_URLYeshttp://localhost:3000Public URL used by frontend/runtimeYour real HTTPS domain
NEXT_PUBLIC_DEFAULT_LOCALENodeDefault language for new sessionsen or de
NEXT_PUBLIC_DEFAULT_CURRENCYNoEURDefault currency in UIEUR, USD, GBP, CHF
AUTH_SECRETYesNoneAuth.js secret for tokens/session securityStrong random secret (npx auth secret)
AUTH_TRUST_HOSTStrongly recommendedtrue in ComposeTrust forwarded host headers behind proxy/domaintrue for VPS/reverse proxy
SINGLE_USER_MODERequired by policytrue in ComposeRegistration policytrue for personal use, false for open registration
SINGLE_USER_EMAILNoEmptyUsed by migration/backfill flows in single-user setupsOwner email address
OPENAI_API_KEYNoEmptyEnables AI Assistant featuresValid OpenAI API key
EMAIL_TRANSPORTNoAuto/emptyEmail backend mode (smtp or sendmail)smtp in most setups
SMTP_HOSTNo*EmptySMTP server hostnameProvider hostname
SMTP_PORTNo*EmptySMTP server port587 (STARTTLS) or 465 (TLS)
SMTP_USERNo*EmptySMTP auth usernameSMTP account username
SMTP_PASSNo*EmptySMTP auth password/tokenApp password or provider token
SMTP_FROMNo*SMTP_USER fallbackSender address for outgoing mailsnoreply@your-domain.tld
APP_URLNoNEXT_PUBLIC_APP_URL fallbackServer-side absolute URL for email linksSame as public app URL
VAPID_PUBLIC_KEYNo**EmptyPublic key for browser push subscriptionGenerated via web-push
VAPID_PRIVATE_KEYNo**EmptyPrivate key to sign push messagesGenerated via web-push
VAPID_SUBJECTNo**EmptyContact URI for VAPID identitymailto:ops@your-domain.tld
CRON_SECRETNo**EmptyBearer token for protected cron endpointRandom hex secret
NOTIFICATION_SCHEDULENo**0 8 * * *Cron schedule for upcoming-payment checksKeep default or adjust timezone needs

* Required only if SMTP/password-reset/welcome-email features are enabled.
** Required only if push notifications and reminder scheduling are enabled.

Minimal (no AI, no SMTP, no push)

POSTGRES_PASSWORD=...
AUTH_SECRET=...
NEXT_PUBLIC_APP_URL=https://app.example.com
AUTH_TRUST_HOST=true
SINGLE_USER_MODE=true

AI enabled

OPENAI_API_KEY=sk-...

SMTP enabled

EMAIL_TRANSPORT=smtp
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_USER=mailer@example.com
SMTP_PASS=...
SMTP_FROM=noreply@example.com
APP_URL=https://app.example.com

Push reminders enabled

VAPID_PUBLIC_KEY=...
VAPID_PRIVATE_KEY=...
VAPID_SUBJECT=mailto:ops@example.com
CRON_SECRET=...
NOTIFICATION_SCHEDULE=0 8 * * *

Validation and safety checks

  • Keep .env out of git.
  • Use long random values for POSTGRES_PASSWORD, AUTH_SECRET, and CRON_SECRET.
  • Keep NEXT_PUBLIC_APP_URL and APP_URL aligned with your real domain.
  • If authentication behaves incorrectly behind a proxy, verify AUTH_TRUST_HOST=true.
  • If emails fail, check SMTP transport mode, port, credentials, and sender domain policies.