Prerequisites:
- Docker and Docker Compose (recommended)
- Node.js 24.4.1 or higher (for manual deployment)
- Basic understanding of web server configuration
Quick Start with Docker
The fastest way to get LiveCodes running is using Docker Compose:Download the release
Download the latest release from the GitHub releases page:
Launch the services
- app: The main LiveCodes application
- valkey: Redis-compatible database for sharing features
- server: Caddy reverse proxy for HTTPS
Environment Variables Reference
Build Arguments
These are set during the Docker build process:| Variable | Description | Default |
|---|---|---|
SELF_HOSTED | Enable self-hosted mode | true |
SELF_HOSTED_SHARE | Enable project sharing | true |
SELF_HOSTED_BROADCAST | Enable live broadcast | true |
BROADCAST_PORT | Port for broadcast service | 3030 |
SANDBOX_HOST_NAME | Sandbox domain (must be different origin) | livecodes.localhost |
SANDBOX_PORT | Port for sandbox | 8090 |
FIREBASE_CONFIG | Firebase config JSON for auth | - |
DOCS_BASE_URL | Custom docs URL or null to skip docs | null |
NODE_OPTIONS | Node.js memory options | --max-old-space-size=4096 |
Runtime Environment
These are set when running the container:| Variable | Description | Default |
|---|---|---|
HOST_NAME | Primary domain name | livecodes.localhost |
PORT | HTTPS port | 443 |
BROADCAST_TOKENS | Comma-separated auth tokens | - |
LOG_URL | External logging endpoint | null |
VALKEY_HOST | Valkey/Redis host | valkey |
VALKEY_PORT | Valkey/Redis port | 6379 |
Manual Deployment
For deployment without Docker:Static File Hosting
For the simplest deployment, LiveCodes can run entirely as static files:build directory to any static file host:
- Cloudflare Pages
- Netlify
- Firebase Hosting
- GitHub Pages
- AWS S3 + CloudFront
Static hosting disables server-dependent features like sharing and broadcast. The playground itself works fully client-side.
Custom Assets
To use custom assets (logos, themes, etc.):custom-assets/ and they’ll be available at /assets/*.
Performance Optimization
Memory Configuration
For large deployments, increase Node.js memory:Caching Strategy
The server sets cache headers automatically:/assets/*: 1 year cache (immutable)/livecodes/*(except maps): 1 year cache (immutable)/livecodes/assets/*: 4 hours cache (must-revalidate)
CDN Integration
Place a CDN in front of your deployment:Security Considerations
Origin Isolation
The sandbox runs on a separate origin to prevent:- Cross-site scripting attacks
- Access to parent application data
- Cookie theft
- Main:
https://livecodes.com, Sandbox:https://sandbox.livecodes.com - Main:
https://code.example.com, Sandbox:https://sandbox.code.example.com
CORS Configuration
The CORS proxy endpoint (/api/cors) only accepts requests from:
- The configured
HOST_NAME - Localhost/127.0.0.1 (for development)
Share Data Persistence
Shared projects are stored in Valkey/Redis with these characteristics:- 14-character unique IDs (vs 9 for dpaste, 11 for API)
- Automatic collision avoidance
- Configurable persistence with snapshots every 60 seconds
Monitoring and Logging
Application Logs
External Logging
Configure external logging endpoint:Troubleshooting
Sandbox fails to load
Sandbox fails to load
Symptom: Code doesn’t execute, sandbox iframe errorsSolutions:
- Verify
SANDBOX_HOST_NAMEis on a different origin - Check DNS resolves correctly for both domains
- Ensure HTTPS is configured for both origins
- Verify ports 8090 is accessible
Share feature not working
Share feature not working
Broadcast channel errors
Broadcast channel errors
Symptom: Live broadcast doesn’t workSolutions:
- Ensure
SELF_HOSTED_BROADCAST=true - Verify broadcast port (3030) is accessible
- Check
BROADCAST_TOKENSif authentication is enabled - Verify WebSocket connections aren’t blocked
Out of memory errors
Out of memory errors
Symptom: Container crashes or restartsSolutions:
- Increase
NODE_OPTIONS=--max-old-space-size=8192 - Monitor memory usage:
docker stats - Consider horizontal scaling
- Optimize asset delivery via CDN
Upgrading
To upgrade to a new version:Data stored in Valkey persists across upgrades via the
livecodes-share-data volume.Next Steps
Docker Setup
Deep dive into Docker configuration
Services Architecture
Understand the service architecture
Security Model
Learn about security features
Performance
Optimize your deployment