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.
- a chat interface
- a matchmaking system
- a friendship relation system
- notifications alert
- 2fa with google authenticator
- spectate mode
- login with 42 api
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 filesBefore you begin, ensure that you have the following prerequisites installed:
- docker
- Clone the 42-ft_transcendence repository:
git clone https://github.com/jremy42/42-ft_transcendence- Change to the project directory:
cd 42-ft_transcendence- launch application:
make- for normal usage : http://localhost:8080
To deploy the application on your own URL, please follow these steps:
- Set the URL in the PUBLIC_URL field to your desired URL in .env file.
- 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
- 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)
- Transpilation and minification from typescript to javascript
- exits on success
- expose api routes for use in frontend
- serves as an intermidary between client and postgre Database
- handle CRUD operations on website database
-
β 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.

