The website is built with React and gets information from the backend. The backend is written in Java and uses the Springboot framework.
The user has the choice between two games to play, cointoss and blackjack. When the player wants to play one of these games, they have to input an amount of points as a bet. Once they start the game, a request is sent to the backend API. A response is sent back to the website to display the status of the game, if the player can actually bet the amount of points they put in.
The state of a game is stored in an in-memory database. If the player wants to, for example, hit for a new card in Blackjack the backend takes a random card from a stack of available cards in the database from that specific game. The game is adjusted in the backend, and the new game state is sent back to the user in the form of a Data Transfer Object (DTO).
Each game has a unique ID which the user who initiated the game has stored. This means that multiple people can use the site at the same time without seeing other people's games.
Each user has their own account stored in the database with an encrypted password.
Upon logging in, the backend will generate and send a JWT token back to the user. The token is then stored in the browser, and sent with any API request. This is so only the logged in user can alter their data, adding an extra layer of protection.
A couple of tools/techniques were used to validate the quality and security of code used in the project.
Sonarqube
Unit tests with data mocking for backend testing
Cypress for frontend testing
Frequent peer reviews and teacher reviews
A gitlab runner building and running tests with each push
This project was my first introduction to making a full stack web application with a website communicating with a backend via REST API. I also had to learn and implement a lot of new techniques and professional standards. At the end of the project, I had a well understanding of the following concepts:
JWT authentication,
Spring boot framework,
Creating a REST API,
React,
Frontend testing,
Dependency inversion/injection,
Gitlab CI/CD,
Sonarqube,
DTO's
Project ranged from September 2021 -> January 2022