# eneasfeynlinus/gymhub-api architecture

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

- Interactive diagram: https://gitdiagram.com/eneasfeynlinus/gymhub-api
- Repository: https://github.com/eneasfeynlinus/gymhub-api

## Overview

Gymhub API serves two main workflows: management of gym operations and identity/access administration, plus a separate Gympass integration. The README documents Gymhub CRUD, finance and dashboard features, public check-in, and Gympass booking, slot, product, access-control, and webhook capabilities. Sampled controllers confirm several dispatches; Gympass service internals and most module service/repository wiring were not sampled, so those links are not inferred.

Main entry points: [`src/modules/gymhub/controllers`](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/gymhub/controllers) (Gymhub controllers), [`src/utils/auditLog.js`](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/utils/auditLog.js) (Audit logging), [`src/modules/auth/controller.js`](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/controller.js) (Auth controller), [`src/controllers/gympassController.js`](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/controllers/gympassController.js) (Gympass controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingress["API ingress"]
  node_gymhub_routes["Gymhub routes<br/>[gymhubRoutes.js]"]
  node_gympass_routes["Gympass routes<br/>[gympassRoutes.js]"]
end

subgraph group_gymhub["Gymhub operations"]
  node_gymhub_controllers["Gymhub controllers"]
  node_gymhub_services["Gymhub domain services"]
  node_public_checkin["Public check-in"]
  node_gymhub_state[("Gymhub in-memory state<br/>[store.js]")]
end

subgraph group_identity["Identity and access"]
  node_auth_routes["Auth routes<br/>[routes.js]"]
  node_auth_controller["Auth controller<br/>[controller.js]"]
  node_auth_service["Auth service<br/>[service.js]"]
  node_users_module["User management"]
  node_roles_module["Role management"]
  node_permissions_module["Permission management"]
  node_flags_module["Feature flags"]
  node_menus_module["Menu access"]
  node_logs_module["Audit log queries"]
end

subgraph group_gympass["Gympass integration"]
  node_gympass_controller["Gympass controller"]
  node_gympass_service["Gympass service<br/>[gympassService.js]"]
end

subgraph group_shared["Shared services"]
  node_database[("PostgreSQL<br/>[database.js]")]
  node_audit_log["Audit logging<br/>[auditLog.js]"]
end

node_api_client(("API client"))
node_gympass_api{{"Gympass APIs"}}

node_api_client -->|"requests"| node_gymhub_routes
node_api_client -->|"requests"| node_gympass_routes
node_gymhub_routes -->|"dispatches"| node_gymhub_controllers
node_gymhub_controllers -->|"invokes"| node_gymhub_services
node_gymhub_services -->|"persists"| node_database
node_gymhub_controllers -.->|"resets"| node_gymhub_state
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"invokes"| node_auth_service
node_auth_controller -->|"records events"| node_audit_log
node_gymhub_controllers -->|"records events"| node_audit_log
node_gympass_routes -->|"dispatches"| node_gympass_controller
node_gympass_controller -->|"invokes"| node_gympass_service
node_gympass_service -->|"calls"| node_gympass_api
node_gympass_controller -->|"records check-ins"| node_audit_log
node_public_checkin -->|"records check-ins"| node_audit_log

click node_gymhub_routes "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/routes/gymhubRoutes.js"
click node_gympass_routes "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/routes/gympassRoutes.js"
click node_gymhub_controllers "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/gymhub/controllers"
click node_gymhub_services "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/gymhub/services"
click node_public_checkin "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/publicCheckin"
click node_gymhub_state "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/gymhub/data/store.js"
click node_auth_routes "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/routes.js"
click node_auth_controller "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/controller.js"
click node_auth_service "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/service.js"
click node_users_module "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/users"
click node_roles_module "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/roles"
click node_permissions_module "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/permissions"
click node_flags_module "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/featureFlags"
click node_menus_module "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/menus"
click node_logs_module "https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/logs"
click node_gympass_controller "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/controllers/gympassController.js"
click node_gympass_service "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/services/gympassService.js"
click node_database "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/config/database.js"
click node_audit_log "https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/utils/auditLog.js"

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_gymhub_routes,node_gympass_routes,node_api_client toneBlue
class node_gymhub_controllers,node_gymhub_services,node_public_checkin,node_gymhub_state toneAmber
class node_auth_routes,node_auth_controller,node_auth_service,node_users_module,node_roles_module,node_permissions_module,node_flags_module,node_menus_module,node_logs_module,node_gympass_api toneMint
class node_gympass_controller,node_gympass_service toneRose
class node_database,node_audit_log toneIndigo
```

## Components

### API ingress

- [Gymhub routes](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/routes/gymhubRoutes.js): `src/routes/gymhubRoutes.js`
- [Gympass routes](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/routes/gympassRoutes.js): `src/routes/gympassRoutes.js`

### Gymhub operations

- [Gymhub controllers](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/gymhub/controllers): `src/modules/gymhub/controllers`
- [Gymhub domain services](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/gymhub/services): `src/modules/gymhub/services`
- [Public check-in](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/publicCheckin): `src/modules/publicCheckin`
- [Gymhub in-memory state](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/gymhub/data/store.js): `src/modules/gymhub/data/store.js`

### Identity and access

- [Auth routes](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/routes.js): `src/modules/auth/routes.js`
- [Auth controller](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/controller.js): `src/modules/auth/controller.js`
- [Auth service](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/modules/auth/service.js): `src/modules/auth/service.js`
- [User management](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/users): `src/modules/users`
- [Role management](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/roles): `src/modules/roles`
- [Permission management](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/permissions): `src/modules/permissions`
- [Feature flags](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/featureFlags): `src/modules/featureFlags`
- [Menu access](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/menus): `src/modules/menus`
- [Audit log queries](https://github.com/eneasfeynlinus/gymhub-api/tree/main/src/modules/logs): `src/modules/logs`

### Gympass integration

- [Gympass controller](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/controllers/gympassController.js): `src/controllers/gympassController.js`
- [Gympass service](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/services/gympassService.js): `src/services/gympassService.js`

### Shared services

- [PostgreSQL](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/config/database.js): `src/config/database.js`
- [Audit logging](https://github.com/eneasfeynlinus/gymhub-api/blob/main/src/utils/auditLog.js): `src/utils/auditLog.js`

### Other components

- **API client**
- **Gympass APIs**

## Connections

- API client → Gymhub routes: requests
- API client → Gympass routes: requests
- Gymhub routes → Gymhub controllers: dispatches
- Gymhub controllers → Gymhub domain services: invokes
- Gymhub domain services → PostgreSQL: persists
- Gymhub controllers → Gymhub in-memory state: resets
- Auth routes → Auth controller: dispatches
- Auth controller → Auth service: invokes
- Auth controller → Audit logging: records events
- Gymhub controllers → Audit logging: records events
- Gympass routes → Gympass controller: dispatches
- Gympass controller → Gympass service: invokes
- Gympass service → Gympass APIs: calls
- Gympass controller → Audit logging: records check-ins
- Public check-in → Audit logging: records check-ins
