Skip to content

Environment Variables ​

TIP

You can easily configure most of these variables via the admin panel without touching the .env file. Visit Admin Panel for more information.

You can configure environment variables to customize app behavior.

bash
cd /opt/songbird
cp .env.example .env
nano .env

Configurable values ​

VariableTypeDefaultDescription
SERVER_PORTinteger5174API server port. (PORT is supported as a legacy fallback.)
CLIENT_PORTinteger80Nginx listen port (what users connect to).
BIND_ADDRESSstringlocalhostNetwork interface to bind to. Use localhost for VPS/private networks to avoid exposing backend when firewall is disabled; use 0.0.0.0 for Docker containers.
DATA_DIRstring<project_root>/dataAbsolute path to the data directory (database, uploads, backups). Override this on cloud platforms (Railway, Render, Fly.io) to point at the platform's persistent volume mount.
DB_CLIENTstringsqlite3Database driver client (sqlite3 or postgres).
POSTGRES_HOSTstring127.0.0.1PostgreSQL database host.
POSTGRES_PORTinteger5432PostgreSQL database port.
POSTGRES_USERstringpostgresPostgreSQL username.
POSTGRES_PASSWORDstringpostgresPostgreSQL password.
POSTGRES_DBstringsongbirdPostgreSQL database name.
POSTGRES_URLstringnullOptional full PostgreSQL connection string URL.
POSTGRES_SSLbooleanfalseEnable SSL for PostgreSQL connections.
NODE_EXTRA_CA_CERTSstring""Absolute path to an additional trusted PEM CA certificate bundle or file (required for managed PostgreSQL databases with custom/self-signed CAs like Aiven or AWS RDS).
REDIS_HOSTstring""Optional Redis host. If set, Songbird uses Redis for BullMQ background job queues (media processing), session storage, and pub/sub instead of in-process fallback.
REDIS_PORTinteger6379Optional Redis port.
REDIS_URLstring""Optional Redis connection URL (e.g. redis://user:pass@host:port).
APP_ENVstringproductionServer runtime mode (production recommended/default).
APP_DEBUGbooleanfalseEnable verbose server debug logs in terminal/stdout ([app-debug] lines for message send/upload/transcode/metadata events).
SIGN_UPbooleantrueAllow new accounts to be created via the website (/signup). (ACCOUNT_CREATION is supported as a legacy fallback.)
ADMIN_PANELbooleantrueEnable the admin panel interface. When false, the admin panel is completely disabled and inaccessible.
FILE_UPLOADbooleantrueEnable/disable all uploads globally (chat files + avatars).
FILE_UPLOAD_MAX_SIZE_MBinteger25Per-file upload max size (MB). (FILE_UPLOAD_MAX_SIZE is supported as a legacy fallback in bytes.)
FILE_UPLOAD_MAX_TOTAL_SIZE_MBinteger75Per-message total upload size cap (MB). (FILE_UPLOAD_MAX_TOTAL_SIZE is supported as a legacy fallback in bytes.)
FILE_UPLOAD_MAX_FILESinteger10Max uploaded files in one message.
FILE_UPLOAD_TRANSCODE_VIDEOSbooleantrueConvert uploaded videos to H.264/AAC MP4 and keep only the converted file. Requires ffmpeg.
STORAGE_DRIVERstringlocalPluggable storage driver (local for local disk, remote for remote object storage). See Object Storage.
STORAGE_ENDPOINTstring""S3-compatible service URL (AWS S3, Cloudflare R2, MinIO, ArvanCloud, Wasabi, etc.).
STORAGE_BUCKETstring""Storage bucket name.
STORAGE_REGIONstringautoStorage bucket region (e.g. us-east-1, eu-central-1).
STORAGE_ACCESS_KEY_IDstring""Storage Access Key ID.
STORAGE_SECRET_ACCESS_KEYstring""Storage Secret Access Key.
STORAGE_PUBLIC_URLstring""Optional custom CDN domain URL prefix (e.g. https://cdn.example.com).
APP_PUBLIC_URLstring""Public origin(s) of the app UI (comma-separated) allowed to upload straight to the bucket. Auto-detected when empty.
STORAGE_AUTO_CORSbooleanfalseConfigure bucket CORS for browser uploads automatically.
STORAGE_EXPIRES_INinteger3600Expiration time in seconds for presigned URLs.
STORAGE_FORCE_PATH_STYLEbooleantrueEnable path-style URL syntax (true recommended for MinIO, R2, ArvanCloud, etc.).
STORAGE_PROXY_URLstring""Optional HTTP/HTTPS proxy URL for object storage requests.
WORKER_URLstring""External media processing worker base URL for HTTP push transcoding (e.g. https://worker.example.com).
WORKER_PORTinteger8080Port for the standalone Media Worker service (worker/). Songbird uses this port to construct the default local Media Worker URL (http://127.0.0.1:8080) when WORKER_URL is omitted.
STORAGE_PROCESSING_MODEstringautoMedia processing workflow mode (auto, local, remote).
STORAGE_PROCESSING_TIMEOUT_MSinteger120000Total retry timeout in milliseconds when dispatching transcode jobs to the remote worker before falling back to the local worker (in auto mode) or failing the dispatch (in remote mode).
WEBHOOK_SECRETstring(Auto-generated)Secret token (x-songbird-webhook-secret) to authenticate dispatch and callback requests between Songbird and the Media Worker.
WEBHOOK_URLstring""Songbird public webhook callback URL sent to external workers (e.g. https://songbird.example.com/api/uploads/webhook/processed).
STORAGE_ENCRYPTION_MODEstringremoteStorage encryption strategy (remote for provider-side SSE-S3, local for application-level encryption).
MESSAGE_FILE_RETENTIONinteger7Auto-delete uploaded message files after N days (0 disables).
MESSAGE_TEXT_RETENTIONinteger0Auto-delete text-only messages after N days (0 disables).
MESSAGE_MAX_CHARSinteger4000Max message length.
REMOTE_CHANNELbooleanfalseEnable the server-side Remote Channel worker.
REMOTE_CHANNEL_UIbooleantrueShow Remote Channel settings to channel owners in the UI. When false, the section is hidden from regular users (and user API calls are rejected) — only server admins can configure mirroring via the admin panel.
REMOTE_CHANNEL_MEDIA_STREAMbooleantrueAllow channel owners to enable the "Stream Media Files" option in the UI. When false, the option is disabled and locked for all channels.
REMOTE_CHANNEL_TELEGRAM_API_IDinteger0Telegram API ID.
REMOTE_CHANNEL_TELEGRAM_API_HASHstring""Telegram API hash.
REMOTE_CHANNEL_TELEGRAM_SESSION_STRINGstring""Telegram StringSession. Treat it like a password.
REMOTE_CHANNEL_TELEGRAM_PROXY_URLstring""Telegram MTProto proxy URL. (REMOTE_CHANNEL_PROXY_URL is supported as a legacy fallback.)
REMOTE_CHANNEL_SONGBIRD_PROXY_URLstring""HTTP/HTTPS proxy for outbound requests from this server to remote Songbird servers.
REMOTE_CHANNEL_TICK_MODEbooleanfalseWhen true, background poll loops stay off so a serverless host can sleep.
REMOTE_CHANNEL_CRON_SECRETstring(Auto-generated)Shared secret for the tick endpoint.
REMOTE_CHANNEL_POLL_INTERVAL_MSinteger5000How often the poller checks enabled Remote Channel sources (1000-900000).
REMOTE_CHANNEL_TELEGRAM_POLL_LIMITinteger50Max Telegram posts fetched per poll for each source (1-100).
REMOTE_CHANNEL_QUEUE_INTERVAL_MSinteger1000How often the mirror queue worker processes pending remote posts.
REMOTE_CHANNEL_QUEUE_MAX_ATTEMPTSinteger10Max retry attempts before a queued remote post is marked failed.
REMOTE_CHANNEL_QUEUE_BATCH_SIZEinteger10Max queued remote posts processed per worker tick (1-50).
REMOTE_CHANNEL_QUEUE_CONCURRENCYinteger3How many queued items are processed concurrently per worker tick. Also controls how many sources are polled in parallel.
REMOTE_CHANNEL_QUEUE_STALE_LOCK_MSinteger300000Age after which an in-progress queue lock is considered stale and can be retried.
CHAT_PENDING_TEXT_TIMEOUTinteger300000Mark pending text message as failed after this timeout (milliseconds).
CHAT_PENDING_FILE_TIMEOUTinteger1200000Mark pending file message as failed / XHR timeout for uploads (milliseconds).
CHAT_PENDING_RETRY_INTERVALinteger4000Retry cadence for pending sends while connected (milliseconds).
CHAT_PENDING_STATUS_CHECK_INTERVALinteger1000How often pending messages are checked for timeout (milliseconds).
CHAT_CACHE_TTLinteger24Local cache time-to-live for chat lists and message caches (hours).
CHAT_MESSAGE_FETCH_LIMITinteger60Max messages requested per chat fetch (initial/latest window).
CHAT_MESSAGE_PAGE_SIZEinteger60Page size for loading older messages when scrolling to top.
CHAT_LIST_REFRESH_INTERVALinteger20000Chats list background refresh interval (milliseconds).
CHAT_HEALTH_CHECK_INTERVALinteger10000Connection health check interval (milliseconds).
CHAT_SSE_RECONNECT_DELAYinteger2000Delay before reconnecting SSE after error (milliseconds).
WS_HEARTBEAT_INTERVAL_MSinteger30000Frequency of WebSocket heartbeat ping frames sent to clients.
WS_HEARTBEAT_TIMEOUT_MSinteger10000Grace period before terminating un-responsive WebSocket clients.
CHAT_SEARCH_MAX_RESULTSinteger5Max users shown in search results.
CHAT_VOICE_WAVEFORM_MAX_DECODE_MBinteger5Max audio file size (MB) allowed for client-side waveform decode. (CHAT_VOICE_WAVEFORM_MAX_DECODE_BYTES is supported as a legacy fallback in bytes.)
CHAT_VOICE_WAVEFORM_MAX_DECODE_SECONDSinteger480Max audio duration (seconds) allowed for client-side waveform decode.
NICKNAME_MAX_CHARSinteger24Max nickname length for users and groups. (NICKNAME_MAX is supported as a legacy fallback.)
USERNAME_MAX_CHARSinteger16Max username length for users and groups. (USERNAME_MAX is supported as a legacy fallback.)
STORAGE_ENCRYPTION_KEYstring(Auto-generated)Persistent encryption-at-rest key. Once stored in the database, a different env value is a fatal startup error. Rotate only by re-encrypting old data first.
ADMIN_API_TOKENstring(Auto-generated)Authentication token for local admin API endpoints.
VAPID_PUBLIC_KEYstring(Auto-generated)Web Push public key (required for push notifications). A different env value after the first run is a fatal startup error.
VAPID_PRIVATE_KEYstring(Auto-generated)Web Push private key (required for push notifications). A different env value after the first run is a fatal startup error.
VAPID_SUBJECTstring(Auto-generated)Contact for VAPID (email or URL). Used by push providers.
PUSH_PROXY_URLstring""Proxy URL for push notification delivery. Use when your server cannot directly reach push service endpoints.

INFO

Push notifications require HTTPS (except localhost for development). iOS requires an installed PWA (iOS 16.4+).

INFO

Encryption at rest: Songbird auto-generates STORAGE_ENCRYPTION_KEY on first run and saves it into .env. Keep that value stable. On startup, the server backfills existing stored messages, message-upload files, and avatar files into encrypted form when needed.

Apply Changes ​

TIP

You can easily edit your .env file via the Deployment Script and it would automatically apply and rebuild the app for you!

1. Docker deployment:

bash
cd /opt/songbird
# Apply updated runtime env vars from .env
docker compose -f docker-compose.yaml up -d --force-recreate songbird

If your change affects build-time client values, rebuild the image too:

bash
cd /opt/songbird
docker compose -f docker-compose.yaml up -d --build --force-recreate songbird

2. Manual (systemd) deployment:

Rebuild client:

bash
cd /opt/songbird/client
npm run build

Restart systemd service:

bash
sudo systemctl restart songbird

3. Reload Nginx:

bash
sudo systemctl reload nginx

Released under the MIT License.