Configuration
MikroRoom works out of the box with zero configuration, but you can customize it for production deployments.
Configuration Files
Section titled “Configuration Files”MikroRoom uses two configuration approaches:
- Frontend Config -
static/mikroroom.config.json(runtime) - Server Config -
.envfile (environment variables)
Frontend Configuration
Section titled “Frontend Configuration”Edit static/mikroroom.config.json to configure the client:
{ "apiUrl": "wss://api.yourdomain.com/ws", "iceServers": [ { "urls": "stun:stun.cloudflare.com:3478" }, { "urls": "turn:turn.yourdomain.com:3478", "username": "your-username", "credential": "your-password" } ]}Options
Section titled “Options”apiUrl (required)
Section titled “apiUrl (required)”WebSocket URL for the signaling server.
- Development:
ws://localhost:3000/ws - Production (HTTPS):
wss://yourdomain.com/ws - Separate API server:
wss://api.yourdomain.com/ws
iceServers (optional)
Section titled “iceServers (optional)”Array of STUN/TURN servers for WebRTC connectivity.
Default (if omitted):
[{ "urls": "stun:stun.cloudflare.com:3478" }]With TURN (recommended for production):
[ { "urls": "stun:stun.cloudflare.com:3478" }, { "urls": "turn:turn.yourdomain.com:3478", "username": "mikroroom", "credential": "your-secure-password" }]Server Configuration
Section titled “Server Configuration”Create a .env file in the project root:
# Server portPORT=3000
# HTTPS (optional)USE_HTTPS=falseSSL_CERT_PATH=/path/to/cert.pemSSL_KEY_PATH=/path/to/key.pem
# TURN server (recommended for production)TURN_SERVER_URL=turn:turn.yourdomain.com:3478TURN_SERVER_USERNAME=mikroroomTURN_SERVER_CREDENTIAL=your-password
# Room managementMAX_LATENT_ROOMS=10LATENT_ROOM_MAX_AGE_HOURS=24Server Options
Section titled “Server Options”Server port (default: 3000)
PORT=8080USE_HTTPS
Section titled “USE_HTTPS”Enable HTTPS server (default: false)
USE_HTTPS=trueSSL_CERT_PATH=/etc/letsencrypt/live/yourdomain.com/fullchain.pemSSL_KEY_PATH=/etc/letsencrypt/live/yourdomain.com/privkey.pemTURN Server
Section titled “TURN Server”Configure TURN for users behind strict NAT/firewalls:
TURN_SERVER_URL=turn:turn.example.com:3478TURN_SERVER_USERNAME=usernameTURN_SERVER_CREDENTIAL=passwordRoom Management
Section titled “Room Management”Control room lifecycle:
MAX_LATENT_ROOMS=20 # Max pre-created empty roomsLATENT_ROOM_MAX_AGE_HOURS=48 # Hours before cleanupHTTPS Setup
Section titled “HTTPS Setup”HTTPS is required for:
- Camera/microphone access in browsers
- Production deployments
- Secure WebSocket connections (WSS)
Option 1: Let’s Encrypt (Recommended)
Section titled “Option 1: Let’s Encrypt (Recommended)”# Install Certbotsudo apt install certbot
# Get certificatesudo certbot certonly --standalone -d yourdomain.com
# Configure MikroRoomUSE_HTTPS=trueSSL_CERT_PATH=/etc/letsencrypt/live/yourdomain.com/fullchain.pemSSL_KEY_PATH=/etc/letsencrypt/live/yourdomain.com/privkey.pemOption 2: Reverse Proxy (Easier)
Section titled “Option 2: Reverse Proxy (Easier)”Use Nginx or Caddy for SSL termination. Run MikroRoom on HTTP internally.
Nginx Example:
server { listen 443 ssl http2; server_name yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
# WebSocket upgrade for /ws location /ws { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; }
# Proxy other requests location / { proxy_pass http://localhost:3000; }}Caddy Example (auto-HTTPS):
yourdomain.com { reverse_proxy localhost:3000}TURN Server Setup
Section titled “TURN Server Setup”TURN servers ensure connectivity for users behind strict firewalls (~20% of cases).
Self-Hosted with Coturn
Section titled “Self-Hosted with Coturn”Install and configure Coturn:
# Install (Ubuntu/Debian)sudo apt install coturn
# Edit /etc/turnserver.conflistening-port=3478realm=yourdomain.comserver-name=turn.yourdomain.comlt-cred-mechuser=mikroroom:your-secure-passwordfingerprint
# Start Coturnsudo systemctl enable coturnsudo systemctl start coturn
# Allow firewallsudo ufw allow 3478/tcpsudo ufw allow 3478/udpsudo ufw allow 49152:65535/udpUpdate both configs:
Server (.env):
TURN_SERVER_URL=turn:turn.yourdomain.com:3478TURN_SERVER_USERNAME=mikroroomTURN_SERVER_CREDENTIAL=your-secure-passwordFrontend (mikroroom.config.json):
{ "iceServers": [ { "urls": "stun:stun.cloudflare.com:3478" }, { "urls": "turn:turn.yourdomain.com:3478", "username": "mikroroom", "credential": "your-secure-password" } ]}Managed TURN Services
Section titled “Managed TURN Services”Alternatively, use a managed service:
- Twilio - Get credentials
- Metered.ca - Free tier available
- Xirsys - WebRTC infrastructure
Environment Examples
Section titled “Environment Examples”Development
Section titled “Development”PORT=3000{ "apiUrl": "ws://localhost:3000/ws"}Production
Section titled “Production”PORT=3000TURN_SERVER_URL=turn:turn.yourdomain.com:3478TURN_SERVER_USERNAME=mikroroomTURN_SERVER_CREDENTIAL=strong-passwordMAX_LATENT_ROOMS=20{ "apiUrl": "wss://yourdomain.com/ws", "iceServers": [ { "urls": "stun:stun.cloudflare.com:3478" }, { "urls": "turn:turn.yourdomain.com:3478", "username": "mikroroom", "credential": "strong-password" } ]}Next Steps
Section titled “Next Steps”- Deployment Guide - Deploy to production
- CLI Reference - All configuration options