How mtlks/ft_transcendence works
Overall Project Type & Purpose
• This is a full-stack application that appears to be a social/gaming platform. The backend is built using NestJS (as seen by files like nest-cli.json, multiple modules, and extensive use of controllers, services, and DTOs) while the frontend is a React application created with Vite.
• The project supports features such as user authentication (including Google OAuth and two-factor authentication), live chat (with dedicated chat gateways and controllers), gaming functionalities (entities and components for game rooms, players, and real-time game events for Pong and related mini-games), friend management, matchmaking, and leaderboards.
• Deployment is supported via Docker and docker-compose, which implies containerization is part of the overall strategy.
Analyzing the File Structure for Architectural Clues
• Top-level Directories:
– “backend”: Contains the NestJS server code with modules for auth, chat, friendship, game, leaderboard, match, status, TFA, and user-related functionalities. Notice a clear modular design for different application domains.
– “frontend”: Contains a React/Vite codebase set up with TypeScript. It includes dedicated directories for pages, components, widgets, and game logic, clearly separating presentation and business logic.
– Other directories include configuration files (e.g., .github, db_admin, Dockerfile, docker-compose.yml), which support CI/CD and local development.
• Architectural Patterns:
– The backend follows NestJS’s modular architecture (using modules, controllers, services, DTOs, and entities). The presence of Gateway files in modules like chat, friendship, game, and status suggests the use of WebSockets for real-time communication.
– The frontend structure separates UI components, API integration, contexts, and even specialized game logic, which reflects a component-based and context-driven design.