How vicode-dev/transcendence works
This project – Transcendence – is a full-stack microservices web application that lets users play pong (and connect 4) while also incorporating blockchain score storage, remote multiplayer and CLI gameplay. The codebase is organized into several parts: a CLI directory (with separate game implementations for pong and connect4), and a services directory that houses multiple Dockerized microservices (authentication, blockchain, game-serv, user management, ELK & monitoring stacks, nginx reverse proxy, and more). The README reinforces that the project’s architecture is based on Django for the backend, Bootstrap/vanilla JavaScript for the frontend, Postgres as a database, and Ethereum for blockchain score management.
Main Components
• Frontend:
– Web UI for gameplay, user management, and tournament pages.
– Static assets – HTML templates, CSS, JavaScript (including advanced 3D parts via ThreeJS/WebGL).
• Backend Microservices:
– Authentication Service (supports standard user management and OAuth 42-based remote authentication).
– Game Service (the “game-serv” service handling real-time pong gameplay, including different game modes through consumers, routing, and API integrations).
– User Management Service (handles profiles, friends, GDPR-compliant data handling, 2FA with JWT, settings, etc).
– Other domain-specific services (for blockchain score recording, tournament management, and chat/lobby functionality).
• CLI:
– A dedicated command-line interface offering offline or interconnected gameplay (against both AI and real players).
• Supporting Infrastructure:
– Database: PostgreSQL as the main data store.
– DevOps & Monitoring: ELK stack (Elasticsearch, Logstash, Kibana), Prometheus, Grafana, Filebeat.
– Reverse Proxy / Load Balancer: nginx.
– Container orchestration through Docker and docker-compose.
– Blockchain: Ethereum network with Solidity smart contracts to store tournament scores.
Relationships & Interactions
• User requests via the Web UI hit the nginx reverse proxy which forwards them to the appropriate backend microservice (or API gateway if applicable).
• Authentication and user management services communicate with the Postgres database and possibly with external APIs (e.g., OAuth 2.0 integration with 42).
• The game-serv module interacts with both the frontend (real-time game events via WebSockets or API endpoints) and the CLI interface.
• Microservices publish/log data that flows into the ELK stack; Prometheus and Grafana monitor health metrics.
• The blockchain service is responsible for interacting with Ethereum to record tournament score data; it may be called from within the user management or game service.
• The CLI components (found in the CLI folder) provide an alternative entry point that communicates with the same backend API endpoints, facilitating gameplay between web and terminal users.
Architectural Patterns and Design Principles
• Microservices Architecture: Each service is containerized (using Docker) and deployed separately, communicating via well-defined APIs.
• Separation of concerns: Frontend, game logic, authentication, and monitoring are all clearly isolated.
• Use of industry-standard frameworks: Django for backend applications, Bootstrap and vanilla JavaScript (with some ThreeJS) for the frontend; smart contract development in Solidity.
• Container orchestration: The docker-compose.yml file shows how services are interconnected.
• Secure design: Integration of JWT, 2FA, and GDPR compliance (user anonymization and deletion flows).
Technologies and Frameworks
• Backend/Django, Frontend/Bootstrap & JavaScript (with advanced 3D via ThreeJS/WebGL), PostgreSQL, Ethereum (via Solidity contracts).
• DevOps: Docker, docker-compose, ELK stack (Elasticsearch, Logstash, Kibana), Prometheus, Grafana.
• Reverse proxy: nginx.
• CLI: Python-based CLI tools for game play.