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
YOVI is a gaming suite developed for Micrati based on "Game Y". The system allows users to play hexagonal board games against the computer and provides an interface for external bots.
Key functional requirements include:
-
Core Gameplay: Implementation of classic Game Y with variable board sizes.
-
AI Strategies: Support for multiple machine strategies and selectable difficulty levels.
-
User Management: Registration and match history tracking (win/loss stats).
-
External Access: A fully documented API for bot interaction using YEN notation.
-
Public Availability: The system must be deployed and accessible via the web.
1.2. Quality Goals
The following table presents the top five quality goals for the YOVI architecture, ordered by priority. These goals have been identified based on stakeholder expectations and the ISO 25010 quality model. They represent the most critical quality attributes that will guide architectural decisions throughout the project and serve as the primary criteria for evaluating the success of the system.
| Priority | Quality Goal | Concrete Scenario |
|---|---|---|
1 |
Performance Efficiency |
The Rust engine must respond to move validation and AI suggestions in under 200ms, ensuring a smooth gameplay experience even during peak usage. |
2 |
Compatibility (Interoperability) |
The system must allow external bots to connect via a well-documented JSON API (YEN notation), enabling third-party developers to create their own game clients. |
3 |
Functional Suitability |
The Rust engine must accurately implement all "Game Y" rules, and the web frontend must cover all user stories including registration, gameplay, and statistics. |
4 |
Maintainability |
The architecture must keep Rust logic independent from the TypeScript layer, with clear ADRs and >80% code coverage, allowing evaluators and future developers to understand and modify the system. |
5 |
Transferability |
The complete system must be deployable with a single Docker command, ensuring evaluators can easily install and test the application on any modern environment. |
1.3. Stakeholders
This section provides an explicit overview of the stakeholders of the system. Stakeholders include all persons, roles, or organizations that should know the architecture, need to be convinced of it, have to work with the architecture or codebase, require the documentation for their work, or are involved in making decisions about the system and its development. We have identified the following stakeholders related to our project:
| Category | Stakeholder | Impact | Influence | Key Interests & Expectations |
|---|---|---|---|---|
1. Primary Owners |
Micrati |
Critical |
High |
Successful delivery of the YOVI suite based on "Game Y". |
2. End Users |
Human Players |
High |
Medium |
Smooth UX, web-based matches, and accurate statistics. |
Bot Developers |
Medium |
Medium |
Robust external API and clear technical documentation. |
|
3. Technical Team |
Project Team |
Critical |
High |
Proper implementation of TypeScript and Rust subsystems. |
Architects |
High |
High |
Structural integrity, ADR maintenance, and quality attributes. |
|
DevOps/SysAdmin |
Medium |
Medium |
Seamless CI/CD, deployment, and system monitoring. |
|
4. External |
Competing Teams |
Low |
Low |
Interoperability and compatibility for optional matches. |
5. Academic |
Evaluators |
Critical |
High |
Test coverage, documentation quality, and project management. |
2. Architecture Constraints
| Constraint | Description |
|---|---|
Programming Languages |
The Web application must be implemented in TypeScript; the logic/strategy module must be in Rust. |
Data Exchange |
Communication must use JSON messages following the YEN notation standard. |
Interface Architecture |
The Rust module must be exposed as a basic web service interface (stateless). |
Project Management |
Mandatory use of GitHub Issues for task tracking and ADRs for documenting architectural decisions. |
Infrastructure |
The system must be deployed to a public cloud provider using automated CI/CD. |
3. Context and Scope
| Neighbor | Description |
|---|---|
User |
Human player who interacts with the YOVI web application. They can play matches of "Game Y", register in the system, and consult their win/loss statistics and rankings. |
Bot / External API |
External automated systems that interact with the application through a documented API. They can manage user data and play matches by sending board states in YEN notation. |
Rust Module |
External module that provides a web service interface. It is responsible for verifying match victories and suggesting the next move using JSON messages. |
Database |
Persistence system used to store user registration information, match history, and performance metrics. |
3.1. Technical Context
| Interface | Channel | Description / Format |
|---|---|---|
User Interface |
Web Browser |
Allows human players to interact with the game, register, and view statistics. |
Bot / External API |
External API |
Allows automated systems to manage data and play matches using JSON (YEN Notation). |
Game Logic Service |
Web Service |
Internal communication with the Rust Module to verify match victories and request move suggestions using JSON (YEN Notation). |
Persistence Layer |
Database Connection |
System used to store user registration information, match history, and performance metrics. |
Technical Details YEN Notation: All game-related data exchange (size, turn, players, and layout) must strictly follow the JSON-based YEN notation.
Coordinate Systems: The system handles the coordinates using both barycentric coordinates (x, y, z) and linear indices.
Deployment: The application is designed to be deployed (through Docker) and publicly accessible via the Web.
4. Solution Strategy
4.1. Strategic Decisions
| Goal / Problem | Decision | Rationale |
|---|---|---|
Database Technology |
SQL (PostgreSQL) |
A relational database ensures data integrity for users and matches. PostgreSQL offers flexibility and robustness for long-term storage. |
Backend Architecture |
Component-based & Layered |
Organized into independent components with layers (entry-points, domain, data-access) to ensure maintainability and separation of concerns. |
Game Logic Engine |
Rust |
High-performance engine to handle Game Y logic. It allows the implementation of complex AI strategies without sacrificing response time. |
Frontend Technology |
Web Application (React) |
The user interface is developed as a web application. The team prioritized Quality of Life (QoL) features such as Hints and Undo button, while discarding complex media features like video chat. |
AI Levels |
Selectable Difficulty |
The system provides multiple difficulty levels. This satisfies the requirement of having more than one machine strategy (e.g., Random vs. Minimax). |
User Interaction |
Text-based Chat |
A lightweight text chat is implemented to enhance social interaction between players without the technical overhead of video/audio streaming. |
Security |
Hashing & Env Variables |
Encryption for passwords and environment variables for secrets to follow security best practices. |
Ranking System |
Winrate Metric |
Focuses on the win/loss ratio to provide a simple but competitive ranking for the leaderboard. |
4.2. Organizational & Development Strategy
Decisions regarding team coordination and workflow to ensure project quality:
-
Task Distribution: Work is divided into fixed sub-groups of 2-3 people (Frontend, Backend, Rust/Docs) to ensure code reviews and knowledge sharing.
-
GitHub Workflow:
-
Pull Requests are reviewed by the sub-group (Frontend/Backend) NOT related to the topic itself, ensuring shared understanding of project upgrades among team members.
-
-
Documentation: Developed collaboratively and consolidated in specific sessions.
5. Building Block View
The building block view shows the static decomposition of the system into building blocks (modules, components, subsystems, classes, interfaces, etc.) as well as their dependencies. In analogy to a house, this is the floor plan.
5.1. Whitebox Overall System
- Motivation
-
The YOVI system follows the Separation of Concerns principle. It uses a modern React frontend for user interaction, a Node.js microservice for user data management, and a high-performance Rust engine for game logic. This hybrid architecture ensures scalability and runtime efficiency.
- Contained Building Blocks
| Name | Responsibility |
|---|---|
Webapp |
React-based frontend. Visualizes the game board, manages user registration, and provides a REST API for bot interactions. |
Users Service |
Node.js backend managing user profiles, authentication, and game history metrics. |
Gamey Engine |
Rust-based engine that validates Game Y rules, checks win conditions, and generates AI moves. |
PostgreSQL |
Relational database for persistent storage of user profiles and match statistics. |
- Important Interfaces
-
-
YEN Notation: Standard JSON format carrying board states between the Webapp and Gamey Engine.
-
REST API (Internal): Endpoints enabling communication between the Webapp and Users Service.
-
5.1.1. Webapp (Black Box)
- Purpose/Responsibility
-
Providing the user interface and system access for human players and external bots.
- Interface(s)
-
Web GUI (HTML/CSS/TS), External Bot REST API (JSON).
- Directory/File Location
-
/webapp - Fulfilled Requirements
-
Web frontend, Bot interaction API, User registration.
5.1.2. Users Service (Black Box)
- Purpose/Responsibility
-
Managing user information and game metrics through database communication.
- Interface(s)
-
Internal REST API (Node.js/Express over Port 3000).
- Directory/File Location
-
/users - Fulfilled Requirements
-
Registration system, Match history, Win/Loss statistics.
5.1.3. Gamey Engine (Black Box)
- Purpose/Responsibility
-
Execution of Game Y rules and providing AI strategies at multiple difficulty levels.
- Interface(s)
-
YEN Service Interface (JSON/HTTP over Port 4000).
- Quality Characteristics
-
High calculation speed (Rust), Memory safety, and high concurrency.
- Directory/File Location
-
/gamey - Fulfilled Requirements
-
Rule validation, Next move suggestions, Multiple AI strategies.
5.2. 5.2 Level 2
5.2.1. 5.2.1 White Box Gamey Engine
Since the Gamey Engine handles the core logic of Game Y, its internal structure is detailed to show the decoupling of rules and strategies.
Contained Building Blocks (Black Boxes):
| Name | Responsibility |
|---|---|
Web Interface |
The REST controller that receives YEN-encoded requests from the Webapp. |
Core Logic |
The engine’s core that validates Game Y rules and determines game outcomes. |
Strategy Registry |
Manages various AI difficulty levels and provides next-move suggestions. |
YEN Parser |
Translates between JSON-based YEN notation and internal Rust data structures. |
5.2.2. 5.2.2 White Box Webapp
The Webapp is the primary interface for users. Its internal architecture separates visual components from communication logic.
Contained Building Blocks (Black Boxes):
| Name | Responsibility |
|---|---|
UI Components |
React views including the Game Board, Register Form, and Statistics dashboard. |
State Management |
Centralized client-side store maintaining the current game state and user session. |
API Client |
Orchestrates asynchronous HTTP communication with Users Service and Gamey Engine. |
- Important Interfaces
-
-
External Bot API: A direct endpoint in the API Client that allows bot actors to interact with the system without using the GUI.
-
Service Connectors: Outbound connections from the API Client to external microservices (Users/Gamey).
-
6. Runtime View
6.1. Full game
This diagram represents a full game, from when the user logs to when the user ends the game
6.2. Asking for a hint
This diagram represents the user asking for a hint
7. Deployment View
7.1. Infrastructure Level 1
- Motivation
-
The system is designed as a distributed web application. A central server hosts all the application logic and data (backend, game engine, database), while users access the game via standard web browsers. This centralized structure ensures data consistency and simplifies updates.
- Quality and/or Performance Features
-
-
Scalability: The server uses Docker, allowing easy scaling of resources if the number of players increases.
-
Accessibility: Users do not need to install any specific software; a web browser is sufficient.
-
Availability: The server is accessible 24/7 via the internet.
-
- Mapping of Building Blocks to Infrastructure
-
-
Client Device: Runs the
Frontend Application(React) inside the browser. -
External Bot Device: Runs custom bot scripts developed by third parties.
-
YOVI Server: Runs the
Backend (Users Service),Game Engine (Rust), andDatabase.
-
7.2. Infrastructure Level 2
7.2.1. Docker Host (Server)
This diagram illustrates the internal structure of the Server. The entire system is containerized using Docker, which ensures consistency across development and production environments.
-
Docker Host: The physical or virtual server running the Docker Engine.
-
WebApp Container: Hosts the React frontend application. It acts as the entry point for users and external bots. It forwards API requests to the backend services.
-
Users Service Container: A Node.js/Express application that handles user authentication and history management. It is not directly accessible from the outside; it only accepts requests from the WebApp.
-
GameY Service Container: The core game engine written in Rust. It processes game logic and validates moves. Like the Users Service, it is internal and accessed via the WebApp.
-
Database Container: A PostgreSQL instance used for persistent storage of user data and game history. It is strictly isolated and only accessible by the Users Service via TCP port 5432.
7.2.2. Client Device
This diagram illustrates the client-side deployment.
-
Client Device: Represents the physical hardware (PC or Mobile) used by the player.
-
Web Browser: The execution environment (e.g., Chrome, Firefox) that renders the application.
-
YOVI Web Client: The React/TypeScript application artifact downloaded from the server and executed within the browser.
7.2.3. External Bot Device
This diagram illustrates the deployment of an external bot that interacts with the YOVI system. Unlike human players, bots do not use a web browser; instead, they run as standalone scripts or applications.
-
External Bot Device: Represents any machine (local computer or server) hosting a third-party bot.
-
Bot Runtime: The environment required to execute the bot logic (e.g., Python Interpreter, Java Virtual Machine, or Node.js Runtime).
-
Bot Application: The actual code developed by third parties (or the development team for testing). It communicates with the YOVI System exclusively via the HTTP/REST API (JSON) provided by the Web Application.
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 Debt
11.1. Risk Mitigation Table
| Risk | Proactive Measure | Contingent Measure |
|---|---|---|
Team Attrition |
Maintain clean code and updated documentation so any member can take over. |
Redistribute tasks among remaining members; focus on MVP features. |
Uneven Learning Curves |
Conduct internal "Pair Programming" sessions for difficult modules (Rust). |
Reassign tasks based on individual strengths and simplify complexity. |
Rust Learning Curve |
Develop small Proof-of-Concepts (POCs) for YEN parsing and AI logic early. |
Use simpler AI strategies (e.g., Random Move) if logic becomes a bottleneck. |
Integration Failures |
Define a shared JSON Schema for YEN validation between TS and Rust. |
Hold emergency integration meetings to align data formats and parsers. |
Final Exam Pressure |
Set internal deadlines 2 weeks before the official delivery date. |
Shift focus to critical bug fixes and mandatory documentation only. |
Deployment Failures |
Configure and test CI/CD pipelines (GitHub Actions) in the first month. |
Perform manual deployments to alternative providers (e.g., Fly.io or Render). |
11.2. Technical Debt
-
AI Complexity: Initial AI versions will use basic heuristics; advanced algorithms are considered debt for later sprints.
-
Test Coverage: Reaching 80% automated coverage is a pending goal while focusing on core features.
-
YEN Robustness: Deep validation for malformed JSON from external bots is yet to be fully implemented.
12. Glossary
| Term | Definition |
|---|---|
<Term-1> |
<definition-1> |
<Term-2> |
<definition-2> |
