The last project of the 42 common core.
This project is single page application that allows users to create accounts, log in, play a game of pong against other users, participate in tournaments and compare your stats with friends.
The project is divided into three main parts:
-
Web Sockets and algorithms: The game is played in real time from different clients, using web sockets to communicate the game state between the clients and the server.
-
Frontend: A vanilla JS fronted that accts as a single page application, requesting the data to the backend and updating the DOM accordingly. And using Bootstrap for the styling of the page.
-
Backend: A Django server that provides an API for the frontend to interact with using Django-Ninja and using Postgres as a database. It also manages the game state and the web sockets connections.
This project runs in Docker. Using three containers:
-
Django (API and backend) 🐍
-
Postgres (database) 🗄️
-
Nginx (frontend) 🌐
This project was a team effort. You can checkout the team members here:
- José Luis Utrera
- Adrian Pacheco
- Alejandro Aparicio
Using docker you can run the project with the following setup:
cp .example.env src/docker/.env
#Enter values for the variables in the .env file
vim src/docker/.env
make
Once the project is running you can access the web page at localhost:8080
In the project database we store the application information in 5 tables:
-
user
: Stores user information for their login credentials as well as user statistics from matches -
match
: Record of all matches played, indicating what users participated, their respective score and if the match was from a tournament -
userTournament
: Table that stores what users are participating in a tournament -
tournament
: Table that stores the information of the tournaments, indicating the status of the tournament, the number of participants and the date of the tournament -
friend
: Table that stores the relationships between users, indicating if they are friends or if they have a pending friend request
The documentation for the API, it's routes as well as the schemas each route expects and returns can be found in the /api/docs
route of the project.