fitaiProto/apps/realtime
2026-04-03 03:25:11 +02:00
..
src chat implemented 2026-04-03 03:25:11 +02:00
.env.example chat implemented 2026-04-03 03:25:11 +02:00
package-lock.json chat implemented 2026-04-03 03:25:11 +02:00
package.json chat implemented 2026-04-03 03:25:11 +02:00
README.md chat implemented 2026-04-03 03:25:11 +02:00
tsconfig.json chat implemented 2026-04-03 03:25:11 +02:00

FitAI Realtime Service

Socket.IO service for gym room and trainer-client chat.

Setup

  1. Copy env template:
cp .env.example .env
  1. Fill required values in .env (CLERK_SECRET_KEY at minimum).

  2. Build dependencies from monorepo root (if needed) and run:

npm --prefix packages/database run build
npm --prefix apps/realtime run dev

For production:

npm --prefix apps/realtime run build
npm --prefix apps/realtime run start

Required environment variables

  • CLERK_SECRET_KEY: verifies client session token in socket handshake.
  • REALTIME_CORS_ORIGIN: comma-separated client origins.
  • REDIS_URL: enables Socket.IO Redis adapter and distributed rate limiting.
  • FITAI_DATABASE_PATH or DATABASE_PATH: explicit DB path.
  • REALTIME_PORT: server port (default 3001).
  • REALTIME_SOCKET_PATH: Socket.IO path (default /socket.io).

Notes

  • If REDIS_URL is missing, service still works with single-instance in-memory rate limits.
  • Database path resolution falls back to shared apps/admin/data/fitai.db when available.