From f3332bde46d52da4e96b02cd73575f5ee8c23544 Mon Sep 17 00:00:00 2001 From: jbaumfal Date: Tue, 11 Aug 2026 19:21:47 +0200 Subject: [PATCH] Improved Makefile: - adjusted Makefile form so it alines with requirements in the subject - added additional information on Team contributions & project management --- README.md | 285 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 191 insertions(+), 94 deletions(-) diff --git a/README.md b/README.md index 9c721bf..2c5ace2 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **Goal:** The goal of this project is to build a fully functional, real-time multiplayer web application from scratch, focusing on modern web development practices, security, and real-time data synchronization. -**Overview:** Overview: Culture Quiz is an interactive real-time trivia platform featuring competitive PvP matches, an adaptive AI opponent, a four-player tournament mode, persistent progression, achievements, live chat and comprehensive player statistics. The platform emphasizes a seamless user experience, secure authentication, and robust real-time communication. +**Overview:** Culture Quiz is an interactive real-time trivia platform featuring competitive PvP matches, an adaptive AI opponent, a four-player tournament mode, persistent progression, achievements, live chat and comprehensive player statistics. The platform emphasizes a seamless user experience, secure authentication, and robust real-time communication. **Key Features:** * Real-time 1v1 multiplayer quiz matches; 1vAI, Tournament Mode. @@ -21,84 +21,138 @@ # Instructions ## Prerequisites -* **Docker** & **Docker Compose** installed on your machine. -* A registered 42 API or Github application (for OAuth). +* **Docker** (or **Podman** with the docker-compose compatibility layer) & **Docker Compose v2** +* **GNU Make** +* **OpenSSL** (used to generate the self-signed TLS certificates — invoked automatically by `make`) +* A registered **42 API** and/or **GitHub OAuth** application (for remote authentication) + ## Setup & Configuration 1. **Clone the repository:** - ```bash +```bash git clone cd ft_transcendence - ``` -2. **Environment Variables:** - Create a `.env` file at the root of the project by copying the provided example template: - ```bash - cp .env.example .env - ``` - *Make sure to fill in your `FORTYTWO_CLIENT_ID`, `FORTYTWO_CLIENT_SECRET`, database credentials, and JWT secrets in the `.env` file.* - -## Execution -Run the following command at the root of the project to build and start the containers: +``` +2. **Generate the configuration files:** +```bash + make env +``` + This creates two files (only if they don't exist yet): + * `.env` — copied from `.env.example`. Open it and fill in: + * `FORTYTWO_CLIENT_ID` / `FORTYTWO_CLIENT_SECRET` (42 OAuth) + * `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` (GitHub OAuth) + * `POSTGRES_USER` / `POSTGRES_PASSWORD` (database credentials) + * `JWT_SECRET` (session signing — set a strong random value) + * `GRAFANA_ADMIN_USER` / `GRAFANA_ADMIN_PASSWORD` (monitoring dashboard login) + * `HTTPS_PORT=8443` — **required on rootless Podman** (e.g. 42 school machines), where binding the privileged port 443 is not allowed. On Docker Desktop you can leave it unset (defaults to 443). + * `monitoring/alertmanager/discord_webhook_url` — copied from its `.example`. Paste your Discord webhook URL into it to receive monitoring alerts (the file is gitignored). + + TLS certificates are generated automatically on first start; no manual step is needed. + +## Execution (production mode) +Build and start the full stack in the background with a single command: ```bash make up ``` -Once the containers are running, access the application in your browser at: `https://localhost:8443` (or your configured port). +Then open the application at **https://localhost** (or **https://localhost:8443** if you set `HTTPS_PORT=8443`). The certificate is self-signed, so your browser will show a warning — this is expected. + +The Grafana monitoring dashboard is available at **https://localhost/grafana/** using the credentials from your `.env`. + +Stop the stack with `make down` (keeps the database), or `make re` to restart from scratch. + +## Development mode +```bash +make dev +``` +Runs the stack in the foreground with hot reload: the source code is bind-mounted into the containers, the frontend runs the Vite dev server, and the backend runs NestJS in watch mode. Database migrations are applied automatically on startup. Prometheus (`127.0.0.1:9090`) and Alertmanager (`127.0.0.1:9093`) are additionally exposed on localhost for debugging — in production mode they stay internal to the Docker network. Stop with `Ctrl+C` and `make dev-down`. + +## Useful commands +| Command | Description | +| :--- | :--- | +| `make up` / `make down` | Start / stop the production stack | +| `make dev` / `make dev-down` | Start / stop the development stack (hot reload) | +| `make migrate` | Apply pending database migrations (production) | +| `make studio` | Open Prisma Studio to browse the database | +| `make logs` | Tail the logs of all services | +| `make ps` | List running containers | +| `make clean` | Stop everything and remove volumes (**wipes the database**) | +| `make fclean` | Full clean: also removes certificates and prunes Docker images | +| `make help` | List all available targets | --- # Resources -**References & Documentation:** +## References & Documentation + +**Core stack:** * [React Documentation](https://react.dev/) * [NestJS Documentation](https://docs.nestjs.com/) +* [Prisma ORM Documentation](https://www.prisma.io/docs) * [Socket.io Documentation](https://socket.io/docs/v4/) -* [Prisma ORM](https://www.prisma.io/docs) -* [TailwindCSS](https://tailwindcss.com/docs) -* [TriviaDB](https://opentdb.com/) - -**AI Usage:** -* **Gemini / ChatGPT / Claude:** AI tools were used during development primarily for debugging complex React hook dependencies, scaffolding boilerplate code for TailwindCSS styling (e.g., the chat and profile UI), and generating the initial drafts for our legal pages (Privacy Policy and Terms of Service) to ensure appropriate verbiage. AI was not used to write the core game logic or backend architecture, but it help to imagine it as best and avoid errors. - +* [TailwindCSS Documentation](https://tailwindcss.com/docs) +* [The Trivia API](https://the-trivia-api.com/) — question source for the quiz engine + +**Infrastructure:** +* [Docker Compose Documentation](https://docs.docker.com/compose/) +* [nginx Documentation](https://nginx.org/en/docs/) — reverse proxy and SSL termination + +**Authentication (42 / GitHub OAuth, 2FA):** +* [GitHub Docs — Creating an OAuth App](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) +* [42 API Documentation](https://api.intra.42.fr/apidoc) — OAuth application registration +* [Passport.js Documentation](https://www.passportjs.org/docs/) with the [passport-42](https://www.npmjs.com/package/passport-42) and [passport-github2](https://www.npmjs.com/package/passport-github2) strategies +* [otplib](https://www.npmjs.com/package/otplib) — TOTP generation for 2FA + +**Monitoring (Prometheus / Grafana / Alertmanager):** +* [Prometheus — Getting Started & Configuration](https://prometheus.io/docs/prometheus/latest/getting_started/) +* [PromQL Basics](https://prometheus.io/docs/prometheus/latest/querying/basics/) +* [prom-client](https://github.com/siimon/prom-client) — Node.js Prometheus client used in the backend +* [Grafana Provisioning](https://grafana.com/docs/grafana/latest/administration/provisioning/) — datasources and dashboards as code +* [Run Grafana behind a reverse proxy](https://grafana.com/tutorials/run-grafana-behind-a-proxy/) — subpath setup under nginx +* [Alertmanager Configuration](https://prometheus.io/docs/alerting/latest/configuration/) — Discord webhook routing +* [postgres-exporter](https://github.com/prometheus-community/postgres_exporter) & [nginx-prometheus-exporter](https://github.com/nginx/nginx-prometheus-exporter) +* Tutorial: [Monitoring a Node.js/TypeScript app with prom-client (webdevtutor.net)](https://www.webdevtutor.net/) — starting point for the backend metrics service, adapted for NestJS + +## AI Usage + +AI assistants (Claude, ChatGPT, Gemini) were used as development support tools. Specifically: + +* **Debugging assistance:** diagnosing infrastructure issues such as Docker/Podman environment differences, Prisma migration conflicts, and complex React hook dependencies. +* **Boilerplate & styling:** scaffolding TailwindCSS layout code for UI components (e.g., chat and profile pages) and generating the initial drafts of the legal pages (Privacy Policy, Terms of Service). +* **Code review:** a read-only AI-assisted audit of the repository was run late in the project to identify bugs and gaps against the subject requirements before evaluation. + +The core game logic, the real-time game engine, the backend architecture, and the database schema were designed and written by the team. Every team member is able to explain and modify the code in their area of responsibility. --- # Team Information -### espinto- (Tech Lead) -* **Contributions:** - * Set up the project's initial backend scaffolding and architecture. - * Engineered the Two-Factor Authentication (2FA TOTP) integration with JWT sessions and built its enrollment UI. - * Fixed core frontend routing, session persistence (logout clearing), and state synchronization (username updates). - * Resolved infrastructure bugs, including Docker certificate read rights and profile data persistence after database wipeouts. -* **Challenges:** Ensuring secure JWT session handling alongside TOTP 2FA, and maintaining stable CI/CD pipelines across differing Node versions and Docker environments. -* **Overcome:** Successfully integrated `otplib` for strict 2FA validation and structured the GitHub workflows and Docker permissions to guarantee secure, reliable deployments. -### namalier - Product Owner (PO) & Game Engine Developer** - * *Responsibilities:* - * Defined the overall gameplay design and project roadmap. - * Designed and implemented the complete real-time quiz game engine. - * Developed the complete 1v1 matchmaking system using WebSockets. - * Designed and implemented the AI game mode with adaptive behaviour based on question difficulty and player actions. - * Designed and implemented the complete Tournament Mode (4-player brackets, semi-finals, finals, automatic progression and champion selection). - * Implemented the complete game state synchronization between frontend and backend. - * Developed the timer system, answer synchronization and game flow. - * Designed and implemented the bonus system (3 Choices, Hide Answer and Double Points) and their synchronization. - * Implemented the complete scoring, streak and winner determination logic, including tie-breaking based on total answering time. - * Integrated the Trivia API and question management. - * Designed and maintained the event-driven communication protocol between frontend and backend. - * Fixed multiplayer synchronization issues, disconnect handling, forfeits and edge cases. -### elsikira - Scrum Master (PM) & FullStack Dev** - * *Responsibilities:* -### ncrivell - DB Master & Backend Developer** - * *Responsibilities:* * -### jbaumfal - DevOps Developer** - * *Responsibilities:* +### namalier — Product Owner (PO) & Game Engine Developer +* **Responsibilities:** Product vision, gameplay design, and feature prioritization. Owner of the real-time game engine: matchmaking, game state synchronization, AI opponent, tournament mode, scoring, and the bonus system. + +### elsikira — Scrum Master (PM) & Fullstack Developer +* **Responsibilities:** Team coordination, sprint planning, and blocker management. Owner of the infrastructure entry point (nginx reverse proxy, Docker Compose configurations) and of frontend integration work: authentication flow on the client side, global chat, and the legal pages. + +### espinto- — Technical Lead & Auth Developer +* **Responsibilities:** Technical architecture decisions and code quality. Initial backend scaffolding, the 2FA (TOTP) system with the JWT session model, CI workflows, and cross-cutting frontend fixes (routing, session persistence). + +### ncrivell — Database Lead & Backend Developer +* **Responsibilities:** Owner of the Prisma schema and all database migrations. Backend feature development: user registration, tournament persistence, statistics API, gamification (XP, badges, leaderboard), and GDPR data export/import. + +### jbaumfal — DevOps Developer & Project Management Support +* **Responsibilities:** Design, implementation, and documentation of the monitoring stack (Prometheus, Grafana, Alertmanager, exporters); backend metrics instrumentation; GitHub OAuth integration; setup and maintenance of the team's Notion project management system (task, bug, and module databases). --- # Project Management +* **Work Organization:** + * Work was structured through a shared **Notion workspace** built around three linked databases: + * **Task Management Database:** Every feature and infrastructure task is tracked with an assignee, a status ("To Do" / "In Progress" / "Done"), and a deadline, giving the whole team a live view of who is working on what. + * **Bug Tracking Database:** Bugs discovered during development or testing are logged with a description, severity, owner, and fix status, so nothing gets lost between Discord messages and regressions can be traced back to their fix. + * **Module Database:** All claimed subject modules (Major/Minor) are listed with their point value, implementation status, and responsible team member(s), so the team always knows how many points have been secured and how far we are from the 14-point minimum. + * Task distribution followed ownership areas (game engine, backend/DB, auth, infrastructure/DevOps) agreed on in a shared roadmap, with regular Discord syncs to resolve blockers. -* **Work Organization:** * **Tools Used:** - * **Notions:** Used write a roadmap and to track "To Do", "In Progress", and "Done" tasks. + * **Notion:** As described above * **Figma:** Used for initial UI/UX wireframing. * **Communication Channels:** * **Discord:** Primary channel for daily stand-ups, voice calls, and quick debugging sessions. @@ -113,8 +167,12 @@ Once the containers are running, access the application in your browser at: `htt * *Justification:* NestJS enforces a clean, modular, and highly testable architecture out of the box. Socket.io is industry-standard for handling WebSocket connections with built-in fallback polling. * **Database System:** PostgreSQL. * *Justification:* Chosen for its strong relational integrity, reliability, and excellent compatibility with Prisma ORM. Our data (users, matches, stats, chat) is highly relational, making a SQL database the optimal choice over NoSQL. -* **Other Significant Technologies:** Prisma (ORM for database interactions), Grafana. - +* **Other Significant Technologies:** + * **Prisma** — type-safe ORM handling all database access and schema migrations. + * **nginx** — reverse proxy in front of the whole stack, handling SSL termination (self-signed certificates), routing of `/api/`, `/ws/`, and `/grafana/`, and keeping internal services (backend `/metrics`, Prometheus, Alertmanager) unreachable from outside. + * **Docker Compose** — full container orchestration with a production configuration and a development override (hot reload, bind mounts), driven by a Makefile. Compatible with rootless Podman on 42 school machines. + * **Prometheus, Grafana & Alertmanager** — metrics collection, dashboards, and automated alerting (see the Monitoring module). + * **Passport.js & JWT (httpOnly cookies)** — authentication strategies (42, GitHub) and stateless session handling. --- # Database Schema @@ -126,7 +184,7 @@ Our database relies on a robust relational PostgreSQL model mapped via Prisma. H * *Relationships:* One-to-many relationships with `GlobalMessage` (chat), `Friendship` (sent/received), `RoomParticipant` (game history), and `UserBadge`. * **Game Sessions (`Room` & `Tournament`):** - * *Key fields:* `id` (String/UUID), `mode` (Enum: SOLO, DUEL, TOURNAMENT), `status` (Enum: WAITING, IN_PROGRESS, FINISHED), `round` (Enum: QUARTER_FINAL, SEMI_FINAL, FINAL — tournament rooms only). + * *Key fields:* `id` (String/UUID), `mode` (Enum: SOLO, DUEL, TOURNAMENT), `status` (Enum: WAITING, IN_PROGRESS, FINISHED), `round` (Enum: SEMI_FINAL, FINAL — tournament rooms only). * *Relationships:* A `Tournament` contains multiple `Room` entities and links to its `champion` (RoomParticipant). A `Room` has many `RoomParticipant`s and `RoomQuestion`s (ordered), links to an optional `winner` participant (null = draw), and to a `nextRoom` (self-relation: the winner advances through the bracket). * **Answers (`Answer`):** @@ -174,99 +232,139 @@ Our database relies on a robust relational PostgreSQL model mapped via Prisma. H # Modules -# Modules +Our team has implemented the following modules. The subject requires a minimum of **14 points** (Major = 2 pts, Minor = 1 pt); modules beyond that count toward the bonus (capped at +5). -Based on the project requirements, our team has implemented the following Major and Minor modules, totaling **16 points**: +**Point calculation: 6 Major × 2 pts + 9 Minor × 1 pt = 21 points claimed** (14 mandatory + up to 5 bonus + 2 buffer). ### Major Modules (2 pts each) +* **Major: Use a framework for both the frontend and backend.** + * *Justification:* A component-based frontend and a modular backend framework are the foundation every other module builds on. + * *Implementation:* React 19 + Vite on the frontend, NestJS on the backend, both fully in TypeScript. + * *Contributors:* `elsikira, ncrivell, espinto-` + +* **Major: Implement real-time features using WebSockets.** + * *Justification:* Beyond the game itself, the platform has real-time features that update across clients: the global chat, live player status, and live statistics/leaderboard updates on profile pages. + * *Implementation:* A Socket.IO gateway (`/ws/`) proxied through nginx handles connection lifecycle, room-based broadcasting, and event routing; identity is bound to the socket at handshake time via the JWT cookie. + * *Contributors:* `namalier, ncrivell, elsikira` + * **Major: Implement a complete web-based game where users can play against each other.** - * *Justification:* Core requirement for the platform's PvP aspect. - * *Implementation:* Designed a real-time multiplayer trivia quiz engine with strict rules, synchronized timers, and clear win/loss conditions based on score and response time. + * *Justification:* The core of the platform — a live PvP experience with clear rules and win/loss conditions. + * *Implementation:* Real-time multiplayer trivia engine: 8 synchronized questions per match, server-side timers, score tracking, and a tie-breaker based on total response time. * *Contributors:* `namalier` -* **Major: Remote players (Real-time network play).** - * *Justification:* Ensures the game is playable across different machines over the internet. - * *Implementation:* Utilized `Socket.io` WebSockets to handle matchmaking, real-time event synchronization, and implemented robust logic to handle player disconnections, forfeits, and reconnections. +* **Major: Remote players.** + * *Justification:* Two players on separate computers must be able to play the same match in real time. + * *Implementation:* WebSocket-based matchmaking and event synchronization keep both clients in lockstep; disconnections are detected server-side and handled as forfeits with the match result persisted. * *Contributors:* `namalier, ncrivell` -* **Major: Introduce an AI Opponent for games.** - * *Justification:* Allows users to play and practice when other human players are offline. - * *Implementation:* Built a "1vAI" mode where an AI opponent plays against the user. The AI features adaptive timing behavior and non-perfect play to simulate human-like difficulty. +* **Major: Introduce an AI Opponent.** + * *Justification:* Lets users play and practice when no human opponent is available. + * *Implementation:* A server-side bot with difficulty-scaled accuracy and randomized, human-like answer delays; it reacts to the opponent answering early by accelerating its own turn. * *Contributors:* `namalier` * **Major: Monitoring system with Prometheus and Grafana.** - * *Justification:* Critical for DevOps reliability, allowing us to monitor server health and bottlenecks in real-time. - * *Implementation:* Configured Prometheus as a Docker service to collect metrics via PostgreSQL and Nginx exporters. Created a custom Grafana dashboard with an automated alerting system for system status. + * *Justification:* Gives the team live visibility into the health of every layer of the stack and automated notification when something breaks. + * *Implementation:* Prometheus scrapes the instrumented NestJS backend (`prom-client`: HTTP latency histogram, WebSocket gauge, games counter), `postgres-exporter`, and `nginx-exporter` over the internal network. Grafana is provisioned as code (datasource + custom dashboard) and served behind nginx under `/grafana/` with authentication. Alert rules (backend down, DB down, error rate, latency) fire through Alertmanager into the team Discord. * *Contributors:* `jbaumfal` ### Minor Modules (1 pt each) +* **Minor: Use an ORM for the database.** + * *Justification:* Type-safe database access and versioned schema migrations across the whole team. + * *Implementation:* Prisma with PostgreSQL; all schema changes tracked as migrations and applied automatically inside the backend container on startup. + * *Contributors:* `ncrivell, elsikira` + * **Minor: Implement remote authentication with OAuth 2.0.** - * *Justification:* Provides secure, passwordless onboarding for developers and users. - * *Implementation:* Integrated both the **42 API** and **GitHub API** for OAuth login, linked directly to the PostgreSQL user database via JWT sessions. + * *Justification:* Secure, passwordless onboarding through providers our users already have. + * *Implementation:* 42 API and GitHub OAuth via Passport strategies, with a three-stage identity resolution (provider ID → email-based account linking → new account creation) to prevent duplicate accounts, issuing JWT httpOnly cookies. * *Contributors:* `elsikira, jbaumfal` * **Minor: Implement a complete 2FA (Two-Factor Authentication) system.** - * *Justification:* Adds a critical layer of security to user accounts. - * *Implementation:* Used `otplib` and `qrcode` to generate Time-based One-Time Passwords (TOTP). Users scan the QR code via Google Authenticator to securely log in. + * *Justification:* A second authentication factor protecting user accounts. + * *Implementation:* TOTP via `otplib` with QR-code enrollment (Google Authenticator compatible) and a pending-vs-full JWT split so a 2FA-enabled login is only completed after code verification. * *Contributors:* `espinto-, elsikira` * **Minor: Game statistics and match history.** * *Justification:* Tracks player progression and performance over time. - * *Implementation:* Created a live dashboard fetching data from Prisma to display games played, wins/losses, average response times, and a detailed 1v1 match history. + * *Implementation:* Per-user dashboard showing games played, wins/losses, response times, and a detailed match history, fed from persisted `Room`/`Answer` records via Prisma. * *Contributors:* `ncrivell, namalier` * **Minor: A gamification system to reward users.** - * *Justification:* Enhances user retention and provides goals. - * *Implementation:* Developed a fully persistent progression system featuring XP tracking, User Levels, Achievement Badges stored in the DB, and a global Leaderboard. + * *Justification:* Retention and goals beyond individual matches. + * *Implementation:* Persistent XP and levels, achievement badges awarded on match completion, and a global leaderboard. * *Contributors:* `ncrivell` * **Minor: Implement a tournament system.** - * *Justification:* Enables competitive multiplayer events beyond simple 1v1 duels. - * *Implementation:* Built a 4-player tournament bracket system with automatic matchmaking, semi-finals, finals, and automatic progression for the champions. + * *Justification:* Competitive multiplayer events beyond 1v1 duels. + * *Implementation:* 4-player bracket (two semi-finals → final) with matchmaking queue, automatic progression of winners, and champion persistence in the database. * *Contributors:* `namalier, ncrivell` -* **Minor: Game customization options (Power-ups / Abilities).** - * *Justification:* Adds dynamic depth and strategy to the core trivia gameplay. - * *Implementation:* Engineered an interactive bonus/malus system during matches, including abilities like "3 Choices", "Hide Answer", and "Double Points". +* **Minor: Game customization options.** + * *Justification:* Adds strategic depth and personalization to the core gameplay. + * *Implementation:* Three visual themes, music toggle and volume settings, plus streak-driven power-ups computed server-side ("3 Choices", "Hide Answer", "Double Points"). * *Contributors:* `namalier` * **Minor: Data export and import functionality.** - * *Justification:* Ensures users have ownership of their data (GDPR compliance) and admins can easily manage game content. - * *Implementation:* Allows users to export their profile and match data as JSON, CSV, or PDF via JWT validation. Added a bulk validated question import feature for the database. + * *Justification:* Users own their data; admins can manage game content in bulk. + * *Implementation:* JWT-guarded export of profile and match data as JSON, CSV, or PDF, and a validated bulk question import for administrators. * *Contributors:* `ncrivell` * **Minor: Advanced chat features.** - * *Justification:* Enhances the basic global chat to be more interactive and persistent. - * *Implementation:* Added persistent chat history saved via Prisma, real-time avatars, and the ability to click on any user's name in the chat to instantly route to their public profile. + * *Justification:* Extends the basic global chat into a persistent, social feature. + * *Implementation:* Chat history persisted via Prisma, real-time avatars, and direct access to user profiles from the chat interface. * *Contributors:* `elsikira` -**Total Points Claimed: 16 pts (8 Major + 8 Minor)** - --- # Individual Contributions ### espinto- -* **Contributions:** -* **Challenges:** -* **Overcome:** +* **Contributions:** + * Set up the project's initial backend scaffolding and architecture. + * Engineered the Two-Factor Authentication (2FA TOTP) integration with JWT sessions and built its enrollment UI. + * Fixed core frontend routing, session persistence (logout clearing), and state synchronization (username updates). + * Resolved infrastructure bugs, including Docker certificate read rights and profile data persistence after database wipeouts. +* **Challenges:** Ensuring secure JWT session handling alongside TOTP 2FA, and maintaining stable CI/CD pipelines across differing Node versions and Docker environments. +* **Overcome:** Successfully integrated `otplib` for strict 2FA validation and structured the GitHub workflows and Docker permissions to guarantee secure, reliable deployments. ### elsikira * **Contributions:** + * Built and maintained the infrastructure entry point: nginx reverse proxy configurations (production and development) with SSL termination and routing for `/api/`, `/ws/`, and `/grafana/`, and the Docker Compose dev-override setup enabling hot reload through the proxy. + * Implemented the frontend side of the authentication flow (login page, OAuth redirects, session handling) and CORS/proxy configuration between frontend and backend. + * Developed the global real-time chat with persistent history, avatars, and profile links, and wrote the Privacy Policy and Terms of Service pages. + * Coordinated the team as Scrum Master: Discord syncs, deadline tracking, and unblocking teammates. * **Challenges:** -* **Overcome:** + * Making one nginx/Compose setup behave identically on Docker Desktop and rootless Podman at school, where binding the privileged port 443 is impossible and container DNS behaves differently. + * Getting Vite hot reload and WebSocket connections to work reliably through the reverse proxy in development. +* **Overcome:** + * Introduced a configurable `HTTPS_PORT` and a dev-specific nginx configuration, and kept dev/prod differences isolated in a Compose override file so the production setup stays untouched. + * Configured dedicated proxy rules for WebSocket upgrades and file-change polling for bind mounts, making the dev loop stable for the whole team. ### ncrivell -* **Contributions:** Built the Database tables (...). -* **Challenges:** +* **Contributions:** + * Designed and owned the complete Prisma schema and its migration history: users, game sessions (rooms, tournaments, participants, questions, answers), social models, and gamification tables. + * Implemented user registration with Argon2 password hashing and contributed to the WebSocket gateway foundation. + * Built the statistics backend (games played, win/loss, response times, match history) and the gamification system (XP, levels, achievement badges, global leaderboard). + * Implemented GDPR data management: user data export as JSON/CSV/PDF and validated bulk question import for administrators. + * Developed the tournament persistence layer (brackets, rounds, champion tracking) together with namalier. +* **Challenges:** + * Evolving a shared database schema while multiple features were developed in parallel branches, which caused migration drift when schema changes landed without their corresponding migration files. + * Modeling game data that has to serve very different consumers — live gameplay, historical statistics, and tournaments — without duplication. * **Overcome:** + * Established migrations as the single source of truth, always generated and applied inside the backend container, and reconciled drifted branches by regenerating migrations against the merged schema. + * Designed the Room/RoomParticipant/Answer model so that 1v1 matches, AI games, and tournament rounds all persist through the same structures. + ### jbaumfal -* **Contributions:** +* **Contributions:** + * **DevOps — Monitoring module (Major):** Implemented the full observability stack. Instrumented the NestJS backend with `prom-client` (HTTP request duration histogram via a global interceptor, live WebSocket connection gauge, games-started counter) exposed on an internal `/metrics` endpoint deliberately excluded from the public `api/` prefix so nginx never proxies it externally. Configured Prometheus to scrape the backend, `postgres-exporter`, and `nginx-exporter` (stub_status), wrote the alerting rules (backend down, database down, high 5xx rate, high latency), and connected Alertmanager to the team Discord via webhook. Provisioned Grafana as code (datasource + custom dashboard JSON) behind nginx under `/grafana/`, so the entire monitoring setup survives a full volume wipe and rebuilds identically from the repository. + * **GitHub OAuth:** Implemented the GitHub OAuth 2.0 login flow (Passport strategy) integrated into the existing 42 OAuth architecture, including a three-stage identity resolution (provider ID match → email-based account linking → new account creation). + * **Project Management:** Built the team's Notion workspace with three databases (task management, bug tracking, module/points tracking) that structured the team's daily coordination. * **Challenges:** + * Prometheus refused to scrape the backend because the whole stack runs behind self-signed TLS; Grafana produced redirect loops when served under an nginx subpath; the provisioned dashboard broke after every `make fclean` because Grafana's exported JSON embeds runtime folder metadata; and the stack had to behave identically under Docker Desktop and rootless Podman, which lack the same embedded DNS. * **Overcome:** + * Configured the scrape jobs with TLS settings appropriate for self-signed certificates, fixed the subpath serving with Grafana's root-URL/subpath options, established a rule of stripping runtime annotations from every exported dashboard JSON before committing, and made nginx resolve optional upstreams lazily so the proxy starts cleanly regardless of container start order or runtime. ### namalier @@ -304,4 +402,3 @@ Based on the project requirements, our team has implemented the following Major This project adheres to data protection requirements. Please review our policies located in the application footer: * **[Privacy Policy](/privacy):** Details data collection regarding user profiles and game history. * **[Terms of Service](/tos):** Outlines user behavior expectations in the chat and game environments. -```