Skip to main content

Architecture overview

High-level shape of the deployed platform.

Request path​

Host Nginx (docs/nginx/eacmlab.conf) terminates HTTPS and proxies by path:

LocationUpstream
/Client
/api/, /socket.io/, /healthServer

CORS is handled by Express only (not Nginx).

Environments and host ports​

EnvCompose fileClient host portServer host portImages
Devdocker-compose.dev.yml39000 → 300039001 → 4000Local build (target: deps)
Testdocker-compose.test.yml44000 → 300044001 → 4000ghcr.io/avier99/eacmlab-*-test-latest
Proddocker-compose.prod.yml45000 → 300045001 → 4000ghcr.io/avier99/eacmlab-*-prod-latest

Public hostnames: eacmlab.org (prod), test.eacmlab.org (test). Docs will use docs.eacmlab.org on port 46000 (separate compose/image — see Deployment overview).

Process roles​

ProcessResponsibility
ClientUI for participants and admins; App Router pages; Socket.IO client
ServerREST under /api, Socket.IO game/room/survey/admin events, Prisma writes
PostgresAll durable experiment and admin data (DATABASE_URL)

Server container entrypoint always runs migrations before listen:

npx prisma migrate deploy
exec node index.js

Realtime vs HTTP​

  • HTTP: auth, experiment metadata, surveys, admin CRUD, export jobs, health
  • Socket.IO: rooms, foraging rounds, arithmetic, live admin monitor, simulations, session restore

See Realtime sockets and Game engine.

Auth (summary)​

Admin HTTP routes use JWT middleware (requireAdminAuth). Participant flow uses session tokens restored over Socket.IO. The client lists next-auth in package.json but does not import or use it — ignore it for architecture docs.