How shiftwavedev/ft_transcendence works
ft_transcendence is a multiplayer game and social web application: users authenticate, find or create live Tic-Tac-Toe rooms, play over WebSockets, and review profiles, statistics, and achievements. The React client also supports chat, friends, avatars, and GDPR account tools; administrators manage users and inspect activity. Fastify routes coordinate API and real-time features, with game-room management and game engines as an internal domain layer, and Prisma-backed relational state. README capabilities guide unsampled branches; sampled excerpts chiefly confirm server registration, game-room management, and client socket behavior.
Main entry points: main.ts Fastify server · prisma.ts Relational database · main.tsx React application · router.tsx Page routing
Components 24
Web client
- React application
apps/frontend/src/main.tsx - Page routing
apps/frontend/src/router.tsx - Game lobby
apps/frontend/src/pages/GameLobbyPage.tsx - Game screen
apps/frontend/src/pages/GamePage.tsx - Game socket client
apps/frontend/src/hooks/useGameRoom.ts - Chat socket client
apps/frontend/src/hooks/useChat.ts - HTTP client
apps/frontend/src/lib/api.ts
API and identity
- Fastify server
apps/backend/src/main.ts - Auth routes
apps/backend/src/routes/auth.ts - Relational database
apps/backend/src/db/prisma.ts
Live play and social
- Game routes
apps/backend/src/routes/game.ts - Chat routes
apps/backend/src/routes/chat.ts - Room manager
apps/backend/src/services/game/GameManager.ts - Game room
apps/backend/src/services/game/GameRoom.ts - Game engines
apps/backend/src/services/game/GameEngine.ts - Friends and presence
apps/backend/src/routes/friends.ts
Profiles and admin
- Profile and avatars
apps/backend/src/routes/profile.ts - Stats and achievements
apps/backend/src/routes/stats.ts - Achievement service
apps/backend/src/services/achievements.ts - Admin routes
apps/backend/src/routes/admin/index.ts - GDPR routes
apps/backend/src/routes/gdpr.ts
Data contracts
- Shared schemas
packages/shared-types/src/index.ts
Other components
- Player
- Administrator
Connections 31
- Player → React application: uses
- Administrator → React application: manages
- React application → Page routing: renders
- Page routing → Game lobby: routes
- Page routing → Game screen: routes
- Game lobby → HTTP client: requests rooms
- Game screen → Game socket client: connects
- Game socket client → Game routes: sends moves
- Game routes → Room manager: dispatches
- Room manager → Game room: manages
- Game room → Game engines: applies moves
- Chat socket client → Chat routes: exchanges messages
- HTTP client → Fastify server: sends HTTP
- Fastify server → Auth routes: registers
- Fastify server → Game routes: registers
- Fastify server → Chat routes: registers
- Fastify server → Friends and presence: registers
- Fastify server → Profile and avatars: registers
- Fastify server → Stats and achievements: registers
- Fastify server → Admin routes: registers
- Fastify server → GDPR routes: registers
- Room manager → Relational database: persists games
- Auth routes → Relational database: stores sessions
- Profile and avatars → Relational database: reads and writes
- Friends and presence → Relational database: stores links
- Stats and achievements → Achievement service: uses
- Stats and achievements → Relational database: reads results
- Admin routes → Relational database: manages records
- GDPR routes → Relational database: exports data
- React application → Shared schemas: shares contracts
- Fastify server → Shared schemas: validates contracts