Skip to main content

Configuration

BandMate is configured through environment variables. This page covers every available option.

Required Variables

These must be set for BandMate to function securely:

VariableDescription
JWT_ACCESS_SECRETSecret key for signing access tokens. Use a random string (32+ characters recommended).
JWT_REFRESH_SECRETSecret key for signing refresh tokens. Use a different random string.
danger

Never use the default secrets in production. Generate strong random secrets:

openssl rand -base64 32

Server

VariableDefaultDescription
PORT3000Port the server listens on
NODE_ENVdevelopmentSet to production for deployments
DATABASE_URLfile:./data/bandmate.dbSQLite database path

Admin User

These variables control the initial admin account created during database seeding:

VariableDefaultDescription
ADMIN_EMAILadmin@bandmate.localAdmin login email
ADMIN_PASSWORDadminAdmin login password
tip

Set these before running db:seed or starting the container for the first time. They are only used during initial seeding.

Reverse Proxy

If BandMate runs behind nginx, Traefik, Caddy, or another reverse proxy:

VariableDefaultDescription
APP_URLhttp://localhost:3000Your public-facing URL. Used for email links, OAuth redirects, and cookie configuration.

Example:

-e APP_URL="https://bandmate.yourdomain.com"

When APP_URL uses HTTPS, BandMate automatically enables the Secure flag on authentication cookies.

Email Notifications (Optional)

Enable email notifications for invitations, activity digests, and missed chat messages:

VariableDefaultDescription
EMAIL_ENABLEDfalseSet to true to enable email
EMAIL_HOSTsmtp.example.comSMTP server hostname
EMAIL_PORT587SMTP port
EMAIL_SECUREfalseSet to true for port 465 (SSL/TLS)
EMAIL_USER--SMTP username
EMAIL_PASS--SMTP password
EMAIL_FROMBandMate <noreply@bandmate.local>Sender address shown in emails

Chat Missed Message Emails

When a user receives a chat message while offline, BandMate sends them an email summary. These variables tune that behaviour:

VariableDefaultDescription
CHAT_NOTIFICATION_GRACE_MS600000 (10 min)How long to wait after a message is sent before emailing the recipient. Prevents emails for messages that get read quickly.
CHAT_NOTIFICATION_POLL_MS120000 (2 min)How often the server checks for unread messages to notify about.

Both variables are optional. The defaults are suitable for production. Chat notification emails are only sent when EMAIL_ENABLED=true.

Example: Gmail SMTP

EMAIL_ENABLED=true
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_SECURE=false
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
EMAIL_FROM="BandMate <your-email@gmail.com>"
note

Gmail requires an App Password if you have 2FA enabled.

Google OAuth (Optional)

Enable Google sign-in for your users:

VariableDefaultDescription
GOOGLE_OAUTH_ENABLEDfalseSet to true to enable Google login
GOOGLE_CLIENT_ID--From Google Cloud Console
GOOGLE_CLIENT_SECRET--From Google Cloud Console
GOOGLE_CALLBACK_URLhttp://localhost:3000/api/auth/google/callbackOAuth callback URL

Setup Steps

  1. Go to Google Cloud Console
  2. Create a new project (or select an existing one)
  3. Navigate to APIs & Services > Credentials
  4. Create an OAuth 2.0 Client ID (Web application type)
  5. Add your callback URL to Authorized redirect URIs:
    • Development: http://localhost:3000/api/auth/google/callback
    • Production: https://bandmate.yourdomain.com/api/auth/google/callback
  6. Copy the Client ID and Client Secret into your environment variables

File Upload Limits

These limits are built into the application and are not configurable via environment variables:

File TypeMax SizeAccepted Formats
Images5 MBJPEG, PNG, GIF, WebP
Audio100 MBMP3, WAV, OGG, FLAC, AAC, M4A
Stems (ZIP)500 MBZIP

Complete .env Example

# Required
JWT_ACCESS_SECRET=change-me-to-a-random-string
JWT_REFRESH_SECRET=change-me-to-another-random-string

# Server
PORT=3000
NODE_ENV=production
DATABASE_URL=file:./data/bandmate.db

# Admin (used during initial seed only)
ADMIN_EMAIL=admin@bandmate.local
ADMIN_PASSWORD=change-this-password

# Reverse Proxy
APP_URL=https://bandmate.yourdomain.com

# Email (optional)
EMAIL_ENABLED=false
# EMAIL_HOST=smtp.example.com
# EMAIL_PORT=587
# EMAIL_SECURE=false
# EMAIL_USER=
# EMAIL_PASS=
# EMAIL_FROM=BandMate <noreply@bandmate.local>

# Chat missed message email timing (optional, requires EMAIL_ENABLED=true)
# CHAT_NOTIFICATION_GRACE_MS=600000 # 10 minutes
# CHAT_NOTIFICATION_POLL_MS=120000 # 2 minutes

# Google OAuth (optional)
GOOGLE_OAUTH_ENABLED=false
# GOOGLE_CLIENT_ID=
# GOOGLE_CLIENT_SECRET=
# GOOGLE_CALLBACK_URL=https://bandmate.yourdomain.com/api/auth/google/callback

Next Steps