.env file. This reference covers all available configuration options, organized by category.
Environment File Setup
Create a.env file in the project root:
dotenv package to load these variables at startup.
SSL/TLS Configuration
Configure secure connections using SSL/TLS certificates.Path to SSL private key fileThe private key used for HTTPS and secure WebSocket (WSS) connections. This file should have restrictive permissions (600) to prevent unauthorized access.
.env
For Docker deployments, use
/app/keys/server.key as the path.Path to SSL certificate fileThe SSL/TLS certificate corresponding to the private key. Can be a self-signed certificate for development or a CA-signed certificate for production.Generate a self-signed certificate:
.env
Enable insecure (HTTP/WS) modeWhen set to Affected services:
true, the server runs without SSL/TLS encryption using HTTP and plain WebSocket connections. When false, requires valid SERVER_KEY and SERVER_CERT..env
- REST API server (port 5101)
- Incoming WebSocket server (port 5100)
- Outgoing WebSocket server (port 5200)
Authentication Configuration
Control client authentication and access control.Require authentication key for client connectionsWhen enabled, all client connections must provide a valid authentication key. Set to
false to allow connections without authentication (not recommended)..env
Authentication is validated during the
obs_logon event when clients connect to the incoming WebSocket server (port 5100).Static authentication keyThe authentication key that clients must provide to connect. Used when Generate a secure random key:
USE_BACKEND=false or as a fallback when backend authentication is unavailable..env
Backend Integration
Configure integration with external backend services for advanced features.Enable backend service integrationWhen enabled, the server connects to a backend API for:Requires additional backend-related variables when enabled.
- Advanced authentication and authorization
- Multi-organization support
- Supporter status verification
- Match data persistence
.env
Backend API base URLThe base URL of the backend service API. Used for organization verification, key validation, and data persistence.Referenced in
.env
src/connector/databaseConnector.ts:114 for API requests.Backend API authentication tokenThe authentication token sent as
X-User-Token header for backend API requests..env
This token authenticates the Spectra Server to the backend service, not the end clients.
Supporter status verification endpointThe URL for checking organization supporter status. Used to enable premium features for supporters.The server appends
.env
/{orgId} to this URL when checking supporter status.Statistics backend API URLThe base URL for the statistics backend service, used for advanced analytics and data aggregation.
.env
Statistics backend authentication tokenThe authentication token sent as
Authentication header for statistics backend API requests..env
Player camera service URLThe URL for the player camera service integration, if available.
.env
Discord OAuth Integration
Configure Discord OAuth for supporter verification (requiresUSE_BACKEND=true).
Discord application client IDThe OAuth2 client ID from your Discord application settings.Get this from the Discord Developer Portal.
.env
Discord application client secretThe OAuth2 client secret for token exchange.
.env
Discord OAuth callback URLThe redirect URI configured in your Discord application for OAuth callbacks.This must match exactly with the redirect URI in Discord Developer Portal.
.env
Discord OAuth token endpointThe Discord API endpoint for exchanging authorization codes for access tokens.
.env
Discord user info endpointThe Discord API endpoint for retrieving user information.
.env
Spectra client deep link URLThe deep link URL scheme for redirecting users to the Spectra client after authentication.Query parameters
.env
userId, username, and avatar are appended automatically.Tebex Integration
Configure Tebex e-commerce integration for supporter packages (requiresUSE_BACKEND=true).
Tebex API base URLThe base URL for Tebex API requests.
.env
Tebex store identifierYour Tebex store ID for package retrieval.
.env
Tebex extension identifierThe extension ID for Tebex integration.
.env
Configuration Examples
Minimal Development Setup
For local development without SSL or backend:.env
Production with SSL
For production deployment with SSL certificates:.env
Full Backend Integration
For production with all backend features enabled:.env
Security Best Practices
Environment Variable Security
Environment Variable Security
- Never commit
.envfiles to version control - Add
.envto.gitignore - Use strong, randomly generated keys and tokens
- Rotate secrets regularly
- Use different credentials for development and production
SSL/TLS Configuration
SSL/TLS Configuration
- Use certificates from a trusted Certificate Authority in production
- Set appropriate file permissions (600) for private keys
- Regularly renew certificates before expiration
- Never use
INSECURE=truein production environments
Authentication Keys
Authentication Keys
- Generate cryptographically secure random keys
- Use at least 32 bytes (256 bits) of entropy
- Never use default values like
DEBUG_REMOVE_ME - Implement key rotation procedures
Backend Tokens
Backend Tokens
- Store backend tokens securely
- Use environment-specific tokens
- Monitor token usage and revoke compromised tokens
- Implement least-privilege access
Validation and Testing
Verify your configuration after setup:Test Server Startup
Start the server and check for configuration errors:Look for:
- SSL certificate loading messages
- Port binding confirmations
- Backend connection status
Next Steps
Docker Deployment
Deploy with Docker using these configuration options
Local Development
Set up your local development environment