Configuration and Security

This guide centralizes environment configuration and security expectations.

For deployment mode selection, see DEPLOYMENT.md. For integration-specific setup values, see INTEGRATIONS.md.

Environment Variables

For the complete environment variable reference (all containers, defaults, and status labels), see ENVIRONMENT_VARIABLES.md.

The sections below provide guidance on configuration patterns, security hardening, and operational concerns that go beyond simple variable listings.

Role Split Guidance (Compose/Kubernetes)

For horizontally scaled split deployments, prefer:

For single-process deployments, keep BACKEND_PROCESS_ROLE=all.

External Access Settings

If users access soundspan from outside your local network, configure CORS and API routing intentionally.

Frontend Build-Time vs Runtime

NEXT_PUBLIC_API_URL, NEXT_PUBLIC_API_PATH_MODE, and NEXT_PUBLIC_LISTEN_TOGETHER_ALLOW_POLLING are frontend build-time variables.

Source-Build Direct Mode (optional)

If you build the frontend yourself and want direct browser calls to backend:

NEXT_PUBLIC_API_URL=https://soundspan-api.yourdomain.com
NEXT_PUBLIC_API_PATH_MODE=direct
ALLOWED_ORIGINS=http://localhost:3030,https://soundspan.yourdomain.com

Pre-Published Image Recommendation (no rebuild)

For users consuming published images:

NEXT_PUBLIC_API_PATH_MODE controls how the browser reaches backend APIs:

Set this in frontend build/dev environment (same place you set NEXT_PUBLIC_API_URL). For pre-published images, see reverse-proxy path routing guidance in REVERSE_PROXY_AND_TUNNELS.md.

For Listen Together, the frontend proxies /socket.io/listen-together to backend by default in split deployments. If you bypass frontend proxying intentionally, your edge proxy/tunnel must route /socket.io/listen-together to backend :3006. LISTEN_TOGETHER_ALLOW_POLLING=false is recommended for HA deployments; only enable polling fallback when sticky sessions are guaranteed end-to-end. For pre-published frontend images, browser polling fallback also requires rebuilding with NEXT_PUBLIC_LISTEN_TOGETHER_ALLOW_POLLING=true.

For multi-replica backend/frontend deployments, configure Redis as a highly available endpoint. A single Redis pod is a runtime SPOF for sessions, queues, and realtime coordination. Redis HA is an operator-managed prerequisite (external managed Redis/Dragonfly, Sentinel, or equivalent); soundspan consumes the configured endpoint and does not manage Redis HA topology itself.

Sensitive Variables

Never commit .env files or credentials.

Variable Purpose Required
SESSION_SECRET Session encryption (32+ chars) Yes
SETTINGS_ENCRYPTION_KEY Encryption of stored credentials Yes
LIDARR_API_KEY Lidarr integration If using Lidarr
OPENAI_API_KEY AI features Optional
LASTFM_API_KEY Artist recommendations Optional
FANART_API_KEY Artist images Optional
YTMUSIC_STREAMER_URL YouTube Music sidecar URL If using YouTube Music
TIDAL_SIDECAR_URL TIDAL sidecar URL If using TIDAL

Soulseek credentials are configured via System Settings and stored encrypted in the database.

Authentication and Session Security

Streaming Credential Security

Webhook and Admin Security

Optional VPN Notes

If using Mullvad VPN for Soulseek:

Generating Secrets

# Session secret
openssl rand -base64 32

# Settings encryption key
openssl rand -base64 32

Network Safety Guidance


See also