# shivamsharma01/gym-app architecture

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

- Interactive diagram: https://gitdiagram.com/shivamsharma01/gym-app
- Repository: https://github.com/shivamsharma01/gym-app

## Overview

This repository combines a gym-management web application with an on-premises device gateway and TrueFace/Dahua SDK examples. The principal workflow is gym staff using the web app to manage members and operations; device coordination is handled by a separate gateway that connects readers, relays events and commands, and links to a backend. The tree and excerpts show no backend implementation, so it is represented only as an external service. Several frontend and gateway capabilities are evident from routes or module names but their internal calls were not sampled; those links are omitted rather than inferred.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/shivamsharma01/gym-app/blob/main/frontend/src/lib/api.ts) (Web API client), [`gateway/src/Gym.Gateway/GatewayWorker.cs`](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/GatewayWorker.cs) (Gateway worker), [`frontend/src/main.tsx`](https://github.com/shivamsharma01/gym-app/blob/main/frontend/src/main.tsx) (Web routes), [`TrueFace_SDK/AccessDemo2s/AccessForm.cs`](https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/AccessForm.cs) (Access control demo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Gym Web App"]
  node_web_entry["Web routes<br/>[main.tsx]"]
  node_member_ops["Member management"]
  node_membership_ops["Memberships"]
  node_attendance_ops["Attendance"]
  node_device_ops["Device administration"]
  node_business_views["Business views"]
  node_web_api["Web API client<br/>[api.ts]"]
end

subgraph group_gateway["Device Gateway"]
  node_worker["Gateway worker<br/>[GatewayWorker.cs]"]
  node_backend_link["Backend link<br/>[BackendLink.cs]"]
  node_dispatcher["Command dispatcher"]
  node_watcher["Device watcher"]
  node_adapter_factory["Adapter factory"]
  node_device_adapter["Device adapter<br/>[IDeviceAdapter.cs]"]
  node_trueface_adapter["TrueFace adapter"]
  node_outbound_store[("Outbound queue store")]
  node_enrollment["Gateway enrollment"]
end

subgraph group_device["Reader SDK Demo"]
  node_reader_demo["Access control demo<br/>[AccessForm.cs]"]
  node_user_demo["User management<br/>[UserManageFrom.cs]"]
  node_record_demo["Record queries<br/>[RecordQueryForm.cs]"]
  node_sdk_common["Demo utilities<br/>[Common.cs]"]
end

subgraph group_poc["Gateway POCs"]
  node_windows_poc["Windows device POC<br/>[Program.cs]"]
  node_linux_poc["Linux SDK POC<br/>[Program.cs]"]
  node_sdk_probe["SDK probe<br/>[Program.cs]"]
end

node_staff(("Gym staff"))
node_backend{{"Gym backend"}}

node_staff -->|"uses"| node_web_entry
node_web_entry -->|"routes to"| node_member_ops
node_web_entry -->|"routes to"| node_membership_ops
node_web_entry -->|"routes to"| node_attendance_ops
node_web_entry -->|"routes to"| node_device_ops
node_member_ops -.->|"requests"| node_web_api
node_membership_ops -.->|"requests"| node_web_api
node_attendance_ops -.->|"requests"| node_web_api
node_device_ops -.->|"requests"| node_web_api
node_business_views -.->|"requests"| node_web_api
node_web_api -.->|"calls"| node_backend
node_worker -->|"uses"| node_backend_link
node_worker -->|"dispatches"| node_dispatcher
node_worker -->|"starts"| node_watcher
node_worker -->|"creates adapters"| node_adapter_factory
node_worker -->|"commands"| node_device_adapter
node_backend_link -->|"persists messages"| node_outbound_store
node_backend_link -.->|"exchanges messages"| node_backend
node_adapter_factory -->|"selects"| node_trueface_adapter
node_trueface_adapter -->|"implements"| node_device_adapter
node_enrollment -->|"enrolls"| node_backend
node_reader_demo -->|"opens"| node_user_demo
node_reader_demo -->|"opens"| node_record_demo
node_reader_demo -->|"uses"| node_sdk_common
node_windows_poc -->|"uses"| node_device_adapter

click node_web_entry "https://github.com/shivamsharma01/gym-app/blob/main/frontend/src/main.tsx"
click node_member_ops "https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/members"
click node_membership_ops "https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/memberships"
click node_attendance_ops "https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/attendance"
click node_device_ops "https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/devices"
click node_business_views "https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features"
click node_web_api "https://github.com/shivamsharma01/gym-app/blob/main/frontend/src/lib/api.ts"
click node_worker "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/GatewayWorker.cs"
click node_backend_link "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/BackendLink.cs"
click node_dispatcher "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/CommandDispatcher.cs"
click node_watcher "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/DeviceChangeWatcher.cs"
click node_adapter_factory "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway.Adapters/DeviceAdapterFactory.cs"
click node_device_adapter "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway.Adapters/IDeviceAdapter.cs"
click node_trueface_adapter "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway.Adapters/TrueFaceDeviceAdapter.cs"
click node_outbound_store "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/DurableOutboundStore.cs"
click node_enrollment "https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/Config/GatewayEnrollmentClient.cs"
click node_reader_demo "https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/AccessForm.cs"
click node_user_demo "https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/UserManager/UserManageFrom.cs"
click node_record_demo "https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/QueryRecord/RecordQueryForm.cs"
click node_sdk_common "https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/Common.cs"
click node_windows_poc "https://github.com/shivamsharma01/gym-app/blob/main/TrueFaceWindowsPOC/Program.cs"
click node_linux_poc "https://github.com/shivamsharma01/gym-app/blob/main/TrueFaceLinuxPOC/Program.cs"
click node_sdk_probe "https://github.com/shivamsharma01/gym-app/blob/main/gateway/tools/Gym.Gateway.SdkProbe/Program.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_web_entry,node_member_ops,node_membership_ops,node_attendance_ops,node_device_ops,node_business_views,node_web_api toneBlue
class node_worker,node_backend_link,node_dispatcher,node_watcher,node_adapter_factory,node_device_adapter,node_trueface_adapter,node_outbound_store,node_enrollment toneAmber
class node_reader_demo,node_user_demo,node_record_demo,node_sdk_common toneMint
class node_windows_poc,node_linux_poc,node_sdk_probe toneRose
class node_staff,node_backend toneIndigo
```

## Components

### Gym Web App

- [Web routes](https://github.com/shivamsharma01/gym-app/blob/main/frontend/src/main.tsx): `frontend/src/main.tsx`
- [Member management](https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/members): `frontend/src/features/members`
- [Memberships](https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/memberships): `frontend/src/features/memberships`
- [Attendance](https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/attendance): `frontend/src/features/attendance`
- [Device administration](https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features/devices): `frontend/src/features/devices`
- [Business views](https://github.com/shivamsharma01/gym-app/tree/main/frontend/src/features): `frontend/src/features`
- [Web API client](https://github.com/shivamsharma01/gym-app/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Device Gateway

- [Gateway worker](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/GatewayWorker.cs): `gateway/src/Gym.Gateway/GatewayWorker.cs`
- [Backend link](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/BackendLink.cs): `gateway/src/Gym.Gateway/BackendLink.cs`
- [Command dispatcher](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/CommandDispatcher.cs): `gateway/src/Gym.Gateway/CommandDispatcher.cs`
- [Device watcher](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/DeviceChangeWatcher.cs): `gateway/src/Gym.Gateway/DeviceChangeWatcher.cs`
- [Adapter factory](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway.Adapters/DeviceAdapterFactory.cs): `gateway/src/Gym.Gateway.Adapters/DeviceAdapterFactory.cs`
- [Device adapter](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway.Adapters/IDeviceAdapter.cs): `gateway/src/Gym.Gateway.Adapters/IDeviceAdapter.cs`
- [TrueFace adapter](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway.Adapters/TrueFaceDeviceAdapter.cs): `gateway/src/Gym.Gateway.Adapters/TrueFaceDeviceAdapter.cs`
- [Outbound queue store](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/DurableOutboundStore.cs): `gateway/src/Gym.Gateway/DurableOutboundStore.cs`
- [Gateway enrollment](https://github.com/shivamsharma01/gym-app/blob/main/gateway/src/Gym.Gateway/Config/GatewayEnrollmentClient.cs): `gateway/src/Gym.Gateway/Config/GatewayEnrollmentClient.cs`

### Reader SDK Demo

- [Access control demo](https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/AccessForm.cs): `TrueFace_SDK/AccessDemo2s/AccessForm.cs`
- [User management](https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/UserManager/UserManageFrom.cs): `TrueFace_SDK/AccessDemo2s/UserManager/UserManageFrom.cs`
- [Record queries](https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/QueryRecord/RecordQueryForm.cs): `TrueFace_SDK/AccessDemo2s/QueryRecord/RecordQueryForm.cs`
- [Demo utilities](https://github.com/shivamsharma01/gym-app/blob/main/TrueFace_SDK/AccessDemo2s/Common.cs): `TrueFace_SDK/AccessDemo2s/Common.cs`

### Gateway POCs

- [Windows device POC](https://github.com/shivamsharma01/gym-app/blob/main/TrueFaceWindowsPOC/Program.cs): `TrueFaceWindowsPOC/Program.cs`
- [Linux SDK POC](https://github.com/shivamsharma01/gym-app/blob/main/TrueFaceLinuxPOC/Program.cs): `TrueFaceLinuxPOC/Program.cs`
- [SDK probe](https://github.com/shivamsharma01/gym-app/blob/main/gateway/tools/Gym.Gateway.SdkProbe/Program.cs): `gateway/tools/Gym.Gateway.SdkProbe/Program.cs`

### Other components

- **Gym staff**
- **Gym backend**

## Connections

- Gym staff → Web routes: uses (evidence: `frontend/src/main.tsx`)
- Web routes → Member management: routes to (evidence: `frontend/src/main.tsx`)
- Web routes → Memberships: routes to (evidence: `frontend/src/main.tsx`)
- Web routes → Attendance: routes to (evidence: `frontend/src/main.tsx`)
- Web routes → Device administration: routes to (evidence: `frontend/src/main.tsx`)
- Member management → Web API client: requests
- Memberships → Web API client: requests
- Attendance → Web API client: requests
- Device administration → Web API client: requests
- Business views → Web API client: requests
- Web API client → Gym backend: calls
- Gateway worker → Backend link: uses (evidence: `gateway/src/Gym.Gateway/GatewayWorker.cs`)
- Gateway worker → Command dispatcher: dispatches (evidence: `gateway/src/Gym.Gateway/GatewayWorker.cs`)
- Gateway worker → Device watcher: starts (evidence: `gateway/src/Gym.Gateway/GatewayWorker.cs`)
- Gateway worker → Adapter factory: creates adapters (evidence: `gateway/src/Gym.Gateway/GatewayWorker.cs`)
- Gateway worker → Device adapter: commands (evidence: `gateway/src/Gym.Gateway/GatewayWorker.cs`)
- Backend link → Outbound queue store: persists messages (evidence: `gateway/src/Gym.Gateway/BackendLink.cs`)
- Backend link → Gym backend: exchanges messages
- Adapter factory → TrueFace adapter: selects (evidence: `gateway/src/Gym.Gateway.Adapters/DeviceAdapterFactory.cs`)
- TrueFace adapter → Device adapter: implements (evidence: `gateway/src/Gym.Gateway.Adapters/TrueFaceDeviceAdapter.cs`)
- Gateway enrollment → Gym backend: enrolls (evidence: `gateway/src/Gym.Gateway/Config/GatewayEnrollmentClient.cs`)
- Access control demo → User management: opens (evidence: `TrueFace_SDK/AccessDemo2s/AccessForm.cs`)
- Access control demo → Record queries: opens (evidence: `TrueFace_SDK/AccessDemo2s/AccessForm.cs`)
- Access control demo → Demo utilities: uses (evidence: `TrueFace_SDK/AccessDemo2s/AccessForm.cs`)
- Windows device POC → Device adapter: uses (evidence: `TrueFaceWindowsPOC/Program.cs`)
