About arc42
arc42, the template for documentation of software and system architecture.
Template Version 8.2 EN. (based upon AsciiDoc version), January 2023
Created, maintained and © by Dr. Peter Hruschka, Dr. Gernot Starke and contributors. See https://arc42.org.
1. Introduction and Goals
1.1. Requirements Overview
The main goal of this project is the development of YOVI, an implementation of the "Game Y" board game for the game development company "Micrati". The system must be a robust and scalable solution that combines modern web development technologies along with Rust’s efficient computational logic, which will use YEN notation to communicate with the Web Applcation. The game will contain several innovative features such as the possibility to face several bots implementing different difficulties and game strategies, as well as multiplayer mode in which you can play real time against other player.
Functional requirements:
-
The system will allow users to play against players or bots
-
The size of the board, as well as the strategies and difficulty of the bots to play against can be selected by the user
-
User must be able to register and login and both statistics and results of games will be also recorded
-
The application must be deployed and publicly accessible via the Web
-
The system will contain a Rust module for verifying win conditions and suggesting a "next move"
1.2. Quality Goals
| Quality Goal | Description |
|---|---|
Performance |
The system must ensure low-latency interactions by using Rust for heavy computations and YEN notation for high-speed communication between modules. |
Usability |
The application must provide an intuitive and easy to use interface for seamless board interaction and strategy selection. |
Scalability |
The system should handle a growing number of players and concurrent bot requests without slowing down. |
Interoperability |
The application must allow external bots to interact with both the system and players. |
Maintainability |
The system is designed to be easy to fix and update due to its modular structure, allowing us to modify different subsystems separately. |
Security |
User data must be securely stored and will be protected against unauthorized access. |
Testability |
The system will have appropiate testing to ensure software correctness. |
1.3. Stakeholders
| Role/Name | Contact | Expectations |
|---|---|---|
Micrati |
Project Owner |
A scalable game suite that showcases high performance and supports future variants of Game Y. |
Users |
Users of the Game |
A smooth and engaging game experience with a user-friendly interface. |
Evaluators |
Professors |
Adherence to arc42 standards, correct use of YEN notation, and high quality in both Rust and TypeScript. |
2. Architectural Constraints
This section describes the conditions and non-functional requirements that limit our design freedom. These constraints are primarily defined by the academic requirements of the ASW course and the pre-existing technical template provided for the project.
| Constraint | Description | Consequence |
|---|---|---|
C1: Polyglot Stack |
Use of Node.js (Users), React (Webapp), and Rust (Gamey). |
Team must manage multiple toolchains ( |
C2: Dockerization |
Mandatory use of Docker and Docker Compose for deployment. |
Developers must have Docker installed. Simplifies grading but adds overhead to local resource (RAM) usage. |
C3: Arc42 Template |
Documentation must strictly follow the Arc42 structure. |
Higher initial effort in documentation, but ensures all architectural aspects of the project are covered. |
C4: SPA Architecture |
Frontend must be a Single Page Application using Vite/React. |
State management and routing happen entirely in the browser; the backend is strictly a stateless REST API. |
C5: Timeframe |
Project must be completed within the academic semester. |
Feature prioritization is critical (MVP approach); complex "extra" features might be risky. |
3. Context and Scope
3.1. Business Context
| Communication Partner | Input | Output |
|---|---|---|
User |
- Login credentials |
- Authentication result |
External Bots |
- API requests |
- Game data |
3.2. Technical Context
| Communication Partner | Input | Output |
|---|---|---|
User |
- Login credentials |
- Authentication result |
Web Frontend |
- Requests from the user (login, moves, strategy) |
- Forwards requests to API |
API |
- Requests from Frontend |
- Forwards requests to User Registration, User Service, GameY |
User Registration |
- Registration/Login data from API |
- User created / validated |
User Service |
- Requests from API (stats, history) |
- Data from MongoDB |
GameY |
- Game moves from API |
- Game state updates |
Bot (internal) |
- Game state |
- Next action |
MongoDB |
- Queries from User Service |
- Returns requested user data |
4. Solution Strategy
4.1. Technologies used
4.1.1. FrontEnd
-
React + Typescript: Used for the principal face of the proyect, for the game interface and for the users registry.
-
Vite: Used for constructing the FrontEnd.
4.1.2. BackEnd
-
Node.js: Used for managing the users registration in the server.
-
Express: Used for develop the API rest that allows to communicate between FrontEnd and BackEnd.
-
Rust: Used for developing the bots and to be used as the game engine.
-
Cargo: Used for building and compiling rust proyect.
-
MongoDB: We are using MongoDB as the database for the users because it gives support for JSON, being it the main communication file in our application. Also because in case we need to keep the state of something in a JSON file at some point, it would be easier having a document based databes instead of having an SQL one.
4.1.3. Infraestructure
-
Docker: Used for having just one container that works the same way in different computers.
-
Github Actions: Used for automatizing tasks such as passing the test, compiling code before we push something into the repository
-
SonarCloud: Used for verifying the quality of the code.
-
Gitflow for branch strategy: We are using gitflow as branching strategy as we need keep a record of the changes, and because we are having different versions being coded at the same time so we need to keep them save.
4.2. Top-Level decomposition decisions
-
Strategy pattern: Used for the bots, having the YBot trait as an interface used for the different bots implemented.
4.3. How to achieve key quality goals
-
Performance: The game and the bots are developed in Rust, making the time responses lower than any other programming language.
-
Usability: The application must be user friendly, making the user feel comfortable while going through the application.
-
Maintability: The application must persist over time.
-
Security: The application must protect the users data by validating into the server all the movements by any user.
-
Testability: The application must be tested, using github actions to perform that tests before each push.
4.4. Organizational decisions
-
The use of GitHub for communicating beween members of the team.
-
A weekly meeting to clarify doubts about the project and decide what will be done during the week.
-
A record of these meetings will be kept in the repository’s wiki on GitHub.
-
Pull requests will be used to prevent problems with overwriting code.
-
Wiki in GitHub will be used for publishing information about the different modules so everyone in the team could see and understand the most critical parts of the proyect in case we need it.
4.5. Arquitecture Pattern Used
For developing out system, we will use a microservices arquitecture, that is based on having different independent services that communicate each other via APIs. For now, we will have at least 3 microservices: GameY that is the engine of the game, Users for managing the users verification and validation and WebApp for being the front layer of the system.
5. Building Block View
5.1. Whitebox Overall System
- Motivation
-
This is a high-level view of the project, with the three main components that make it up.
- Contained Building Blocks
| Name | Responsibility |
|---|---|
WebApp |
Web visual interface for the player to interact with the program |
Users |
REST API to manage registration and storage of players |
Gamey |
Main game logic and bots for the player to play against |
- Important Interfaces
-
<Description of important interfaces>
5.2. Level 2
5.2.1. White Box Gamey
- Contained Building Blocks
| Name | Responsibility |
|---|---|
Core |
Core of the game, including the main game logic,coordinates,game_state , … |
Bot |
Registry of bots that the player can play against, can be accessed by the core to get the next move of a bot and through the Bot Server API. |
CLI |
The gamme can also be played through a command line interface, this is omly used for testing and debugging purposes. |
5.2.2. White Box WebApp
- Contained Building Blocks
| Name | Responsibility |
|---|---|
Login Page |
Web page for user authentication and login, accesses the Users API to store users |
Game Selection |
After login, the user can customize his game settings, sucha as the bot he wants to play against, the board size, … |
Game UI |
The user can see the board and click on cells to make a move. |
5.2.3. White Box <building block m>
<white box template>
5.3. Level 3
5.3.1. White Box <_building block x.1_>
<white box template>
5.3.2. White Box <_building block x.2_>
<white box template>
5.3.3. White Box <_building block y.1_>
<white box template>
6. Runtime View
This section illustrates key runtime operations and interactions among the system’s components.
6.1. User registration
This scenario shows how a user registers in the system, including how the frontend and backend communicate.
6.2. Game loop
This scenario shows how a user plays a game, including interactions with the web app, game core, and bot service.
7. Deployment View
7.1. Infrastructure Level 1
This level describes the distribution of the system across the environments used during the development and production phases of the YOVI_en3a project.
Motivation The project is designed to be highly portable. By using a Virtual Machine on Azure, we ensure that the application is accessible via a public IP/DNS for grading and testing, while the local environment is used for rapid development.
Quality and/or Performance Features * Availability: The Azure VM provides a stable 24/7 uptime. * Security: Management access is restricted via SSH (Port 22). Public access is strictly limited to Ports 80, 3000, and 4000 via Azure Network Security Groups. * Portability: The entire stack is containerized, allowing the team to switch from Azure to any other cloud provider with minimal configuration changes.
Mapping
| Element | Software Artifacts (Building Blocks) |
|---|---|
Local Developer PC |
Source code, Node.js environment, Rust toolchain, and local Docker Desktop. |
Azure VM (Ubuntu) |
Production containers: |
7.2. Infrastructure Level 2
This level zooms into the internal structure of the production environment hosted on Azure.
7.2.1. Azure Virtual Machine (Docker Host)
The system is orchestrated using Docker Compose within a single Ubuntu-based Virtual Machine.
Motivation Using a single VM with Docker Compose reduces architectural complexity and costs for the University project while maintaining complete isolation between the microservices.
Quality and/or Performance Features
-
Resource Efficiency: The
gameyengine uses a multi-stage Docker build (based ondebian:bookworm-slim). This ensures the VM does not waste RAM or Disk space on the Rust compiler during execution. -
Orchestration & Decoupling: The game-manager acts as a central orchestrator, ensuring that only one service depends on the gamey engine. This isolates the complex Rust logic, simplifying maintenance and decoupling game state from raw calculations.
-
Persistence: A Docker Volume is used for the MongoDB container, ensuring data remains intact even if the container is recreated.
-
Isolation: All containers communicate through a private bridge network (
monitor-net).
Mapping
| Infrastructure Element | Artifact | Execution Environment |
|---|---|---|
Container: webapp |
React/Vite SPA |
Nginx / Static HTTP Server |
Container: gatewayservice |
Express Proxy / Helmet |
Node.js 20+ (Entry Point) |
Container: users |
Node.js / Express API |
Node.js 20+ Runtime |
Container: game-manager |
Node.js / Orchestrator |
Node.js 20+ Runtime |
Container: gamey |
Rust Server Binary |
Debian Slim (No compiler) |
Container: mongodb |
MongoDB Image |
Mongo 6.0+ Engine |
Storage Volume |
User Database Files |
Persistent Host File System |
Azure connections
7.2.2. Communication Channels
The following channels facilitate data exchange between the infrastructure nodes:
-
HTTP (Port 80): Used by the end-user’s browser to download the
webappassets. -
REST/JSON (Port 8000): The single entry point for all API communication. The
gatewayservicereceives requests from the frontend and routes them tousers,game-manager, orgameybased on the URL path. -
Internal Microservice Communication: Services communicate within the
monitor-netDocker network. Thegame-managerrequests move validations fromgameyvia internal REST calls. -
Database Access (Port 27017): Internal connection using the MongoDB Wire Protocol. Used by
usersfor profile management andgame-managerfor persistent board state storage. -
SSH (Port 22): Secure management channel for developers to perform
git pullanddocker-compose upoperations.
8. Cross-cutting Concepts
8.1. <Concept 1>
<explanation>
8.2. <Concept 2>
<explanation>
…
8.3. <Concept n>
<explanation>
9. Architecture Decisions
10. Quality Requirements
10.1. Quality Tree
10.2. Quality Scenarios
11. Risks and Technical Debts
12. Glossary
| Term | Definition |
|---|---|
<Term-1> |
<definition-1> |
<Term-2> |
<definition-2> |
