How vorellana/ranking-services works
Project’s Main Components
• Backend Service: This is implemented using Node.js and Express. It includes core modules like app.js and config.js, as well as separate directories for middlewares (e.g., authJwt), routes (e.g., auth, games, players, ranking), services for business logic (e.g., auth.service.js, games.service.js) and utilities for database connection and ranking functions.
• Frontend Service: Built with React, this part includes application components subdivided into different views (login, menu, players, ranking-board) with clear structure for routing (Routes.js) and service functions for API calls (auth, games, players, etc.). It also uses nginx as a serving web server.
• Database Service: PostgreSQL is used as the database, with an initialization script (init.sql) provided in the “database” folder. The Dockerfile here prepares the database container.
• Deployment Setup: docker-compose.yml orchestrates the containers (backend, frontend, and database) to work together.
• Within the Backend component, note:
– A set of modules representing routes (auth, games, players, ranking, etc.) that serve API endpoints.
– Middlewares (such as authJwt) that handle security (JWT validation) and other reusable functionality.
– Services that encapsulate business logic for handling various CRUD operations.
– Utilities for connection management and additional helper functions (ranking-functions).
• Within the Frontend component, include:
– A presentation layer with React components for each view (login, menu, players, ranking-board, etc.).
– A routing system to direct user navigation.
– Service layer functions (using Axios, jwt-decode, etc.) to interact with the backend API.
– Integration with nginx (from the frontend/nginx folder) that serves static content.
• The Database component represents PostgreSQL, with an initialization process (via init.sql) set up during container deployment.
• Data flow: