# juliusmieliauskas/programuinzinerija architecture

> Architecture diagram of the GitHub repository juliusmieliauskas/programuinzinerija, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/juliusmieliauskas/programuinzinerija
- Repository: https://github.com/juliusmieliauskas/programuinzinerija

## Overview

- Client (Frontend): Built using Blazor (.razor pages, layouts, components) housed in the Client folder. This handles the user interface, routing between game modules, and interactions (e.g., selecting training, playing games, viewing leaderboards and historical progress).
- Server (Backend): Located in the Server folder, it includes a set of ASP.NET controllers (for each game and data retrieval) that expose APIs for the client. It processes game results, handles exceptions (ExceptionCatcherController), and provides endpoints for game results and sample texts.
- Shared/Domain Logic: The shared code (in ClassLibrary and Shared directories) contains common models and logic classes (e.g., CalcGameResult, MemoryGameResult, ReactionGameResult, TypingGameResult) which are used consistently across both the Client and Server. Represent this as a library component that both layers depend on.
- Data Layer: Within the Server/Data directory, you have the AppDbContext (likely using Entity Framework Core) and various Repository classes. Represent the database as a separate component (DB) that the Server’s data layer interacts with.

##### Relationships and Data Flow
- That the Shared/Domain Library is referenced by both the Client and the Server, allowing for consistent data models and exception handling.
- Optionally, include the Tests component (organized under Tests/) as a separate block that performs integration and unit tests on both the Client-side pages and Server APIs. This clearly shows quality assurance and test coverage integration.

##### Architectural Patterns
- Separation of concerns: the Client (UI/interaction layer), the Server (API and business logic layer), and the Data Access Layer (repository pattern to interact with the database).
- MVC-like pattern in the Server with Controllers handling HTTP endpoints.
- Optionally mention the use of dependency injection (e.g., ServiceExtensions.cs) for decoupling and modularity.

##### Relevant Technologies and Libraries
- Blazor (for building the interactive web UI via .razor files).
- ASP.NET Core for the web API/server.
- Entity Framework Core (implied by AppDbContext) for database operations.
- Testing frameworks (unit and integration tests) as evidenced by the Tests directory.
- GitHub Actions workflows (located in .github/workflows) for CI/CD pipelines.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Frontend"
        Client["Client (Blazor App)"]:::frontend
    end

    subgraph "Backend"
        Server["Server (ASP.NET Core API)"]:::backend
        subgraph "Data Access"
            Data["Data Layer (Repositories & AppDbContext)"]:::data
            DB["Database (EF Core)"]:::database
        end
    end

    Shared["Shared Domain Library"]:::shared
    Tests["Tests (Integration/Unit)"]:::tests
    CI["CI/CD (GitHub Actions)"]:::ci

    Client -->|"calls_API"| Server
    Server -->|"calls_Repository"| Data
    Data -->|"persists_data"| DB

    Client ---|"uses_shared"| Shared
    Server ---|"uses_shared"| Shared

    CI -->|"triggers_tests"| Tests
    CI -->|"builds_Client"| Client
    CI -->|"builds_Server"| Server

    click Client "https://github.com/juliusmieliauskas/programuinzinerija/blob/main/Client/App.razor"
    click Server "https://github.com/juliusmieliauskas/programuinzinerija/blob/main/Server/Program.cs"
    click Shared "https://github.com/juliusmieliauskas/programuinzinerija/blob/main/ClassLibrary/Shared/CalcGameResult.cs"
    click Data "https://github.com/juliusmieliauskas/programuinzinerija/blob/main/Server/Data/AppDbContext.cs"
    click Tests "https://github.com/juliusmieliauskas/programuinzinerija/tree/main/Tests/ClientBlazorPageTests"
    click CI "https://github.com/juliusmieliauskas/programuinzinerija/blob/main/.github/workflows/build.yml"

    classDef frontend fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef backend fill:#ABEBC6,stroke:#28B463,stroke-width:2px;
    classDef shared fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef data fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
    classDef database fill:#F5CBA7,stroke:#E67E22,stroke-width:2px;
    classDef tests fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
    classDef ci fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
```
