Getting started
Everything you need to run the demo locally or deploy it to production.
Prerequisites
- Node.js >= 20
- Docker (for Postgres and Redis, or bring your own)
Install
npm install Configure
Copy the example env file:
cp .env.example .env The defaults point at localhost which works if Postgres and Redis are running in Docker on standard ports.
Create the database
psql $DATABASE_URL -f schema.sql The last_activity column is auto-migrated on startup if missing.
Dev mode
npm run dev If DATABASE_URL is not set, the app falls back to an in-memory store. You can develop without Postgres or Redis - all realtime features still work locally, just not across multiple server instances.
Production build
npm run build
npm start Deploy with Docker Compose
The included docker-compose.yml sets up everything: app, Postgres, Redis, and a certbot container for automatic Let’s Encrypt TLS. HTTPS out of the box, no reverse proxy.
The app runs as 2 independent replicas using network_mode: host and SO_REUSEPORT. The Linux kernel distributes incoming connections across both processes. Redis handles cross-process pub/sub.
Steps
Point a domain at your server (A record)
Create a
.envfile:
DOMAIN=your-domain.com
POSTGRES_PASSWORD=pick-a-strong-password - Get the initial certificate:
docker compose run --rm certbot certonly --standalone -d your-domain.com - Start everything:
docker compose up -d The app listens on port 443 directly (host networking). Certbot renews automatically every 12 hours. Postgres and Redis data are persisted in Docker volumes.
Scaling replicas
docker compose up -d --scale app=4 Was this page helpful?