Self-hosting
YACS ships as one container. A single Node.js process on one port serves:
- the built web app (static files with long-lived caching for
/_static/*) - the HTTP API under
/api - Socket.IO under
/socket.io - the PeerJS signalling server under
/app - uploaded media
You provide MongoDB, Redis, a persistent volume for media and, for production, HTTPS.
Docker image
Images are published to the GitHub Container Registry on every release:
docker pull ghcr.io/yacs-app/yacs:latest
Tags follow semver (1.4.2, 1.4) and latest tracks the newest non-prerelease. You can also build it yourself from the repository root with docker build -t yacs ..
The image runs as the unprivileged node user, listens on port 3000, and has a built-in health check against GET /api/health.
Docker Compose
services:
yacs:
image: ghcr.io/yacs-app/yacs:latest
restart: unless-stopped
ports:
- "3000:3000"
environment:
APP_KEY: ${APP_KEY} # openssl rand -base64 48
APP_URL: https://chat.example.com
COOKIE_SECURE: "true"
DB_URL: mongodb://mongo/yacs
CACHE_URL: redis://redis
# GOOGLE_AUTH_CLIENT: your-client-id.apps.googleusercontent.com
volumes:
- media:/app/public/media
depends_on: [mongo, redis]
mongo:
image: mongo:8
restart: unless-stopped
volumes:
- mongo:/data/db
redis:
image: redis:7
restart: unless-stopped
volumes:
media:
mongo:
APP_KEY="$(openssl rand -base64 48)" docker compose up -d
Keep
APP_KEYstable. Changing it invalidates every session and anything derived from it.
Behind a reverse proxy
Serve YACS over HTTPS — service workers, push notifications, camera/microphone access and geolocation all require a secure context.
Proxy everything to port 3000 and make sure WebSocket upgrades are forwarded (Socket.IO and the PeerJS server both use them). TRUST_PROXY is on by default so client IPs and protocol are read from X-Forwarded-* headers.
Example with Caddy:
chat.example.com {
reverse_proxy yacs:3000
}
Example with nginx:
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Then set APP_URL to the public URL and COOKIE_SECURE=true.
TURN for calls
Calls and peer-to-peer transfers use public Google STUN servers by default, which is enough for most networks. Users behind symmetric NATs or strict firewalls need a TURN relay. YACS issues short-lived credentials using the coturn shared-secret (use-auth-secret) scheme:
TURN_URLS=turn:turn.example.com:3478,turns:turn.example.com:5349
TURN_SECRET=the-same-value-as-coturn-static-auth-secret
# TURN_TTL_SECONDS=86400
Both TURN_URLS and TURN_SECRET must be set for TURN to be offered.
Google sign-in (optional)
Create an OAuth Web client in Google Cloud Console (APIs & Services → Credentials), add your public URL as an authorised JavaScript origin, and set GOOGLE_AUTH_CLIENT to the client ID. Without it the sign-in button is hidden and /api/login/google responds 503.
Backups
Back up the MongoDB database and the media volume (/app/public/media). Redis holds only cache, presence and rate-limit data and can be lost safely.