# akilis16/swe-mst-api architecture

> Architecture diagram of the GitHub repository akilis16/swe-mst-api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/akilis16/swe-mst-api
- Repository: https://github.com/akilis16/swe-mst-api

## Overview

MST is a Spring API for cognitive games. A player authenticates, browses the game catalog, starts a game-specific play session, submits moves or answers, and receives a server-calculated score; session and progress endpoints expose the resulting history. The graph preserves the five documented game capabilities and the shared session/scoring layers. Edges use the README or shown service references; several game implementations and their controller wiring were not sampled, so those links are documented rather than source-verified.

Main entry points: [`src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/PlaySessionService.java) (Play sessions), [`src/main/java/com/project/mst/module/auth/AuthService.java`](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/auth/AuthService.java) (Authentication), [`src/main/java/com/project/mst/module/playsessions/MePlaySessionController.java`](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/MePlaySessionController.java) (Session and progress APIs), [`src/main/java/com/project/mst/module/games/GameService.java`](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameService.java) (Catalog service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and access"]
  node_auth_api["Authentication API"]
  node_auth_service["Authentication<br/>[AuthService.java]"]
  node_users[("Users and profiles<br/>[UserModel.java]")]
end

subgraph group_catalog["Game catalog"]
  node_catalog_api["Catalog API"]
  node_catalog_service["Catalog service<br/>[GameService.java]"]
  node_game_store[("Game catalog store")]
end

subgraph group_games["Cognitive games"]
  node_tic["Tic-tac-toe"]
  node_memory["Memory<br/>[MemoryService.java]"]
  node_quiz["Quiz"]
  node_sudoku["Sudoku<br/>[SudokuService.java]"]
  node_hangman["Hangman"]
end

subgraph group_sessions["Sessions and scoring"]
  node_play_api["Session and progress APIs"]
  node_session_service["Play sessions"]
  node_session_store[("Session records")]
  node_progress["Progress summaries"]
  node_score_service["Score calculation<br/>[ScoreService.java]"]
  node_score_store[("Score records<br/>[ScoreModel.java]")]
end

subgraph group_foundation["Shared infrastructure"]
  node_crud["CRUD and soft delete<br/>[CrudService.java]"]
  node_base_repo["Repository base"]
  node_api_errors["API error handling"]
end

node_player(("Player"))

node_player -->|"registers or logs in"| node_auth_api
node_auth_api -.->|"handles credentials"| node_auth_service
node_auth_service -->|"creates or verifies"| node_users
node_auth_service -->|"returns JWT"| node_player
node_player -->|"browses games"| node_catalog_api
node_catalog_api -.->|"serves catalog"| node_catalog_service
node_catalog_service -->|"queries games"| node_game_store
node_player -->|"plays game"| node_tic
node_player -->|"plays game"| node_memory
node_player -->|"plays game"| node_quiz
node_player -->|"plays game"| node_sudoku
node_player -->|"plays game"| node_hangman
node_tic -->|"opens and finishes"| node_session_service
node_memory -->|"manages session"| node_session_service
node_quiz -->|"manages session"| node_session_service
node_sudoku -->|"manages session"| node_session_service
node_hangman -->|"manages session"| node_session_service
node_session_service -->|"checks enabled game"| node_catalog_service
node_session_service -->|"loads current user"| node_users
node_session_service -->|"creates and updates"| node_session_store
node_session_service -->|"requests score"| node_score_service
node_score_service -.->|"persists score"| node_score_store
node_player -->|"views history"| node_play_api
node_play_api -.->|"queries sessions"| node_session_service
node_play_api -.->|"requests progress"| node_progress
node_progress -.->|"summarizes sessions"| node_session_store
node_session_service -->|"inherits operations"| node_crud
node_crud -->|"uses repository"| node_base_repo
node_player -->|"receives problem details"| node_api_errors

click node_auth_api "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/auth/AuthController.java"
click node_auth_service "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/auth/AuthService.java"
click node_users "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/users/UserModel.java"
click node_catalog_api "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameController.java"
click node_catalog_service "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameService.java"
click node_game_store "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameRepository.java"
click node_tic "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/tictactoe/TicTacToeService.java"
click node_memory "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/memory/MemoryService.java"
click node_quiz "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/quizzes/QuizPlayService.java"
click node_sudoku "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/sudoku/SudokuService.java"
click node_hangman "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/hangman/HangmanService.java"
click node_play_api "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/MePlaySessionController.java"
click node_session_service "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/PlaySessionService.java"
click node_session_store "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/PlaySessionModel.java"
click node_progress "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/ProgressService.java"
click node_score_service "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/scores/ScoreService.java"
click node_score_store "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/scores/ScoreModel.java"
click node_crud "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/infra/service/CrudService.java"
click node_base_repo "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/infra/database/repository/BaseRepository.java"
click node_api_errors "https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/infra/controller/ExceptionHandlerController.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_api,node_auth_service,node_users toneBlue
class node_catalog_api,node_catalog_service,node_game_store toneAmber
class node_tic,node_memory,node_quiz,node_sudoku,node_hangman toneMint
class node_play_api,node_session_service,node_session_store,node_progress,node_score_service,node_score_store toneRose
class node_crud,node_base_repo,node_api_errors,node_player toneIndigo
```

## Components

### Identity and access

- [Authentication API](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/auth/AuthController.java): `src/main/java/com/project/mst/module/auth/AuthController.java`
- [Authentication](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/auth/AuthService.java): `src/main/java/com/project/mst/module/auth/AuthService.java`
- [Users and profiles](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/users/UserModel.java): `src/main/java/com/project/mst/module/users/UserModel.java`

### Game catalog

- [Catalog API](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameController.java): `src/main/java/com/project/mst/module/games/GameController.java`
- [Catalog service](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameService.java): `src/main/java/com/project/mst/module/games/GameService.java`
- [Game catalog store](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/games/GameRepository.java): `src/main/java/com/project/mst/module/games/GameRepository.java`

### Cognitive games

- [Tic-tac-toe](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/tictactoe/TicTacToeService.java): `src/main/java/com/project/mst/module/tictactoe/TicTacToeService.java`
- [Memory](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/memory/MemoryService.java): `src/main/java/com/project/mst/module/memory/MemoryService.java`
- [Quiz](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/quizzes/QuizPlayService.java): `src/main/java/com/project/mst/module/quizzes/QuizPlayService.java`
- [Sudoku](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/sudoku/SudokuService.java): `src/main/java/com/project/mst/module/sudoku/SudokuService.java`
- [Hangman](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/hangman/HangmanService.java): `src/main/java/com/project/mst/module/hangman/HangmanService.java`

### Sessions and scoring

- [Session and progress APIs](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/MePlaySessionController.java): `src/main/java/com/project/mst/module/playsessions/MePlaySessionController.java`
- [Play sessions](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/PlaySessionService.java): `src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`
- [Session records](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/PlaySessionModel.java): `src/main/java/com/project/mst/module/playsessions/PlaySessionModel.java`
- [Progress summaries](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/playsessions/ProgressService.java): `src/main/java/com/project/mst/module/playsessions/ProgressService.java`
- [Score calculation](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/scores/ScoreService.java): `src/main/java/com/project/mst/module/scores/ScoreService.java`
- [Score records](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/module/scores/ScoreModel.java): `src/main/java/com/project/mst/module/scores/ScoreModel.java`

### Shared infrastructure

- [CRUD and soft delete](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/infra/service/CrudService.java): `src/main/java/com/project/mst/infra/service/CrudService.java`
- [Repository base](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/infra/database/repository/BaseRepository.java): `src/main/java/com/project/mst/infra/database/repository/BaseRepository.java`
- [API error handling](https://github.com/akilis16/swe-mst-api/blob/main/src/main/java/com/project/mst/infra/controller/ExceptionHandlerController.java): `src/main/java/com/project/mst/infra/controller/ExceptionHandlerController.java`

### Other components

- **Player**

## Connections

- Player → Authentication API: registers or logs in
- Authentication API → Authentication: handles credentials
- Authentication → Users and profiles: creates or verifies (evidence: `src/main/java/com/project/mst/module/auth/AuthService.java`)
- Authentication → Player: returns JWT (evidence: `src/main/java/com/project/mst/module/auth/AuthService.java`)
- Player → Catalog API: browses games
- Catalog API → Catalog service: serves catalog (evidence: `src/main/java/com/project/mst/module/games/GameController.java`)
- Catalog service → Game catalog store: queries games (evidence: `src/main/java/com/project/mst/module/games/GameService.java`)
- Player → Tic-tac-toe: plays game
- Player → Memory: plays game
- Player → Quiz: plays game
- Player → Sudoku: plays game
- Player → Hangman: plays game
- Tic-tac-toe → Play sessions: opens and finishes (evidence: `src/main/java/com/project/mst/module/tictactoe/TicTacToeService.java`)
- Memory → Play sessions: manages session (evidence: `src/main/java/com/project/mst/module/memory/MemoryService.java`)
- Quiz → Play sessions: manages session (evidence: `src/main/java/com/project/mst/module/quizzes/QuizPlayService.java`)
- Sudoku → Play sessions: manages session (evidence: `src/main/java/com/project/mst/module/sudoku/SudokuService.java`)
- Hangman → Play sessions: manages session (evidence: `src/main/java/com/project/mst/module/hangman/HangmanService.java`)
- Play sessions → Catalog service: checks enabled game (evidence: `src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`)
- Play sessions → Users and profiles: loads current user (evidence: `src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`)
- Play sessions → Session records: creates and updates (evidence: `src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`)
- Play sessions → Score calculation: requests score (evidence: `src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`)
- Score calculation → Score records: persists score (evidence: `src/main/java/com/project/mst/module/scores/ScoreService.java`)
- Player → Session and progress APIs: views history
- Session and progress APIs → Play sessions: queries sessions
- Session and progress APIs → Progress summaries: requests progress
- Progress summaries → Session records: summarizes sessions (evidence: `src/main/java/com/project/mst/module/playsessions/ProgressService.java`)
- Play sessions → CRUD and soft delete: inherits operations (evidence: `src/main/java/com/project/mst/module/playsessions/PlaySessionService.java`)
- CRUD and soft delete → Repository base: uses repository (evidence: `src/main/java/com/project/mst/infra/service/CrudService.java`)
- Player → API error handling: receives problem details
