# crea7orx/aslet architecture

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

- Interactive diagram: https://gitdiagram.com/crea7orx/aslet
- Repository: https://github.com/crea7orx/aslet

## Overview

##### High-Level Architecture Components

a) Client Application Layer (ASLET Project)
- Use a rectangle labeled "Desktop Client (Avalonia UI)"
- Sub-components:
- Views (UI Components)
- ViewModels (MVVM Pattern)
- Models (Data Structures)
- Services (Including Genetic Algorithm)

b) Server Layer (ASLET.Server)
- Use a rectangle labeled "API Server"
- Sub-components:
- REST Controllers
- Services
- Database Context
- Authentication System

c) Data Layer
- Database symbol
- Entity relationships for:
- Users
- Timetables
- Classes
- Teachers
- Rooms
- Subjects

##### Key Interactions to Highlight

- Client-Server communication via REST API
- Database interactions
- Authentication flow
- Timetable generation process

##### Special Components to Emphasize

a) Genetic Algorithm System
- Chromosome representation
- NSGA-II implementation
- Fitness evaluation
- Constraint handling

b) Timetable Generation Pipeline
- Flow from:
- Input validation
- Schedule generation
- Optimization
- Result delivery

##### Technical Details

- Framework indicators:
- Avalonia UI (Client)
- ASP.NET Core (Server)
- Entity Framework Core (Data Access)
- JWT Authentication

##### Component Relationships

Clear connections between:
- Models and ViewModels
- Services and Controllers
- Database entities and DTOs
- Authentication service and protected resources

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client[Client Application Layer]
        UI[Desktop Client - Avalonia UI]
        Views["Views"]:::ui
        ViewModels["ViewModels"]:::ui
        ClientModels["Models"]:::model
        ClientServices["Client Services"]:::service
        
        subgraph GA[Genetic Algorithm System]
            GAImpl["GA Implementation"]:::algorithm
            ChromosomeImpl["Chromosome Implementation"]:::algorithm
            FitnessEval["Fitness Evaluation"]:::algorithm
            Constraints["Constraint Handler"]:::algorithm
        end
        
        TimetableVis["Timetable Visualization"]:::ui
    end
    
    subgraph Server[Server Layer]
        API["REST API"]:::api
        Controllers["Controllers"]:::controller
        ServerServices["Server Services"]:::service
        Auth["Authentication System"]:::security
        DBContext["Database Context"]:::data
        DTOs["Data Transfer Objects"]:::model
        ServerModels["Server Models"]:::model
        
        subgraph TT[Timetable Generation]
            TTService["Timetable Service"]:::service
            Validation["Input Validation"]:::service
            Generation["Schedule Generation"]:::service
            Optimization["Optimization"]:::service
        end
    end
    
    subgraph Data[Data Layer]
        DB[(Database)]:::data
        Users[("Users")]:::data
        Timetables[("Timetables")]:::data
        Classes[("Classes")]:::data
        Teachers[("Teachers")]:::data
        Rooms[("Rooms")]:::data
        Subjects[("Subjects")]:::data
    end
    
    %% Relationships
    UI --> Views
    Views --> ViewModels
    ViewModels --> ClientModels
    ClientModels --> ClientServices
    ClientServices --> API
    
    API --> Controllers
    Controllers --> ServerServices
    Controllers --> Auth
    ServerServices --> DBContext
    DBContext --> DB
    
    DB --> Users
    DB --> Timetables
    DB --> Classes
    DB --> Teachers
    DB --> Rooms
    DB --> Subjects
    
    GAImpl --> ChromosomeImpl
    ChromosomeImpl --> FitnessEval
    FitnessEval --> Constraints
    
    TTService --> Validation
    Validation --> Generation
    Generation --> Optimization
    
    %% Click Events
    click Views "https://github.com/Crea7orX/ASLET/tree/main/ASLET/Views/"
    click ViewModels "https://github.com/Crea7orX/ASLET/tree/main/ASLET/ViewModels/"
    click ClientModels "https://github.com/Crea7orX/ASLET/tree/main/ASLET/Models/"
    click GAImpl "https://github.com/Crea7orX/ASLET/tree/main/ASLET/Services/GeneticAlgorithm/"
    click ChromosomeImpl "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Chromosomes/"
    click Controllers "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Controllers/"
    click DBContext "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Context/"
    click Auth "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Services/Token/"
    click ServerModels "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Models/"
    click ServerServices "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Services/"
    click TTService "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/Services/Timetables/"
    click TimetableVis "https://github.com/Crea7orX/ASLET/blob/main/ASLET/Services/TimetableVisualizationService.cs"
    click DTOs "https://github.com/Crea7orX/ASLET/tree/main/ASLET.Server/DTOs/"
    
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:#fff
    classDef model fill:#2ecc71,stroke:#27ae60,color:#fff
    classDef service fill:#e74c3c,stroke:#c0392b,color:#fff
    classDef data fill:#f1c40f,stroke:#f39c12,color:#fff
    classDef api fill:#9b59b6,stroke:#8e44ad,color:#fff
    classDef security fill:#e67e22,stroke:#d35400,color:#fff
    classDef algorithm fill:#1abc9c,stroke:#16a085,color:#fff
    classDef controller fill:#34495e,stroke:#2c3e50,color:#fff
```
