Skip to content

Amine-Nova/ft_transcendence

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ft_transcendence

A web-based multiplayer Pong game. Frontend uses HTML, CSS, and JavaScript. Backend uses Django REST API. The app runs in Docker containers with PostgreSQL database.

Screenshots

Deployment Diagram Main Page Login Page

Multiplayer Game AI Mode Terminal Interface

Features

  • Real-time multiplayer Pong game
  • Play against AI or other players
  • Tournament system with automated matchmaking
  • Single-page application with smooth navigation
  • Two-Factor Authentication (2FA)
  • JWT authentication
  • Multi-language support
  • PostgreSQL database
  • Docker deployment
  • Dockerized
  • Runs with docker-compose up --build in rootless mode on Linux

Chosen Modules

Major Modules

  • Framework Backend (Django): Scalable server-side solution.
  • Remote Authentication (OAuth 2.0 with 42): Secure login via 42's OAuth 2.0.
  • Two-Factor Authentication (2FA) & JWT: Enhanced security via 2FA (SMS/app/email) and JWT.
  • Multiple Players: More than 2 players in a single game (e.g., 4-player squared board).
  • AI Opponent: Simulates human play, uses power-ups (no A* algorithm).

Minor Modules

  • Database (PostgreSQL): Reliable data storage.
  • Front-End Framework (Bootstrap): Responsive UI.
  • Browser Compatibility: Supports an additional browser.
  • Game Customization: Power-ups, attacks, maps with user-friendly settings.
  • Multiple Language Support: 3+ languages with a language switcher.

Installation

Requirements

  • Docker
  • Docker Compose
  • Make (optional, for easier commands)

Quick Start

  1. Clone the repository:
git clone https://github.com/amine-za/ft_transcendence.git
cd ft_transcendence
  1. Run with Make:
make up

Or without Make:

docker compose up --build
  1. Open your browser and go to: https://localhost:443

Note: You will see a security warning because of the self-signed certificate. Click "Advanced" and "Proceed to localhost" to continue.

The application will work immediately with default settings. Email 2FA features will be disabled until you configure email credentials in the .env file.

Project Structure

ft_transcendence/
├── .env.example           # Environment variables template
├── .env                   # Your configuration (auto-created, gitignored)
├── docker-compose.yml     # Docker services configuration
├── Makefile               # Build automation
├── backend/               # Django REST API
│   ├── Dockerfile
│   ├── requirements.txt
│   └── project/
│       ├── accounts/      # User authentication
│       ├── oauth42/       # 42 OAuth integration
│       ├── twofa/         # Two-factor authentication
│       └── core/          # Django settings
├── frontend/              # Static web files
│   ├── index.html
│   ├── component/         # JavaScript modules
│   ├── assets/            # JS and language files
│   └── styles/            # CSS files
└── images/                # Documentation screenshots

Usage Commands

make up        # Start all services
make stop      # Stop all services
make logs      # View application logs
make clean     # Remove containers and volumes
make fclean    # Complete cleanup including images
make re        # Clean and restart
make status    # Check container status

Configuration (Optional)

The application works with default settings. To enable email-based 2FA:

  1. Edit .env file after first run
  2. Set Gmail credentials:
EMAIL_HOST_USER=your_gmail@gmail.com
EMAIL_HOST_PASSWORD=your_app_password
  1. Restart: make re

To get Gmail app password: Google Account > Security > 2-Step Verification > App passwords

Technology Stack

  • Frontend: HTML, CSS, JavaScript
  • Backend: Django, Django REST Framework
  • Database: PostgreSQL
  • Deployment: Docker, Nginx
  • Authentication: JWT, OAuth 2.0

Security Features

  • Password hashing
  • Two-Factor Authentication
  • JWT tokens
  • Protection against SQL injection and XSS
  • HTTPS support

Enjoy ft_transcendence!

About

User-Auth, JWT, 2FA, JS Component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors