Skip to content

fleblay/42-ft_transcendence

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,278 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


42-ft_transcendence jremy's 42 ft_transcendence Score

πŸ“ Welcome to the Web Devlopement !

βš™οΈ Developed with the software and tools below:

GNU%20Bash HTML5 sharp Vite React Axios tsnode TypeScript Docker Markdown Express JSON

πŸ“ Overview

This project is the final projet of 42 cursus common core.

The ft_transcendence project involved creating a website for online multiplayer Pong gameplay. We implemented real-time gaming features, secure user authentication using OAuth, and a chat system for player communication.


πŸ’« Features

  • a chat interface
  • a matchmaking system
  • a friendship relation system
  • notifications alert
  • 2fa with google authenticator
  • spectate mode
  • login with 42 api

πŸ“‚ Project Structure

Details
repo
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ backend
β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”œβ”€β”€ launch.sh
β”‚Β Β  β”œβ”€β”€ launch_test.sh
β”‚Β Β  β”œβ”€β”€ nest-cli.json
β”‚Β Β  β”œβ”€β”€ package-lock.json
β”‚Β Β  β”œβ”€β”€ package.json
β”‚Β Β  β”œβ”€β”€ src
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app.controller.spec.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app.controller.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app.middleware.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app.module.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app.service.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChatRequest.http
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat.controller.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat.controller.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat.module.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat.service.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat.service.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── dto
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ change-channel.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ create-channel.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ join-channel.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ modify-member.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      β”œβ”€β”€ mute.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── new-message.dto.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ events
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ decorators
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── EventUser.decorator.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ dtos
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game-create.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game-join.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── player-input.dto.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ events.gateway.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ events.gateway.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ events.module.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ guards
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”‚Β Β  └── event.guard.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── interceptors
β”‚Β Β  β”‚Β Β  β”‚Β Β      └── WebSocketUser.interceptor.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ friends
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ friends.controller.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ friends.controller.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ friends.module.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ friends.service.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── friends.service.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game-cluster.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game.controller.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game.controller.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game.module.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game.service.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game.service.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── game.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ interceptors
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── serialize.interceptor.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ main.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ model
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ channel.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ friend-request.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ member.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ message.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ refresh-token.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ saved-game.entity.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ saved-game.subscriber.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── user.entity.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification-request.subscriber.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification.controller.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification.controller.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification.module.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification.service.spec.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ notification.service.ts
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── notification.subscriber.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ pipe
β”‚Β Β  β”‚Β Β  β”‚Β Β  └── validateID.pipe.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ type.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ typeorm.filter.ts
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ unauthorizedException.filter.ts
β”‚Β Β  β”‚Β Β  └── users
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ auth
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ auth.controller.spec.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ auth.controller.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ auth.module.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ auth.service.spec.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ auth.service.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ authenticated.guard.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  └── hashPassword.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ decorators
β”‚Β Β  β”‚Β Β      β”‚Β Β  └── current-user.decorator.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ dtos
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ create-user.dto.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ dfa-code.dto.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ login-user.dto.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ request.http
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ user-restricted.dto.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ user.dto.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  └── username.dto.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ guard
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ 2fa-token.guard.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ File-size.guard.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  β”œβ”€β”€ access-token.guard.ts
β”‚Β Β  β”‚Β Β      β”‚Β Β  └── refresh-token.guard.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ users.controller.spec.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ users.controller.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ users.module.ts
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ users.service.spec.ts
β”‚Β Β  β”‚Β Β      └── users.service.ts
β”‚Β Β  β”œβ”€β”€ test
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ app.e2e-spec.ts
β”‚Β Β  β”‚Β Β  └── jest-e2e.json
β”‚Β Β  β”œβ”€β”€ tsconfig.build.json
β”‚Β Β  └── tsconfig.json
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ envmaker.sh
β”œβ”€β”€ info
β”‚Β Β  β”œβ”€β”€ Diagramme sans nom.drawio
β”‚Β Β  β”œβ”€β”€ GameArchitecture.drawio
β”‚Β Β  β”œβ”€β”€ chat.drawio
β”‚Β Β  β”œβ”€β”€ db_model.png
β”‚Β Β  β”œβ”€β”€ stack_docker.drawio
β”‚Β Β  └── stack_docker.jpg
β”œβ”€β”€ jremy.conf
β”œβ”€β”€ nginx
β”‚Β Β  β”œβ”€β”€ Dockerfile
β”‚Β Β  β”œβ”€β”€ avatars
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 1.png
β”‚Β Β  β”‚Β Β  └── default.png
β”‚Β Β  └── nginx.conf
β”œβ”€β”€ package-lock.json
β”œβ”€β”€ package.json
└── vite
    β”œβ”€β”€ Dockerfile
    β”œβ”€β”€ index.html
    β”œβ”€β”€ launch.sh
    β”œβ”€β”€ package-lock.json
    β”œβ”€β”€ package.json
    β”œβ”€β”€ public
    β”‚Β Β  └── pong.svg
    β”œβ”€β”€ src
    β”‚Β Β  β”œβ”€β”€ App.tsx
    β”‚Β Β  β”œβ”€β”€ ErrorProvider
    β”‚Β Β  β”‚Β Β  └── ErrorProvider.tsx
    β”‚Β Β  β”œβ”€β”€ assets
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ private.png
    β”‚Β Β  β”‚Β Β  └── public.png
    β”‚Β Β  β”œβ”€β”€ auth
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ AuthService.tsx
    β”‚Β Β  β”‚Β Β  └── interceptor.axios.tsx
    β”‚Β Β  β”œβ”€β”€ component
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ 404.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Debounced.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ DfaForm.css
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ DfaForm.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Error.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Footer.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ FriendList.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ InvitedFriends.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Leaderboard.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ LoginForm.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ Menu.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ProfilPlayer.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ RegisterForm.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ SearchBar.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ UpdateProfil.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ UserAchievment.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ UserInfoDisplay.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ UsernameDialog.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ chat
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChannelBrowse.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChannelMemberList.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChannelsList.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChatDirectMessageList.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChatFriendsBrowser.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChatMenu.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChatMessage.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ChatPage.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ CreatChannelModal.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ MessageArea.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ModifyChannelModal.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ MuteMemberModal.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  └── PasswordDialog.tsx
    β”‚Β Β  β”‚Β Β  β”œβ”€β”€ game
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ CreateGame.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ FakeGame.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ FinishGames.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ GameHistory.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ GamePage.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ GameScreen.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ListCurrentGames.tsx
    β”‚Β Β  β”‚Β Β  β”‚Β Β  └── ResultGame.tsx
    β”‚Β Β  β”‚Β Β  └── notifications
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ notifcationsBar.tsx
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ notificationDirectMessage.tsx
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ notificationInvitation.tsx
    β”‚Β Β  β”‚Β Β      β”œβ”€β”€ notificationRequestFriend.tsx
    β”‚Β Β  β”‚Β Β      └── notificationsList.tsx
    β”‚Β Β  β”œβ”€β”€ index.css
    β”‚Β Β  β”œβ”€β”€ main.tsx
    β”‚Β Β  β”œβ”€β”€ socket
    β”‚Β Β  β”‚Β Β  └── SocketProvider.tsx
    β”‚Β Β  β”œβ”€β”€ token
    β”‚Β Β  β”‚Β Β  └── token.tsx
    β”‚Β Β  β”œβ”€β”€ types.tsx
    β”‚Β Β  β”œβ”€β”€ userDataProvider
    β”‚Β Β  β”‚Β Β  └── userDataProvider.tsx
    β”‚Β Β  └── vite-env.d.ts
    β”œβ”€β”€ tsconfig.json
    β”œβ”€β”€ tsconfig.node.json
    └── vite.config.ts

38 directories, 177 files

πŸš€ Getting Started

βœ… Prerequisites

Before you begin, ensure that you have the following prerequisites installed:

  • docker

πŸ–₯ Installation

  1. Clone the 42-ft_transcendence repository:
git clone https://github.com/jremy42/42-ft_transcendence
  1. Change to the project directory:
cd 42-ft_transcendence
  1. launch application:
make
  1. for normal usage : http://localhost:8080

πŸš€ Deployment Instructions

To deploy the application on your own URL, please follow these steps:

  1. Set the URL in the PUBLIC_URL field to your desired URL in .env file.
  2. Make sure to provide the necessary environment variables for the application to function properly.

To integrate the application with the 42 API, please ensure you have the following environment variables properly configured:

API_CLIENT_ID=
API_CLIENT_SECRET=

Compliant for deployement in aws => you can try here

Compliant for deployement in private webserver => you can try here


πŸ€– Docker stack

Nginx :

  • ingress point listening on 443 with ssl
  • reverse proxy for nestjs backend api calls
  • static serve of avatars files (.png) and front-end app file (.js / .html / .css)

Vite :

  • Transpilation and minification from typescript to javascript
  • exits on success

Nest :

  • expose api routes for use in frontend
  • serves as an intermidary between client and postgre Database

PostgreSQL :

  • handle CRUD operations on website database

πŸ—„οΈ Data Architecture

πŸ‘ Acquired knowledge

  • βœ… Web development: We gained experience in web development by creating a website .

  • βœ… Backend with NestJS: We learned to develop the backend of our website using NestJS, a powerful Node.js framework that helps with building scalable and efficient server-side applications.

  • βœ… Frontend with React and TypeScript: We utilized React, a popular JavaScript library for building user interfaces, and leveraged TypeScript, a statically-typed superset of JavaScript, to develop the frontend of our website. This allowed for component-based development, better UI management, and enhanced type safety.

  • βœ… Real-time multiplayer functionality: We implemented real-time multiplayer features, enabling users to play Pong with each other in real-time through our website, We used Socket.IO, a JavaScript library, to enable real-time communication and data exchange between the server and clients.

  • βœ… User authentication with OAuth and tokens: We implemented an authentication strategy using OAuth and utilized refresh and access tokens for secure user authentication and authorization. Also, We integrated the OAuth system from the 42 intranet, allowing users to log in securely using their 42 credentials.

  • βœ… Chat functionality: We created a chat feature where users can send direct messages to each other, enhancing the interactive experience of our website.

  • βœ… Docker: We utilized Docker to create a containerized environment for our application, allowing for easy setup and deployment across different systems.

  • βœ… PostgreSQL: We used PostgreSQL, an open-source relational database management system, to store and manage our application's data effectively.

  • βœ… Online deployment on a server: We deployed our website online on a server, making it accessible to users over the internet. This involved configuring the server, setting up the necessary dependencies, and deploying our application to ensure it is available for use.

😎 Team :

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.6%
  • Other 2.4%