# vaselen/training architecture

> Architecture diagram of the GitHub repository vaselen/training, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vaselen/training
- Repository: https://github.com/vaselen/training

## Overview

DanceSchoolApi is a dance-school management API. Clients call controller endpoints for authentication and for managing students, teachers, teams, tariffs, and subscriptions; services apply domain rules and persist changes through Entity Framework. Subscription purchase is a key workflow: it validates the student, team, and tariff, checks age, capacity, and duplicate enrollment, then creates a dated subscription. The graph reflects the sampled service logic and SOURCE INDEX references; links not evidenced in those sources are omitted.

Main entry points: [`DanceSchoolApi/Services/SubscriptionService.cs`](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/SubscriptionService.cs) (Subscription Service), [`DanceSchoolApi/Controllers`](https://github.com/vaselen/training/tree/main/DanceSchoolApi/Controllers) (API Controllers), [`DanceSchoolApi/Data/Danceschoolcontext.cs`](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Data/Danceschoolcontext.cs) (EF Context), [`DanceSchoolApi/Services/StudentService.cs`](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/StudentService.cs) (Student Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_controllers["API Controllers"]
  node_contracts["Request Responses"]
  node_authcontroller["Authentication<br/>[Authcontroller.cs]"]
end

subgraph group_services["Domain Services"]
  node_studentservice["Student Service<br/>[StudentService.cs]"]
  node_teacherservice["Teacher Service<br/>[TeacherService.cs]"]
  node_teamservice["Team Service<br/>[TeamService.cs]"]
  node_tariffservice["Tariff Service<br/>[TariffService.cs]"]
  node_subscriptionservice["Subscription Service"]
end

subgraph group_domain["Domain Model"]
  node_student["Student<br/>[Student.cs]"]
  node_teacher["Teacher<br/>[Teacher.cs]"]
  node_team["Team<br/>[Team.cs]"]
  node_tariff["Tariff<br/>[Tariff.cs]"]
  node_subscription["Subscription<br/>[Subscription.cs]"]
  node_users["Demo Users<br/>[Users.cs]"]
end

subgraph group_platform["Persistence and Security"]
  node_authoptions["JWT Options<br/>[AuthOptions.cs]"]
  node_program["Application Host<br/>[Program.cs]"]
  node_handler["Exception Mapping"]
  node_context["EF Context"]
end

node_client(("API Client"))
node_postgres[("PostgreSQL")]

node_client -->|"calls endpoints"| node_controllers
node_program -->|"maps routes"| node_controllers
node_controllers -->|"calls"| node_studentservice
node_controllers -->|"calls"| node_teacherservice
node_controllers -->|"calls"| node_teamservice
node_controllers -->|"calls"| node_tariffservice
node_controllers -->|"calls"| node_subscriptionservice
node_controllers -->|"calls"| node_subscriptionservice
node_controllers -->|"routes authentication"| node_authcontroller
node_authcontroller -->|"checks credentials"| node_users
node_authcontroller -->|"generates token"| node_authoptions
node_studentservice -->|"reads writes"| node_context
node_teacherservice -->|"reads writes"| node_context
node_teamservice -->|"reads writes"| node_context
node_tariffservice -->|"reads writes"| node_context
node_subscriptionservice -->|"reads writes"| node_context
node_context -->|"uses provider"| node_postgres
node_studentservice -->|"applies rules"| node_student
node_studentservice -->|"queries active"| node_subscriptionservice
node_teamservice -->|"validates updates"| node_team
node_teamservice -->|"checks capacity"| node_subscriptionservice
node_teamservice -->|"formats students"| node_studentservice
node_subscriptionservice -->|"validates age"| node_student
node_subscriptionservice -->|"checks eligibility"| node_team
node_subscriptionservice -->|"checks pricing"| node_tariff
node_subscriptionservice -->|"creates cancels"| node_subscription
node_program -->|"registers handler"| node_handler
node_program -->|"configures context"| node_context
node_program -->|"configures JWT"| node_authoptions
node_studentservice -->|"uses DTOs"| node_contracts
node_subscriptionservice -->|"uses DTOs"| node_contracts

click node_controllers "https://github.com/vaselen/training/tree/main/DanceSchoolApi/Controllers"
click node_contracts "https://github.com/vaselen/training/tree/main/DanceSchoolApi/Contracts"
click node_authcontroller "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Controllers/Authcontroller.cs"
click node_studentservice "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/StudentService.cs"
click node_teacherservice "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/TeacherService.cs"
click node_teamservice "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/TeamService.cs"
click node_tariffservice "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/TariffService.cs"
click node_subscriptionservice "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/SubscriptionService.cs"
click node_student "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Student.cs"
click node_teacher "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Teacher.cs"
click node_team "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Team.cs"
click node_tariff "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Tariff.cs"
click node_subscription "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Subscription.cs"
click node_users "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Users.cs"
click node_authoptions "https://github.com/vaselen/training/blob/main/DanceSchoolApi/AuthOptions.cs"
click node_program "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Program.cs"
click node_handler "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Infrastructure/ServiceExceptionHandler.cs"
click node_context "https://github.com/vaselen/training/blob/main/DanceSchoolApi/Data/Danceschoolcontext.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_controllers,node_contracts,node_authcontroller,node_client toneBlue
class node_studentservice,node_teacherservice,node_teamservice,node_tariffservice,node_subscriptionservice,node_postgres toneAmber
class node_student,node_teacher,node_team,node_tariff,node_subscription,node_users toneMint
class node_authoptions,node_program,node_handler,node_context toneRose
```

## Components

### HTTP API

- [API Controllers](https://github.com/vaselen/training/tree/main/DanceSchoolApi/Controllers): `DanceSchoolApi/Controllers`
- [Request Responses](https://github.com/vaselen/training/tree/main/DanceSchoolApi/Contracts): `DanceSchoolApi/Contracts`
- [Authentication](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Controllers/Authcontroller.cs): `DanceSchoolApi/Controllers/Authcontroller.cs`

### Domain Services

- [Student Service](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/StudentService.cs): `DanceSchoolApi/Services/StudentService.cs`
- [Teacher Service](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/TeacherService.cs): `DanceSchoolApi/Services/TeacherService.cs`
- [Team Service](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/TeamService.cs): `DanceSchoolApi/Services/TeamService.cs`
- [Tariff Service](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/TariffService.cs): `DanceSchoolApi/Services/TariffService.cs`
- [Subscription Service](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Services/SubscriptionService.cs): `DanceSchoolApi/Services/SubscriptionService.cs`

### Domain Model

- [Student](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Student.cs): `DanceSchoolApi/Models/Student.cs`
- [Teacher](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Teacher.cs): `DanceSchoolApi/Models/Teacher.cs`
- [Team](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Team.cs): `DanceSchoolApi/Models/Team.cs`
- [Tariff](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Tariff.cs): `DanceSchoolApi/Models/Tariff.cs`
- [Subscription](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Models/Subscription.cs): `DanceSchoolApi/Models/Subscription.cs`
- [Demo Users](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Users.cs): `DanceSchoolApi/Users.cs`

### Persistence and Security

- [JWT Options](https://github.com/vaselen/training/blob/main/DanceSchoolApi/AuthOptions.cs): `DanceSchoolApi/AuthOptions.cs`
- [Application Host](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Program.cs): `DanceSchoolApi/Program.cs`
- [Exception Mapping](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Infrastructure/ServiceExceptionHandler.cs): `DanceSchoolApi/Infrastructure/ServiceExceptionHandler.cs`
- [EF Context](https://github.com/vaselen/training/blob/main/DanceSchoolApi/Data/Danceschoolcontext.cs): `DanceSchoolApi/Data/Danceschoolcontext.cs`

### Other components

- **API Client**
- **PostgreSQL**

## Connections

- API Client → API Controllers: calls endpoints
- Application Host → API Controllers: maps routes (evidence: `DanceSchoolApi/Program.cs`)
- API Controllers → Student Service: calls (evidence: `DanceSchoolApi/Controllers/Studentscontroller.cs`)
- API Controllers → Teacher Service: calls (evidence: `DanceSchoolApi/Controllers/TeachersController.cs`)
- API Controllers → Team Service: calls (evidence: `DanceSchoolApi/Controllers/Teamscontroller.cs`)
- API Controllers → Tariff Service: calls (evidence: `DanceSchoolApi/Controllers/TariffsController.cs`)
- API Controllers → Subscription Service: calls (evidence: `DanceSchoolApi/Controllers/Subscriptionscontroller.cs`)
- API Controllers → Subscription Service: calls (evidence: `DanceSchoolApi/Controllers/Teamscontroller.cs`)
- API Controllers → Authentication: routes authentication
- Authentication → Demo Users: checks credentials (evidence: `DanceSchoolApi/Controllers/Authcontroller.cs`)
- Authentication → JWT Options: generates token (evidence: `DanceSchoolApi/Controllers/Authcontroller.cs`)
- Student Service → EF Context: reads writes (evidence: `DanceSchoolApi/Services/StudentService.cs`)
- Teacher Service → EF Context: reads writes
- Team Service → EF Context: reads writes (evidence: `DanceSchoolApi/Services/TeamService.cs`)
- Tariff Service → EF Context: reads writes (evidence: `DanceSchoolApi/Services/TariffService.cs`)
- Subscription Service → EF Context: reads writes (evidence: `DanceSchoolApi/Services/SubscriptionService.cs`)
- EF Context → PostgreSQL: uses provider
- Student Service → Student: applies rules (evidence: `DanceSchoolApi/Services/StudentService.cs`)
- Student Service → Subscription Service: queries active (evidence: `DanceSchoolApi/Services/StudentService.cs`)
- Team Service → Team: validates updates (evidence: `DanceSchoolApi/Services/TeamService.cs`)
- Team Service → Subscription Service: checks capacity (evidence: `DanceSchoolApi/Services/TeamService.cs`)
- Team Service → Student Service: formats students (evidence: `DanceSchoolApi/Services/TeamService.cs`)
- Subscription Service → Student: validates age (evidence: `DanceSchoolApi/Services/SubscriptionService.cs`)
- Subscription Service → Team: checks eligibility (evidence: `DanceSchoolApi/Services/SubscriptionService.cs`)
- Subscription Service → Tariff: checks pricing (evidence: `DanceSchoolApi/Services/SubscriptionService.cs`)
- Subscription Service → Subscription: creates cancels (evidence: `DanceSchoolApi/Services/SubscriptionService.cs`)
- Application Host → Exception Mapping: registers handler (evidence: `DanceSchoolApi/Program.cs`)
- Application Host → EF Context: configures context (evidence: `DanceSchoolApi/Program.cs`)
- Application Host → JWT Options: configures JWT (evidence: `DanceSchoolApi/Program.cs`)
- Student Service → Request Responses: uses DTOs (evidence: `DanceSchoolApi/Services/StudentService.cs`)
- Subscription Service → Request Responses: uses DTOs (evidence: `DanceSchoolApi/Services/SubscriptionService.cs`)
