Docs

Environment Variables

All configuration options for SubsTrack.

Environment Variables

Copy .env.example to .env.local (or set in your host’s env) and fill in the values below.

Database

VariableRequiredDescription
MONGODB_URIYesMongoDB connection string (e.g. mongodb://localhost:27017/substrack or Atlas URI).

Auth (Auth.js / NextAuth v5)

VariableRequiredDescription
NEXTAUTH_SECRETYesRandom secret for signing sessions. Generate: openssl rand -base64 32.
NEXTAUTH_URLYesFull URL of the app (e.g. http://localhost:3000 or https://substrack.example.com).
GOOGLE_CLIENT_IDNoFor “Sign in with Google”.
GOOGLE_CLIENT_SECRETNoFor “Sign in with Google”.

Email (Resend)

VariableRequiredDescription
RESEND_API_KEYYes*Resend API key. *Required if you send email.
EMAIL_FROMYes*Sender address (e.g. SubsTrack <noreply@yourdomain.com>).

Telegram

VariableRequiredDescription
TELEGRAM_BOT_TOKENNoBot token from @BotFather. Required for Telegram reminders/confirmations.
TELEGRAM_WEBHOOK_SECRETNoRandom secret for webhook verification when using webhook mode.

Security

VariableRequiredDescription
CONFIRMATION_SECRETYesHMAC secret for “I’ve paid” email links. Generate: openssl rand -base64 32.
CRON_SECRETYesSecret sent in x-cron-secret header when calling /api/cron/*. Generate: openssl rand -base64 32.

App

VariableRequiredDescription
APP_URLNoSame as NEXTAUTH_URL in practice; used for building confirmation links. Defaults to NEXTAUTH_URL.
NODE_ENVNodevelopment or production.

Example

MONGODB_URI=mongodb://localhost:27017/substrack
NEXTAUTH_SECRET=your-64-char-secret
NEXTAUTH_URL=http://localhost:3000
RESEND_API_KEY=re_xxxx
EMAIL_FROM=SubsTrack <noreply@example.com>
CONFIRMATION_SECRET=your-hmac-secret
CRON_SECRET=your-cron-secret
TELEGRAM_BOT_TOKEN=optional

Never commit .env.local or put secrets in the client. Use your platform’s secret storage in production.