# 14net-fiap/fiap.cloudgames architecture

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

- Interactive diagram: https://gitdiagram.com/14net-fiap/fiap.cloudgames
- Repository: https://github.com/14net-fiap/fiap.cloudgames

## Overview

FIAP.CloudGames is a cloud-games API for managing users and authentication, games, promotions, and personal game libraries. Its principal workflow is a client request entering a controller, being handled by an application service, and using repositories to read or change domain data. LibraryService’s excerpt confirms user/game checks, promotion-based price calculation, and library writes; repository excerpts show SQL Server-backed persistence. Other API and service capabilities are represented from the file tree and SOURCE INDEX, but their internal calls were not sampled, so those links are left unverified.

Main entry points: [`FIAP.CloudGames.DataBase/Context/AppDbContext.cs`](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Context/AppDbContext.cs) (EF Core context), [`FIAP.CloudGames.Application/Services/LibraryService.cs`](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/LibraryService.cs) (Library management), [`FIAP.CloudGames.DataBase/Repositories/UserRepository.cs`](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/UserRepository.cs) (User repository), [`FIAP.CloudGames.Application/Services/AuthService.cs`](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/AuthService.cs) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_auth_api["Authentication API<br/>[AuthController.cs]"]
  node_games_api["Games API<br/>[GamesController.cs]"]
  node_library_api["Library API"]
  node_promotions_api["Promotions API"]
  node_users_api["Users API<br/>[UsersController.cs]"]
  node_health_api["Health check"]
end

subgraph group_application["Application Services"]
  node_auth_service["Authentication<br/>[AuthService.cs]"]
  node_games_service["Game management<br/>[GamesService.cs]"]
  node_library_service["Library management<br/>[LibraryService.cs]"]
  node_promotions_service["Promotion management"]
  node_users_service["User management<br/>[UsersService.cs]"]
end

subgraph group_domain["Domain Model"]
  node_user_model["User model<br/>[User.cs]"]
  node_game_model["Game model<br/>[Game.cs]"]
  node_promotion_model["Promotion model<br/>[Promotion.cs]"]
  node_library_model["Library item<br/>[UserLibrary.cs]"]
  node_domain_contracts["Repository contracts<br/>[Repositories]"]
  node_domain_results["Operation results<br/>[Result.cs]"]
end

subgraph group_persistence["SQL Persistence"]
  node_user_repository["User repository<br/>[UserRepository.cs]"]
  node_game_repository["Game repository<br/>[GameRepository.cs]"]
  node_promotion_repository["Promotion repository"]
  node_library_repository["Library repository"]
  node_db_context["EF Core context<br/>[AppDbContext.cs]"]
end

subgraph group_infrastructure["Infrastructure"]
  node_security["JWT security<br/>[SecurityHelper.cs]"]
  node_mongo_logging["Mongo logging"]
end

node_client(("API client"))
node_sql_server[("SQL Server")]
node_mongo[("MongoDB")]

node_client -.->|"sends request"| node_auth_api
node_client -.->|"sends request"| node_games_api
node_client -.->|"sends request"| node_library_api
node_client -.->|"sends request"| node_promotions_api
node_client -.->|"sends request"| node_users_api
node_client -.->|"sends request"| node_health_api
node_auth_api -.->|"dispatches to"| node_auth_service
node_games_api -.->|"dispatches to"| node_games_service
node_library_api -.->|"dispatches to"| node_library_service
node_promotions_api -.->|"dispatches to"| node_promotions_service
node_users_api -.->|"dispatches to"| node_users_service
node_auth_service -->|"finds login"| node_user_repository
node_auth_service -->|"hashes and signs"| node_security
node_library_service -->|"checks user"| node_user_repository
node_library_service -->|"checks game"| node_game_repository
node_library_service -->|"gets promotions"| node_promotion_repository
node_library_service -->|"reads and writes"| node_library_repository
node_library_service -->|"calculates price"| node_game_model
node_library_service -->|"creates item"| node_library_model
node_users_service -.->|"uses contract"| node_user_repository
node_games_service -.->|"uses contract"| node_game_repository
node_promotions_service -.->|"uses contract"| node_promotion_repository
node_user_repository -->|"queries data"| node_db_context
node_game_repository -->|"queries data"| node_db_context
node_promotion_repository -->|"queries data"| node_db_context
node_db_context -->|"maps entity"| node_user_model
node_db_context -->|"maps entity"| node_game_model
node_db_context -->|"maps entity"| node_promotion_model
node_db_context -->|"maps entity"| node_library_model
node_db_context -.->|"persists data"| node_sql_server
node_mongo_logging -.->|"writes logs"| node_mongo

click node_auth_api "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/AuthController.cs"
click node_games_api "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/GamesController.cs"
click node_library_api "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/LibraryController.cs"
click node_promotions_api "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/PromotionsController.cs"
click node_users_api "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/UsersController.cs"
click node_health_api "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/HealthCheckController.cs"
click node_auth_service "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/AuthService.cs"
click node_games_service "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/GamesService.cs"
click node_library_service "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/LibraryService.cs"
click node_promotions_service "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/PromotionService.cs"
click node_users_service "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/UsersService.cs"
click node_user_model "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/User.cs"
click node_game_model "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/Game.cs"
click node_promotion_model "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/Promotion.cs"
click node_library_model "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/UserLibrary.cs"
click node_domain_contracts "https://github.com/14net-fiap/fiap.cloudgames/tree/main/FIAP.CloudGames.Domain/Repositories"
click node_domain_results "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Services/Result.cs"
click node_user_repository "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/UserRepository.cs"
click node_game_repository "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/GameRepository.cs"
click node_promotion_repository "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/PromotionRepository.cs"
click node_library_repository "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/ILibraryRepository.cs"
click node_db_context "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Context/AppDbContext.cs"
click node_security "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Infra/Security/SecurityHelper.cs"
click node_mongo_logging "https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Infra/Logging/MongoLogWriterService.cs"

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_games_api,node_library_api,node_promotions_api,node_users_api,node_health_api,node_client toneBlue
class node_auth_service,node_games_service,node_library_service,node_promotions_service,node_users_service,node_sql_server,node_mongo toneAmber
class node_user_model,node_game_model,node_promotion_model,node_library_model,node_domain_contracts,node_domain_results toneMint
class node_user_repository,node_game_repository,node_promotion_repository,node_library_repository,node_db_context toneRose
class node_security,node_mongo_logging toneIndigo
```

## Components

### HTTP API

- [Authentication API](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/AuthController.cs): `FIAP.CloudGames/Controllers/AuthController.cs`
- [Games API](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/GamesController.cs): `FIAP.CloudGames/Controllers/GamesController.cs`
- [Library API](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/LibraryController.cs): `FIAP.CloudGames/Controllers/LibraryController.cs`
- [Promotions API](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/PromotionsController.cs): `FIAP.CloudGames/Controllers/PromotionsController.cs`
- [Users API](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/UsersController.cs): `FIAP.CloudGames/Controllers/UsersController.cs`
- [Health check](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames/Controllers/HealthCheckController.cs): `FIAP.CloudGames/Controllers/HealthCheckController.cs`

### Application Services

- [Authentication](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/AuthService.cs): `FIAP.CloudGames.Application/Services/AuthService.cs`
- [Game management](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/GamesService.cs): `FIAP.CloudGames.Application/Services/GamesService.cs`
- [Library management](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/LibraryService.cs): `FIAP.CloudGames.Application/Services/LibraryService.cs`
- [Promotion management](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/PromotionService.cs): `FIAP.CloudGames.Application/Services/PromotionService.cs`
- [User management](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Application/Services/UsersService.cs): `FIAP.CloudGames.Application/Services/UsersService.cs`

### Domain Model

- [User model](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/User.cs): `FIAP.CloudGames.Domain/Entities/User.cs`
- [Game model](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/Game.cs): `FIAP.CloudGames.Domain/Entities/Game.cs`
- [Promotion model](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/Promotion.cs): `FIAP.CloudGames.Domain/Entities/Promotion.cs`
- [Library item](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Entities/UserLibrary.cs): `FIAP.CloudGames.Domain/Entities/UserLibrary.cs`
- [Repository contracts](https://github.com/14net-fiap/fiap.cloudgames/tree/main/FIAP.CloudGames.Domain/Repositories): `FIAP.CloudGames.Domain/Repositories`
- [Operation results](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Domain/Services/Result.cs): `FIAP.CloudGames.Domain/Services/Result.cs`

### SQL Persistence

- [User repository](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/UserRepository.cs): `FIAP.CloudGames.DataBase/Repositories/UserRepository.cs`
- [Game repository](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/GameRepository.cs): `FIAP.CloudGames.DataBase/Repositories/GameRepository.cs`
- [Promotion repository](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/PromotionRepository.cs): `FIAP.CloudGames.DataBase/Repositories/PromotionRepository.cs`
- [Library repository](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Repositories/ILibraryRepository.cs): `FIAP.CloudGames.DataBase/Repositories/ILibraryRepository.cs`
- [EF Core context](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.DataBase/Context/AppDbContext.cs): `FIAP.CloudGames.DataBase/Context/AppDbContext.cs`

### Infrastructure

- [JWT security](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Infra/Security/SecurityHelper.cs): `FIAP.CloudGames.Infra/Security/SecurityHelper.cs`
- [Mongo logging](https://github.com/14net-fiap/fiap.cloudgames/blob/main/FIAP.CloudGames.Infra/Logging/MongoLogWriterService.cs): `FIAP.CloudGames.Infra/Logging/MongoLogWriterService.cs`

### Other components

- **API client**
- **SQL Server**
- **MongoDB**

## Connections

- API client → Authentication API: sends request
- API client → Games API: sends request
- API client → Library API: sends request
- API client → Promotions API: sends request
- API client → Users API: sends request
- API client → Health check: sends request
- Authentication API → Authentication: dispatches to
- Games API → Game management: dispatches to
- Library API → Library management: dispatches to
- Promotions API → Promotion management: dispatches to
- Users API → User management: dispatches to
- Authentication → User repository: finds login (evidence: `FIAP.CloudGames.Application/Services/AuthService.cs`)
- Authentication → JWT security: hashes and signs (evidence: `FIAP.CloudGames.Application/Services/AuthService.cs`)
- Library management → User repository: checks user (evidence: `FIAP.CloudGames.Application/Services/LibraryService.cs`)
- Library management → Game repository: checks game (evidence: `FIAP.CloudGames.Application/Services/LibraryService.cs`)
- Library management → Promotion repository: gets promotions (evidence: `FIAP.CloudGames.Application/Services/LibraryService.cs`)
- Library management → Library repository: reads and writes (evidence: `FIAP.CloudGames.Application/Services/LibraryService.cs`)
- Library management → Game model: calculates price (evidence: `FIAP.CloudGames.Application/Services/LibraryService.cs`)
- Library management → Library item: creates item (evidence: `FIAP.CloudGames.Application/Services/LibraryService.cs`)
- User management → User repository: uses contract
- Game management → Game repository: uses contract
- Promotion management → Promotion repository: uses contract
- User repository → EF Core context: queries data (evidence: `FIAP.CloudGames.DataBase/Repositories/UserRepository.cs`)
- Game repository → EF Core context: queries data (evidence: `FIAP.CloudGames.DataBase/Repositories/GameRepository.cs`)
- Promotion repository → EF Core context: queries data (evidence: `FIAP.CloudGames.DataBase/Repositories/PromotionRepository.cs`)
- EF Core context → User model: maps entity (evidence: `FIAP.CloudGames.DataBase/Context/AppDbContext.cs`)
- EF Core context → Game model: maps entity (evidence: `FIAP.CloudGames.DataBase/Context/AppDbContext.cs`)
- EF Core context → Promotion model: maps entity (evidence: `FIAP.CloudGames.DataBase/Context/AppDbContext.cs`)
- EF Core context → Library item: maps entity (evidence: `FIAP.CloudGames.DataBase/Context/AppDbContext.cs`)
- EF Core context → SQL Server: persists data
- Mongo logging → MongoDB: writes logs
