Skip to content

Environment Variables

TIP

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

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).
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.)
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.
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_UIbooleantrueAllow channel owners to enable Remote Channel in the UI. When false, the Remote Channel toggle is disabled and locked for all channels, and existing channels with it enabled will see it turn off automatically in the UI.
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_POLL_INTERVAL_MSinteger5000How often the poller checks enabled Remote Channel sources.
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_PRESENCE_PING_INTERVALinteger5000Presence heartbeat interval (milliseconds).
CHAT_PEER_PRESENCE_POLL_INTERVALinteger3000Active peer presence poll interval (milliseconds).
CHAT_HEALTH_CHECK_INTERVALinteger10000Connection health check interval (milliseconds).
CHAT_SSE_RECONNECT_DELAYinteger2000Delay before reconnecting SSE after error (milliseconds).
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_KEYstringauto-generatedPersistent encryption-at-rest key. Changing this value without first decrypting old data will make previously encrypted content unreadable.
VAPID_PUBLIC_KEYstringauto-generatedWeb Push public key (required for push notifications).
VAPID_PRIVATE_KEYstringauto-generatedWeb Push private key (required for push notifications).
VAPID_SUBJECTstringauto-generatedContact 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

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.