# ryuo-00/fittrack-gym-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/ryuo-00/fittrack-gym-management-system
- Repository: https://github.com/ryuo-00/fittrack-gym-management-system

## Overview

FitTrack is a gym-administration web application. An administrator signs in, then uses protected pages to manage members, trainers, plans, subscriptions and renewals, payments, and attendance; dashboard and date-filtered reports provide operational summaries. The React client sends cookie-authenticated requests to Express, whose routes validate and dispatch to controllers and PostgreSQL access. The README also documents SQL-backed views, procedures, and audit/eligibility triggers, but their files are absent from the supplied tree, so they are represented only as database capabilities. Edges reflect excerpts, indexed references, or README statements; unsampled wiring is omitted.

Main entry points: [`client/src/App.tsx`](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/App.tsx) (App routing), [`server/src/routes/api.ts`](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/routes/api.ts) (Business API routes), [`server/src/database/pool.ts`](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/database/pool.ts) (PostgreSQL access), [`server/src/routes/auth.ts`](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/routes/auth.ts) (Authentication routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Admin client"]
  node_app["App routing<br/>[App.tsx]"]
  node_layout["Admin layout<br/>[AppLayout.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_members["Members<br/>[MembersPage.tsx]"]
  node_trainers["Trainers<br/>[TrainersPage.tsx]"]
  node_plans["Membership plans<br/>[PlansPage.tsx]"]
  node_subscriptions["Subscriptions"]
  node_payments["Payments<br/>[PaymentsPage.tsx]"]
  node_attendance["Attendance<br/>[AttendancePage.tsx]"]
  node_reports["Reports<br/>[ReportsPage.tsx]"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_ui["UI primitives"]
end

subgraph group_server["API and domain"]
  node_api_routes["Business API routes<br/>[api.ts]"]
  node_auth_routes["Authentication routes<br/>[auth.ts]"]
  node_auth_controller["Authentication<br/>[auth.ts]"]
  node_catalog_controller["Catalog operations<br/>[catalog.ts]"]
  node_subscription_controller["Subscription operations<br/>[subscriptions.ts]"]
  node_payment_controller["Payment operations<br/>[payments.ts]"]
  node_attendance_controller["Attendance operations<br/>[attendance.ts]"]
  node_dashboard_controller["Dashboard queries<br/>[dashboard.ts]"]
  node_report_controller["Report queries<br/>[reports.ts]"]
end

subgraph group_infra["Shared runtime"]
  node_auth_middleware["Cookie sessions<br/>[auth.ts]"]
  node_validators["Request validation<br/>[index.ts]"]
end

subgraph group_data["Persistence"]
  node_db_pool["PostgreSQL access<br/>[pool.ts]"]
  node_postgres[("PostgreSQL")]
end

node_admin(("Administrator"))

node_admin -->|"uses"| node_app
node_app -->|"renders"| node_layout
node_app -->|"checks session"| node_api_client
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_members
node_app -->|"routes to"| node_trainers
node_app -->|"routes to"| node_plans
node_app -->|"routes to"| node_subscriptions
node_app -->|"routes to"| node_payments
node_app -->|"routes to"| node_attendance
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_settings
node_admin -->|"signs in"| node_auth_routes
node_api_client -.->|"sends API requests"| node_api_routes
node_api_routes -->|"dispatches"| node_catalog_controller
node_api_routes -->|"dispatches"| node_subscription_controller
node_api_routes -->|"dispatches"| node_payment_controller
node_api_routes -->|"dispatches"| node_attendance_controller
node_api_routes -->|"dispatches"| node_dashboard_controller
node_api_routes -->|"dispatches"| node_report_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_api_routes -->|"protects routes"| node_auth_middleware
node_auth_routes -->|"checks sessions"| node_auth_middleware
node_api_routes -->|"validates input"| node_validators
node_auth_routes -->|"validates input"| node_validators
node_auth_controller -->|"queries"| node_db_pool
node_dashboard_controller -->|"queries"| node_db_pool
node_payment_controller -->|"queries"| node_db_pool
node_subscription_controller -->|"queries"| node_db_pool
node_report_controller -->|"queries"| node_db_pool
node_catalog_controller -.->|"queries"| node_db_pool
node_attendance_controller -.->|"queries"| node_db_pool
node_db_pool -->|"reads and writes"| node_postgres
node_postgres -->|"stores operations data"| node_admin

click node_app "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/App.tsx"
click node_layout "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/components/AppLayout.tsx"
click node_dashboard "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/DashboardPage.tsx"
click node_members "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/MembersPage.tsx"
click node_trainers "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/TrainersPage.tsx"
click node_plans "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/PlansPage.tsx"
click node_subscriptions "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/SubscriptionsPage.tsx"
click node_payments "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/PaymentsPage.tsx"
click node_attendance "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/AttendancePage.tsx"
click node_reports "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/ReportsPage.tsx"
click node_settings "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/SettingsPage.tsx"
click node_api_client "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/lib/api.ts"
click node_ui "https://github.com/ryuo-00/fittrack-gym-management-system/tree/main/client/src/components/ui"
click node_api_routes "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/routes/api.ts"
click node_auth_routes "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/routes/auth.ts"
click node_auth_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/auth.ts"
click node_catalog_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/catalog.ts"
click node_subscription_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/subscriptions.ts"
click node_payment_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/payments.ts"
click node_attendance_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/attendance.ts"
click node_dashboard_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/dashboard.ts"
click node_report_controller "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/reports.ts"
click node_auth_middleware "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/middleware/auth.ts"
click node_validators "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/validators/index.ts"
click node_db_pool "https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/database/pool.ts"

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_app,node_layout,node_dashboard,node_members,node_trainers,node_plans,node_subscriptions,node_payments,node_attendance,node_reports,node_settings,node_api_client,node_ui toneBlue
class node_api_routes,node_auth_routes,node_auth_controller,node_catalog_controller,node_subscription_controller,node_payment_controller,node_attendance_controller,node_dashboard_controller,node_report_controller toneAmber
class node_auth_middleware,node_validators toneMint
class node_db_pool,node_postgres toneRose
class node_admin toneIndigo
```

## Components

### Admin client

- [App routing](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/App.tsx): `client/src/App.tsx`
- [Admin layout](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/components/AppLayout.tsx): `client/src/components/AppLayout.tsx`
- [Dashboard](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/DashboardPage.tsx): `client/src/pages/DashboardPage.tsx`
- [Members](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/MembersPage.tsx): `client/src/pages/MembersPage.tsx`
- [Trainers](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/TrainersPage.tsx): `client/src/pages/TrainersPage.tsx`
- [Membership plans](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/PlansPage.tsx): `client/src/pages/PlansPage.tsx`
- [Subscriptions](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/SubscriptionsPage.tsx): `client/src/pages/SubscriptionsPage.tsx`
- [Payments](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/PaymentsPage.tsx): `client/src/pages/PaymentsPage.tsx`
- [Attendance](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/AttendancePage.tsx): `client/src/pages/AttendancePage.tsx`
- [Reports](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/ReportsPage.tsx): `client/src/pages/ReportsPage.tsx`
- [Settings](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/pages/SettingsPage.tsx): `client/src/pages/SettingsPage.tsx`
- [API client](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/client/src/lib/api.ts): `client/src/lib/api.ts`
- [UI primitives](https://github.com/ryuo-00/fittrack-gym-management-system/tree/main/client/src/components/ui): `client/src/components/ui`

### API and domain

- [Business API routes](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/routes/api.ts): `server/src/routes/api.ts`
- [Authentication routes](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/routes/auth.ts): `server/src/routes/auth.ts`
- [Authentication](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/auth.ts): `server/src/controllers/auth.ts`
- [Catalog operations](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/catalog.ts): `server/src/controllers/catalog.ts`
- [Subscription operations](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/subscriptions.ts): `server/src/controllers/subscriptions.ts`
- [Payment operations](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/payments.ts): `server/src/controllers/payments.ts`
- [Attendance operations](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/attendance.ts): `server/src/controllers/attendance.ts`
- [Dashboard queries](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/dashboard.ts): `server/src/controllers/dashboard.ts`
- [Report queries](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/controllers/reports.ts): `server/src/controllers/reports.ts`

### Shared runtime

- [Cookie sessions](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/middleware/auth.ts): `server/src/middleware/auth.ts`
- [Request validation](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/validators/index.ts): `server/src/validators/index.ts`

### Persistence

- [PostgreSQL access](https://github.com/ryuo-00/fittrack-gym-management-system/blob/main/server/src/database/pool.ts): `server/src/database/pool.ts`
- **PostgreSQL**

### Other components

- **Administrator**

## Connections

- Administrator → App routing: uses (evidence: `client/src/App.tsx`)
- App routing → Admin layout: renders (evidence: `client/src/App.tsx`)
- App routing → API client: checks session (evidence: `client/src/App.tsx`)
- App routing → Dashboard: routes to (evidence: `client/src/App.tsx`)
- App routing → Members: routes to (evidence: `client/src/App.tsx`)
- App routing → Trainers: routes to (evidence: `client/src/App.tsx`)
- App routing → Membership plans: routes to (evidence: `client/src/App.tsx`)
- App routing → Subscriptions: routes to (evidence: `client/src/App.tsx`)
- App routing → Payments: routes to (evidence: `client/src/App.tsx`)
- App routing → Attendance: routes to (evidence: `client/src/App.tsx`)
- App routing → Reports: routes to (evidence: `client/src/App.tsx`)
- App routing → Settings: routes to (evidence: `client/src/App.tsx`)
- Administrator → Authentication routes: signs in (evidence: `README.md`)
- API client → Business API routes: sends API requests
- Business API routes → Catalog operations: dispatches (evidence: `server/src/routes/api.ts`)
- Business API routes → Subscription operations: dispatches (evidence: `server/src/routes/api.ts`)
- Business API routes → Payment operations: dispatches (evidence: `server/src/routes/api.ts`)
- Business API routes → Attendance operations: dispatches (evidence: `server/src/routes/api.ts`)
- Business API routes → Dashboard queries: dispatches (evidence: `server/src/routes/api.ts`)
- Business API routes → Report queries: dispatches (evidence: `server/src/routes/api.ts`)
- Authentication routes → Authentication: dispatches (evidence: `server/src/routes/auth.ts`)
- Business API routes → Cookie sessions: protects routes (evidence: `server/src/routes/api.ts`)
- Authentication routes → Cookie sessions: checks sessions (evidence: `server/src/routes/auth.ts`)
- Business API routes → Request validation: validates input (evidence: `server/src/routes/api.ts`)
- Authentication routes → Request validation: validates input (evidence: `server/src/routes/auth.ts`)
- Authentication → PostgreSQL access: queries (evidence: `server/src/controllers/auth.ts`)
- Dashboard queries → PostgreSQL access: queries (evidence: `server/src/controllers/dashboard.ts`)
- Payment operations → PostgreSQL access: queries (evidence: `server/src/controllers/payments.ts`)
- Subscription operations → PostgreSQL access: queries (evidence: `server/src/controllers/subscriptions.ts`)
- Report queries → PostgreSQL access: queries (evidence: `server/src/controllers/reports.ts`)
- Catalog operations → PostgreSQL access: queries
- Attendance operations → PostgreSQL access: queries
- PostgreSQL access → PostgreSQL: reads and writes (evidence: `server/src/database/pool.ts`)
- PostgreSQL → Administrator: stores operations data (evidence: `README.md`)
