# gundx2k4/sportclub architecture

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

- Interactive diagram: https://gitdiagram.com/gundx2k4/sportclub
- Repository: https://github.com/gundx2k4/sportclub

## Overview

LegendsTeamVN Badminton Club is a .NET Minimal API for managing badminton venues, courts, schedules, pricing, users, and authentication. The principal workflow is client request → endpoint → CQRS handler → repository or identity service → SQL-backed result, with Redis supporting authentication state. The tree also documents domain entities for bookings, payments, rentals, matches, reviews, vouchers, and notifications, plus optional RabbitMQ integration. Sampled handlers confirm filtering, pagination, DTO projection, JWT issuance, permission lookup, and cache writes; endpoint wiring and unsampled feature behavior are represented only at directory level.

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Boundary"]
  node_api_host["API Host<br/>[Program.cs]"]
  node_endpoints["Resource Endpoints<br/>[Endpoints]"]
end

subgraph group_app["Application Workflows"]
  node_cqrs["CQRS Pipeline<br/>[CQRS]"]
  node_auth_flow["Authentication Flow<br/>[Auth]"]
  node_venue_flow["Venue Workflows<br/>[Venues]"]
  node_court_flow["Court Workflows<br/>[Courts]"]
  node_pricing_flow["Pricing Workflows<br/>[CourtPricings]"]
  node_schedule_flow["Schedule Workflows<br/>[VenueSchedules]"]
  node_user_flow["User Workflows<br/>[Users]"]
end

subgraph group_domain["Domain and Persistence"]
  node_domain_model["Club Domain Model<br/>[Entities]"]
  node_venue_repo["Venue Repository<br/>[VenueRepository.cs]"]
  node_court_repo["Court Repository<br/>[CourtRepository.cs]"]
  node_pricing_repo["Pricing Repository"]
  node_schedule_repo["Schedule Repository"]
  node_badminton_context["Club DbContext"]
  node_sql_store[("Club SQL Database")]
end

subgraph group_platform["Platform Services"]
  node_identity_service["Identity Service"]
  node_identity_store[("Identity Database")]
  node_jwt_service["JWT Token Service<br/>[JwtTokenService.cs]"]
  node_cache_service[("Redis Cache")]
  node_event_bus["Integration Event Bus<br/>[EventBus.cs]"]
end

node_client(("API Client"))
node_rabbitmq["RabbitMQ Broker"]

node_client -->|"sends requests"| node_api_host
node_api_host -->|"hosts routes"| node_endpoints
node_endpoints -->|"dispatches requests"| node_cqrs
node_cqrs -->|"handles auth"| node_auth_flow
node_cqrs -->|"handles venues"| node_venue_flow
node_cqrs -->|"handles courts"| node_court_flow
node_cqrs -->|"handles pricing"| node_pricing_flow
node_cqrs -->|"handles schedules"| node_schedule_flow
node_cqrs -->|"handles users"| node_user_flow
node_auth_flow -->|"checks users"| node_identity_service
node_auth_flow -->|"generates tokens"| node_jwt_service
node_auth_flow -->|"stores sessions"| node_cache_service
node_user_flow -->|"reads identity"| node_identity_service
node_venue_flow -->|"queries venues"| node_venue_repo
node_court_flow -->|"queries courts"| node_court_repo
node_pricing_flow -->|"queries prices"| node_pricing_repo
node_schedule_flow -->|"queries schedules"| node_schedule_repo
node_venue_flow -->|"uses venue model"| node_domain_model
node_court_flow -->|"uses court model"| node_domain_model
node_pricing_flow -->|"uses pricing model"| node_domain_model
node_schedule_flow -->|"uses schedule model"| node_domain_model
node_venue_repo -->|"reads and writes"| node_badminton_context
node_court_repo -->|"reads and writes"| node_badminton_context
node_pricing_repo -->|"reads and writes"| node_badminton_context
node_schedule_repo -->|"reads and writes"| node_badminton_context
node_badminton_context -->|"persists entities"| node_sql_store
node_identity_service -->|"manages accounts"| node_identity_store
node_event_bus -.->|"publishes events"| node_rabbitmq

click node_api_host "https://github.com/gundx2k4/sportclub/blob/main/src/Hosts/LegendsTeamVN.BadmintonClub.API/Program.cs"
click node_endpoints "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Presentation/Endpoints"
click node_cqrs "https://github.com/gundx2k4/sportclub/tree/main/src/BuildingBlocks/LegendsTeamVN.Core.Application/Messaging/CQRS"
click node_auth_flow "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Auth"
click node_venue_flow "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Venues"
click node_court_flow "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Courts"
click node_pricing_flow "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/CourtPricings"
click node_schedule_flow "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/VenueSchedules"
click node_user_flow "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Users"
click node_domain_model "https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Domain/Entities"
click node_venue_repo "https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/VenueRepository.cs"
click node_court_repo "https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/CourtRepository.cs"
click node_pricing_repo "https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/CourtPricingRepository.cs"
click node_schedule_repo "https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/VenueScheduleRepository.cs"
click node_badminton_context "https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/BadmintonDbContext.cs"
click node_identity_service "https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Identity/Services/UserManagerService.cs"
click node_jwt_service "https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Identity/Services/JwtTokenService.cs"
click node_cache_service "https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Infrastructure/Caching/RedisCacheService.cs"
click node_event_bus "https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Infrastructure/Messaging/EventBus.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_api_host,node_endpoints,node_client toneBlue
class node_cqrs,node_auth_flow,node_venue_flow,node_court_flow,node_pricing_flow,node_schedule_flow,node_user_flow toneAmber
class node_domain_model,node_venue_repo,node_court_repo,node_pricing_repo,node_schedule_repo,node_badminton_context,node_sql_store toneMint
class node_identity_service,node_identity_store,node_jwt_service,node_cache_service,node_event_bus toneRose
class node_rabbitmq toneIndigo
```

## Components

### API Boundary

- [API Host](https://github.com/gundx2k4/sportclub/blob/main/src/Hosts/LegendsTeamVN.BadmintonClub.API/Program.cs): `src/Hosts/LegendsTeamVN.BadmintonClub.API/Program.cs`
- [Resource Endpoints](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Presentation/Endpoints): `src/LegendsTeamVN.BadmintonClub.Presentation/Endpoints`

### Application Workflows

- [CQRS Pipeline](https://github.com/gundx2k4/sportclub/tree/main/src/BuildingBlocks/LegendsTeamVN.Core.Application/Messaging/CQRS): `src/BuildingBlocks/LegendsTeamVN.Core.Application/Messaging/CQRS`
- [Authentication Flow](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Auth): `src/LegendsTeamVN.BadmintonClub.Application/Features/Auth`
- [Venue Workflows](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Venues): `src/LegendsTeamVN.BadmintonClub.Application/Features/Venues`
- [Court Workflows](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Courts): `src/LegendsTeamVN.BadmintonClub.Application/Features/Courts`
- [Pricing Workflows](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/CourtPricings): `src/LegendsTeamVN.BadmintonClub.Application/Features/CourtPricings`
- [Schedule Workflows](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/VenueSchedules): `src/LegendsTeamVN.BadmintonClub.Application/Features/VenueSchedules`
- [User Workflows](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Application/Features/Users): `src/LegendsTeamVN.BadmintonClub.Application/Features/Users`

### Domain and Persistence

- [Club Domain Model](https://github.com/gundx2k4/sportclub/tree/main/src/LegendsTeamVN.BadmintonClub.Domain/Entities): `src/LegendsTeamVN.BadmintonClub.Domain/Entities`
- [Venue Repository](https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/VenueRepository.cs): `src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/VenueRepository.cs`
- [Court Repository](https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/CourtRepository.cs): `src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/CourtRepository.cs`
- [Pricing Repository](https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/CourtPricingRepository.cs): `src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/CourtPricingRepository.cs`
- [Schedule Repository](https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/VenueScheduleRepository.cs): `src/LegendsTeamVN.BadmintonClub.Persistence/Repositories/VenueScheduleRepository.cs`
- [Club DbContext](https://github.com/gundx2k4/sportclub/blob/main/src/LegendsTeamVN.BadmintonClub.Persistence/BadmintonDbContext.cs): `src/LegendsTeamVN.BadmintonClub.Persistence/BadmintonDbContext.cs`
- **Club SQL Database**

### Platform Services

- [Identity Service](https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Identity/Services/UserManagerService.cs): `src/BuildingBlocks/LegendsTeamVN.Core.Identity/Services/UserManagerService.cs`
- **Identity Database**
- [JWT Token Service](https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Identity/Services/JwtTokenService.cs): `src/BuildingBlocks/LegendsTeamVN.Core.Identity/Services/JwtTokenService.cs`
- [Redis Cache](https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Infrastructure/Caching/RedisCacheService.cs): `src/BuildingBlocks/LegendsTeamVN.Core.Infrastructure/Caching/RedisCacheService.cs`
- [Integration Event Bus](https://github.com/gundx2k4/sportclub/blob/main/src/BuildingBlocks/LegendsTeamVN.Core.Infrastructure/Messaging/EventBus.cs): `src/BuildingBlocks/LegendsTeamVN.Core.Infrastructure/Messaging/EventBus.cs`

### Other components

- **API Client**
- **RabbitMQ Broker**

## Connections

- API Client → API Host: sends requests
- API Host → Resource Endpoints: hosts routes
- Resource Endpoints → CQRS Pipeline: dispatches requests
- CQRS Pipeline → Authentication Flow: handles auth
- CQRS Pipeline → Venue Workflows: handles venues
- CQRS Pipeline → Court Workflows: handles courts
- CQRS Pipeline → Pricing Workflows: handles pricing
- CQRS Pipeline → Schedule Workflows: handles schedules
- CQRS Pipeline → User Workflows: handles users
- Authentication Flow → Identity Service: checks users
- Authentication Flow → JWT Token Service: generates tokens
- Authentication Flow → Redis Cache: stores sessions
- User Workflows → Identity Service: reads identity
- Venue Workflows → Venue Repository: queries venues
- Court Workflows → Court Repository: queries courts
- Pricing Workflows → Pricing Repository: queries prices
- Schedule Workflows → Schedule Repository: queries schedules
- Venue Workflows → Club Domain Model: uses venue model
- Court Workflows → Club Domain Model: uses court model
- Pricing Workflows → Club Domain Model: uses pricing model
- Schedule Workflows → Club Domain Model: uses schedule model
- Venue Repository → Club DbContext: reads and writes
- Court Repository → Club DbContext: reads and writes
- Pricing Repository → Club DbContext: reads and writes
- Schedule Repository → Club DbContext: reads and writes
- Club DbContext → Club SQL Database: persists entities
- Identity Service → Identity Database: manages accounts
- Integration Event Bus → RabbitMQ Broker: publishes events
