Skip to content

Aziz018/ft_transcendence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

118 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Project Cover

Built with the tools and technologies:

Express Fastify JSON Markdown Lucide npm TOML Prettier esbuild .ENV JavaScript pino EJS Vitest Nodemon GNU%20Bash Ajv
React Docker TypeScript tsnode Prisma Zod Vite ESLint Axios CSS Jest YAML React%20Router


Table of Contents


Overview

ft_transcendence a comprehensive, real-time web application that brings the classic Pong experience into the modern era. Designed with a focus on concurrency, scalability, and user experience, this platform is more than just a game; it's a full-featured social ecosystem.

The project integrates real-time WebSockets for instantaneous gameplay and chat, secure authentication with 2FA, and a comprehensive monitoring stack to ensure 99.9% uptime and performance reliability.


Team Members

Name GitHub Role Responsibilities
Mustapha Elfersioui @BL4KCY Project Manager / DevOps Infrastructure, Monitoring (ELK/Grafana), Docker, Project Coordination
Aziz Elkhetabi @Aziz018 Product Owner / Backend Database Design, API Architecture, Social Hub Logic
Hamza Mouhib @itsLhaj Backend Team Lead Security (JWT/2FA), Core Backend Logic, API Documentation
Hamza Barda @N308-ui Backend / Game Real-time Game Engine, WebSocket Synchronization, Matchmaking
Ibnoukhalkane Zakaria @Ibnoukhalkanezakaria Frontend Developer UI/UX Design, React Architecture, State Management, Styling

Project Management

Our team adopted an Agile-inspired approach to manage the development of Pong Rush.

  • Tools:
    • Notion: Centralized task board for tracking features, bugs, and documentation.
    • Discord: Daily sync-ups and real-time troubleshooting.
  • Workflow:
    • Branching Strategy: Strict feature/ branch model. No direct commits to dev or master.
    • Code Reviews: Every Pull Request required a peer review to maintain code quality.
    • Automation: Dockerized environments ensured seamless integration between front-end and back-end modules.

Features

๐ŸŽฎ The Arena (Core Gameplay) - Implemented by @N308-ui

  • Real-time Multiplayer: Low-latency Pong matches powered by WebSockets.
  • Dual Mode Support:
    • Local Play: Battle friends on the same machine.
    • Remote Play: Matchmaking system for global challenges.
  • AI Contender: An intelligent bot system for solo practice and skill-building.
  • Live Game Synchronization: Seamless state management across all connected clients.

๐Ÿ’ฌ Social Hub (Chat & Community) - Implemented by @Aziz018

  • Dynamic Chat Rooms: Create, join, and manage public or password-protected channels.
  • Direct Messaging (DMs): Private, secure communication between users.
  • Moderation Tools: Admin capabilities including kicking, banning, and promoting members.
  • Live Status Tracking: Real-time "Online/Offline/In-Game" status indicators.
  • Friend System: Manage relationships, block intruders, and invite friends to matches.

๐Ÿ” Security & Identity - Implemented by @itsLhaj

  • Multi-Strategy Auth: Support for traditional credentials and OAuth2 (42 & Google).

  • Advanced Protection:

    • Two-Factor Authentication (2FA): Google Authenticator integration for account security.
    • JWT Security: Secure token-based sessions with refresh rotation.
  • Profile Customization: Personalize your presence with avatars and unique handles.

  • Database Reliability: Type-safe interactions using Prisma ORM.

  • Scalar Interactive Docs: Sleek, modern API documentation accessible at /docs.

๐Ÿ“Š Engine & Orchestration - Implemented by @BL4KCY

  • Observation Stack:
    • ELK Stack: Centralized logging for debugging and audit trails.
    • Prometheus & Grafana: Real-time performance metrics and visual dashboards.
  • Dockerized Environment: Fully containerized services for consistent "one-command" deployment.

Technologies Used

Technology Justification
Fastify Chosen for its high performance and low overhead, essential for handling high-concurrency WebSocket connections.
TypeScript Ensures type safety across the stack, reducing runtime errors and improving developer productivity.
React Provides a robust component-based architecture for building a dynamic and responsive game UI.
Prisma ORM Offers type-safe database queries and automated migrations, ensuring data consistency with SQLite.
WebSockets Critical for the real-time bidirectional communication required for real-time multiplayer gameplay.
Docker Simplifies deployment and ensures environment parity between development and production.
ELK Stack Provides centralized logging for observability and efficient debugging of system events.

Database Schema

Our data model is designed to handle complex social interactions and real-time game state tracking.

  • User: Manages authentication, profile data, and XP/stats.
  • Room & Message: Handles both direct messages and multi-user group chats.
  • Friendships & Requests: Manages the social graph and blocked users.
  • Match: Records match history, scores, and winners for the leaderboard.
erDiagram
    USER ||--o{ MATCH : plays
    USER ||--o{ FRIENDSHIP : has
    USER ||--o{ ROOM_MEMBER : joins
    ROOM ||--o{ ROOM_MEMBER : contains
    ROOM ||--o{ MESSAGE : contains
    USER ||--o{ MESSAGE : sends
Loading

Implemented Modules

This project satisfies the requirement of 42 Transcendence by implementing several major and minor modules, totaling 27.0 points.

๐ŸŒ Web (7.0 Points)

Module Type Value Justification
Frameworks Major 2.0 Used Fastify for the backend and React for the frontend to build a high-performance SPA.
Real-time features Major 2.0 Integrated WebSockets for live game state updates and instant chat messaging.
User Interactions Major 2.0 Implemented a social graph with Chat, Profiles, and a Friend system.
Use an ORM Minor 1.0 Utilized Prisma ORM for type-safe database interactions and schema management.

๐Ÿ‘ค User Management (5.0 Points)

Module Type Value Justification
Standard Management Major 2.0 Full user lifecycle management: registration, profile editing, and friend status.
Remote Auth Minor 1.0 Support for OAuth 2.0 (Google and 42) for secure, third-party authentication.
2FA System Minor 1.0 Enhanced security with Two-Factor Authentication via Google Authenticator.
Game Stats Minor 1.0 Real-time tracking of Wins/Losses, XP, and global Leaderboard rankings.

๐ŸŽฎ Gaming & AI (6.0 Points)

Module Type Value Justification
Web-based Game Major 2.0 A custom real-time Pong game implemented with modern canvas API and logic.
Remote Players Major 2.0 Matchmaking system allowing two players to compete from different machines.
AI Opponent Major 2.0 Developed a challenging AI bot that simulates human movements for solo play.

๐Ÿ› ๏ธ DevOps & UX (9.0 Points)

Module Type Value Justification
ELK Stack Major 2.0 Centralized logging using Elasticsearch, Logstash, and Kibana for system auditing.
Prometheus/Grafana Major 2.0 Real-time monitoring of service health and resource usage with custom dashboards.
Public API Major 2.0 Secured API with documentation (Scalar) and rate-limiting for third-party access.
Notification System Minor 1.0 Real-time in-app notifications for friend requests and game invites.
Custom Design Minor 1.0 Built a cohesive, custom-made design system with reusable components and consistent styling.
Health Check Minor 1.0 Implemented status pages and health endpoints for all microservices.

Project Structure

โฏ 48 directories, 35 files

.
โ”œโ”€โ”€ assets
โ”‚   โ””โ”€โ”€ cover.png
โ”œโ”€โ”€ backend
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ”œโ”€โ”€ ecosystem.config.cjs
โ”‚   โ”œโ”€โ”€ ecosystem.config.js
โ”‚   โ”œโ”€โ”€ filebeat.yml
โ”‚   โ”œโ”€โ”€ nodemon.json
โ”‚   โ”œโ”€โ”€ package-lock.json
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ postcss.config.js
โ”‚   โ”œโ”€โ”€ prisma
โ”‚   โ”‚   โ””โ”€โ”€ schema.prisma
โ”‚   โ”œโ”€โ”€ public
โ”‚   โ”‚   โ””โ”€โ”€ images
โ”‚   โ”œโ”€โ”€ src
โ”‚   โ”‚   โ”œโ”€โ”€ app.ts
โ”‚   โ”‚   โ”œโ”€โ”€ auth
โ”‚   โ”‚   โ”œโ”€โ”€ controllers
โ”‚   โ”‚   โ”œโ”€โ”€ generated
โ”‚   โ”‚   โ”œโ”€โ”€ hooks
โ”‚   โ”‚   โ”œโ”€โ”€ middleware
โ”‚   โ”‚   โ”œโ”€โ”€ models
โ”‚   โ”‚   โ”œโ”€โ”€ plugins
โ”‚   โ”‚   โ”œโ”€โ”€ routes
โ”‚   โ”‚   โ”œโ”€โ”€ schemas
โ”‚   โ”‚   โ”œโ”€โ”€ server.ts
โ”‚   โ”‚   โ”œโ”€โ”€ services
โ”‚   โ”‚   โ”œโ”€โ”€ tests
โ”‚   โ”‚   โ”œโ”€โ”€ types
โ”‚   โ”‚   โ””โ”€โ”€ utils
โ”‚   โ””โ”€โ”€ tsconfig.json
โ”œโ”€โ”€ CONTRIBUTING.md
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ frontend
โ”‚   โ”œโ”€โ”€ dist
โ”‚   โ”‚   โ”œโ”€โ”€ assets
โ”‚   โ”‚   โ””โ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ”œโ”€โ”€ index.html
โ”‚   โ”œโ”€โ”€ nginx.conf
โ”‚   โ”œโ”€โ”€ package-lock.json
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ”œโ”€โ”€ postcss.config.js
โ”‚   โ”œโ”€โ”€ src
โ”‚   โ”‚   โ”œโ”€โ”€ app.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ assets
โ”‚   โ”‚   โ”œโ”€โ”€ components
โ”‚   โ”‚   โ”œโ”€โ”€ config
โ”‚   โ”‚   โ”œโ”€โ”€ context
โ”‚   โ”‚   โ”œโ”€โ”€ global
โ”‚   โ”‚   โ”œโ”€โ”€ lib
โ”‚   โ”‚   โ”œโ”€โ”€ main.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ router.tsx
โ”‚   โ”‚   โ”œโ”€โ”€ screens
โ”‚   โ”‚   โ”œโ”€โ”€ services
โ”‚   โ”‚   โ”œโ”€โ”€ styles
โ”‚   โ”‚   โ”œโ”€โ”€ svg.d.ts
โ”‚   โ”‚   โ””โ”€โ”€ types
โ”‚   โ”œโ”€โ”€ tailwind.config.js
โ”‚   โ”œโ”€โ”€ tsconfig.json
โ”‚   โ””โ”€โ”€ vite.config.ts
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ monitoring
โ”‚   โ”œโ”€โ”€ ELK-Stack
โ”‚   โ”‚   โ”œโ”€โ”€ docker-compose.yml
โ”‚   โ”‚   โ”œโ”€โ”€ filebeat
โ”‚   โ”‚   โ”œโ”€โ”€ logstash
โ”‚   โ”‚   โ”œโ”€โ”€ nginx
โ”‚   โ”‚   โ”œโ”€โ”€ setupDashboards
โ”‚   โ”‚   โ”œโ”€โ”€ setupDataCycleLife
โ”‚   โ”‚   โ”œโ”€โ”€ setupPassowrds
โ”‚   โ”‚   โ””โ”€โ”€ setupSSL
โ”‚   โ””โ”€โ”€ PrometheusGrafana
โ”‚       โ”œโ”€โ”€ alertmanager
โ”‚       โ”œโ”€โ”€ docker-compose.yaml
โ”‚       โ”œโ”€โ”€ grafana
โ”‚       โ”œโ”€โ”€ LICENSE
โ”‚       โ”œโ”€โ”€ Makefile
โ”‚       โ”œโ”€โ”€ prometheus
โ”‚       โ””โ”€โ”€ service-x
โ””โ”€โ”€ README.md

Getting Started

Prerequisites

This project requires the following dependencies:

  • Programming Language: JavaScript
  • Package Manager: Npm, Yarn
  • Container Runtime: Docker

Installation

Build from the source and intsall dependencies:

  1. Clone the repository:

    git clone ../
  2. Navigate to the project directory:

    cd 
  3. Install the dependencies:


    Docker

    Using docker:

    docker build -t my-app .

    npm Using npm:

    npm install

    yarn Using yarn:

    yarn install

    Bun Using bun:

    bun install

Usage

Run the project with:

Using docker:

docker run -it {image_name}

Using npm:

npm start

Using yarn:

yarn start

Contributing

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your LOCAL account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone .
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
  6. Push to LOCAL: Push the changes to your forked repository.
    git push origin new-feature-x
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!

License

is protected under the LICENSE License. For more details, refer to the LICENSE file.


Acknowledgments

  • Credit contributors

About

a comprehensive, real-time web application that brings the classic Pong experience into the modern era. Designed with a focus on concurrency, scalability, and user experience, this platform is more than just a game; it's a full-featured social ecosystem.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors