# mahmoudsaeedyousef/gymos architecture

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

- Interactive diagram: https://gitdiagram.com/mahmoudsaeedyousef/gymos
- Repository: https://github.com/mahmoudsaeedyousef/gymos

## Overview

GymOS is a multi-tenant gym-management SaaS with a Flutter mobile shell and an ASP.NET API/application backend. The main operational workflow is a gym user making an API request that reaches a domain endpoint and application handler; handlers use tenant-aware application services and persist gym records through the database context. The tree documents authentication, members, plans, subscriptions, payments, attendance, visits and dashboard capabilities. Endpoint-to-handler dispatch beyond the sampled auth endpoint is not shown, so those links are omitted; unsampled capabilities are retained as subsystem nodes.

Main entry points: [`backend/GymOS.Api/Program.cs`](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Program.cs) (API host), [`backend/GymOS.Infrastructure/Data/GymDbContext.cs`](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Data/GymDbContext.cs) (Gym database context), [`backend/GymOS.Api/Endpoints/AuthEndpoints.cs`](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/AuthEndpoints.cs) (Authentication), [`backend/GymOS.Application/Interfaces/IGymDbContext.cs`](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Application/Interfaces/IGymDbContext.cs) (Database interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and identity"]
  node_api_host["API host<br/>[Program.cs]"]
  node_auth["Authentication<br/>[AuthEndpoints.cs]"]
  node_gym_endpoint["Gym endpoints<br/>[GymEndpoints.cs]"]
  node_attendance_endpoint["Attendance endpoints"]
  node_payments_endpoint["Payment endpoints"]
  node_plans_endpoint["Plan endpoints<br/>[PlansEndpoints.cs]"]
  node_visit_endpoint["Visit endpoints<br/>[VisitEndpoints.cs]"]
  node_dashboard_endpoint["Dashboard endpoints"]
end

subgraph group_operations["Gym operations"]
  node_members["Member management<br/>[Members]"]
  node_plans["Plan management<br/>[Plans]"]
  node_subscriptions["Subscriptions<br/>[Subscriptions]"]
  node_payments["Payments<br/>[Payments]"]
  node_visits["Drop-in visits"]
  node_attendance["Attendance<br/>[Attendance]"]
  node_dashboard["Dashboard<br/>[Dashboard]"]
end

subgraph group_domain["Domain records"]
  node_user_entity["User and tenant<br/>[ApplicationUser.cs]"]
  node_plan_entity["Plan<br/>[Plan.cs]"]
  node_subscription_entity["Subscription<br/>[Subscription.cs]"]
  node_attendance_entity["Attendance record"]
  node_payment_entity["Payment record<br/>[PaymentRecord.cs]"]
end

subgraph group_infrastructure["Persistence and services"]
  node_db_context[("Gym database context<br/>[GymDbContext.cs]")]
  node_db_port["Database interface<br/>[IGymDbContext.cs]"]
  node_tenant_service["Tenant service"]
  node_cache_service["Cache service"]
  node_file_storage["File storage"]
end

node_gym_user(("Gym user"))
node_mobile_app["Mobile app shell"]

node_gym_user -->|"sends requests"| node_api_host
node_api_host -->|"maps routes"| node_auth
node_api_host -->|"maps routes"| node_gym_endpoint
node_api_host -->|"maps routes"| node_attendance_endpoint
node_api_host -->|"maps routes"| node_payments_endpoint
node_api_host -->|"maps routes"| node_plans_endpoint
node_api_host -->|"maps routes"| node_visit_endpoint
node_api_host -->|"maps routes"| node_dashboard_endpoint
node_auth -->|"creates users"| node_user_entity
node_auth -->|"uses identity store"| node_db_context
node_api_host -->|"configures database"| node_db_context
node_api_host -->|"registers context"| node_db_port
node_api_host -->|"registers service"| node_tenant_service
node_api_host -->|"registers service"| node_cache_service
node_api_host -->|"registers service"| node_file_storage
node_visits -->|"reads and writes"| node_db_port
node_visits -->|"gets tenant"| node_tenant_service
node_db_context -->|"implements"| node_db_port
node_db_context -->|"stores"| node_user_entity
node_db_context -->|"stores"| node_plan_entity
node_db_context -->|"stores"| node_subscription_entity
node_db_context -->|"stores"| node_attendance_entity
node_db_context -->|"stores"| node_payment_entity
node_db_context -->|"applies tenant filters"| node_tenant_service

click node_api_host "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Program.cs"
click node_auth "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/AuthEndpoints.cs"
click node_members "https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Members"
click node_plans "https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Plans"
click node_subscriptions "https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Subscriptions"
click node_payments "https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Payments"
click node_visits "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Application/Features/Visits/Commands/RecordDropInVisit/RecordDropInVisitCommandHandler.cs"
click node_attendance "https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Attendance"
click node_dashboard "https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Dashboard"
click node_gym_endpoint "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/GymEndpoints.cs"
click node_attendance_endpoint "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/AttendanceEndpoints.cs"
click node_payments_endpoint "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/PaymentsEndpoints.cs"
click node_plans_endpoint "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/PlansEndpoints.cs"
click node_visit_endpoint "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/VisitEndpoints.cs"
click node_dashboard_endpoint "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/DashboardEndpoints.cs"
click node_user_entity "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/ApplicationUser.cs"
click node_plan_entity "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/Plan.cs"
click node_subscription_entity "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/Subscription.cs"
click node_attendance_entity "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/AttendanceRecord.cs"
click node_payment_entity "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/PaymentRecord.cs"
click node_db_context "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Data/GymDbContext.cs"
click node_db_port "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Application/Interfaces/IGymDbContext.cs"
click node_tenant_service "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Services/CurrentTenantService.cs"
click node_cache_service "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Services/InMemoryCacheService.cs"
click node_file_storage "https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Services/LocalFileStorageService.cs"
click node_mobile_app "https://github.com/mahmoudsaeedyousef/gymos/tree/main/app/gym_os"

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_auth,node_gym_endpoint,node_attendance_endpoint,node_payments_endpoint,node_plans_endpoint,node_visit_endpoint,node_dashboard_endpoint,node_gym_user toneBlue
class node_members,node_plans,node_subscriptions,node_payments,node_visits,node_attendance,node_dashboard toneAmber
class node_user_entity,node_plan_entity,node_subscription_entity,node_attendance_entity,node_payment_entity toneMint
class node_db_context,node_db_port,node_tenant_service,node_cache_service,node_file_storage toneRose
class node_mobile_app toneTeal
```

## Components

### API and identity

- [API host](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Program.cs): `backend/GymOS.Api/Program.cs`
- [Authentication](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/AuthEndpoints.cs): `backend/GymOS.Api/Endpoints/AuthEndpoints.cs`
- [Gym endpoints](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/GymEndpoints.cs): `backend/GymOS.Api/Endpoints/GymEndpoints.cs`
- [Attendance endpoints](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/AttendanceEndpoints.cs): `backend/GymOS.Api/Endpoints/AttendanceEndpoints.cs`
- [Payment endpoints](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/PaymentsEndpoints.cs): `backend/GymOS.Api/Endpoints/PaymentsEndpoints.cs`
- [Plan endpoints](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/PlansEndpoints.cs): `backend/GymOS.Api/Endpoints/PlansEndpoints.cs`
- [Visit endpoints](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/VisitEndpoints.cs): `backend/GymOS.Api/Endpoints/VisitEndpoints.cs`
- [Dashboard endpoints](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Api/Endpoints/DashboardEndpoints.cs): `backend/GymOS.Api/Endpoints/DashboardEndpoints.cs`

### Gym operations

- [Member management](https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Members): `backend/GymOS.Application/Features/Members`
- [Plan management](https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Plans): `backend/GymOS.Application/Features/Plans`
- [Subscriptions](https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Subscriptions): `backend/GymOS.Application/Features/Subscriptions`
- [Payments](https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Payments): `backend/GymOS.Application/Features/Payments`
- [Drop-in visits](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Application/Features/Visits/Commands/RecordDropInVisit/RecordDropInVisitCommandHandler.cs): `backend/GymOS.Application/Features/Visits/Commands/RecordDropInVisit/RecordDropInVisitCommandHandler.cs`
- [Attendance](https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Attendance): `backend/GymOS.Application/Features/Attendance`
- [Dashboard](https://github.com/mahmoudsaeedyousef/gymos/tree/main/backend/GymOS.Application/Features/Dashboard): `backend/GymOS.Application/Features/Dashboard`

### Domain records

- [User and tenant](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/ApplicationUser.cs): `backend/GymOS.Domain/Entities/ApplicationUser.cs`
- [Plan](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/Plan.cs): `backend/GymOS.Domain/Entities/Plan.cs`
- [Subscription](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/Subscription.cs): `backend/GymOS.Domain/Entities/Subscription.cs`
- [Attendance record](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/AttendanceRecord.cs): `backend/GymOS.Domain/Entities/AttendanceRecord.cs`
- [Payment record](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Domain/Entities/PaymentRecord.cs): `backend/GymOS.Domain/Entities/PaymentRecord.cs`

### Persistence and services

- [Gym database context](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Data/GymDbContext.cs): `backend/GymOS.Infrastructure/Data/GymDbContext.cs`
- [Database interface](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Application/Interfaces/IGymDbContext.cs): `backend/GymOS.Application/Interfaces/IGymDbContext.cs`
- [Tenant service](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Services/CurrentTenantService.cs): `backend/GymOS.Infrastructure/Services/CurrentTenantService.cs`
- [Cache service](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Services/InMemoryCacheService.cs): `backend/GymOS.Infrastructure/Services/InMemoryCacheService.cs`
- [File storage](https://github.com/mahmoudsaeedyousef/gymos/blob/main/backend/GymOS.Infrastructure/Services/LocalFileStorageService.cs): `backend/GymOS.Infrastructure/Services/LocalFileStorageService.cs`

### Other components

- **Gym user**
- [Mobile app shell](https://github.com/mahmoudsaeedyousef/gymos/tree/main/app/gym_os): `app/gym_os`

## Connections

- Gym user → API host: sends requests
- API host → Authentication: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Gym endpoints: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Attendance endpoints: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Payment endpoints: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Plan endpoints: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Visit endpoints: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Dashboard endpoints: maps routes (evidence: `backend/GymOS.Api/Program.cs`)
- Authentication → User and tenant: creates users (evidence: `backend/GymOS.Api/Endpoints/AuthEndpoints.cs`)
- Authentication → Gym database context: uses identity store (evidence: `backend/GymOS.Api/Endpoints/AuthEndpoints.cs`)
- API host → Gym database context: configures database (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Database interface: registers context (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Tenant service: registers service (evidence: `backend/GymOS.Api/Program.cs`)
- API host → Cache service: registers service (evidence: `backend/GymOS.Api/Program.cs`)
- API host → File storage: registers service (evidence: `backend/GymOS.Api/Program.cs`)
- Drop-in visits → Database interface: reads and writes (evidence: `backend/GymOS.Application/Features/Visits/Commands/RecordDropInVisit/RecordDropInVisitCommandHandler.cs`)
- Drop-in visits → Tenant service: gets tenant (evidence: `backend/GymOS.Application/Features/Visits/Commands/RecordDropInVisit/RecordDropInVisitCommandHandler.cs`)
- Gym database context → Database interface: implements (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
- Gym database context → User and tenant: stores (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
- Gym database context → Plan: stores (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
- Gym database context → Subscription: stores (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
- Gym database context → Attendance record: stores (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
- Gym database context → Payment record: stores (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
- Gym database context → Tenant service: applies tenant filters (evidence: `backend/GymOS.Infrastructure/Data/GymDbContext.cs`)
