Skip to main content

Infrastructure

This page covers the shared platform pieces the backend runs on — the datastore, background-job queue, rate limiting, and logging that every feature relies on. For the third-party service integrations built on top of this (S3, email, SMS, push, analytics, LiveKit, etc.), see Services. For how local/development/production deployments differ, see Deployment Environments.

Redis

Redis powers several real-time features:

UsageDetails
Online presencesetUserOnline(userId) with 5-minute TTL, renewed on each heartbeat
Chat cachechat-cache.service.js caches recent messages and conversation metadata
SMS code cacheStores OTP codes for verification with TTL
BullMQ queuesNotification worker job queue
Pub/Subpubsub.service.js powers GraphQL subscriptions via Redis pub/sub

Rate limiting

services/rate-limiter.service.js provides in-memory rate limiting for admin and API actions. Limits are defined in constants/RATE_LIMITS as { max, windowMs } pairs. In production, a Redis-backed implementation is recommended for multi-instance deployments.


Logging

services/logger/ provides a centralized structured logger used across all services and managers. Log levels: debug, info, warn, error.


Environment variables summary

VariablePurpose
REDIS_HOST / REDIS_PORT / REDIS_PASSWORDRedis + BullMQ
MAX_FAILED_LOGIN_ATTEMPTSAdmin lockout threshold

See the Services page for the env vars specific to S3, SES, SMS, analytics, and LiveKit.