# protrainingunaj/protraining-front architecture

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

- Interactive diagram: https://gitdiagram.com/protrainingunaj/protraining-front
- Repository: https://github.com/protrainingunaj/protraining-front

## Overview

ProTraining is a role-based PWA for physical trainers and athletes. Trainers manage organizations, athletes, training plans, calendars and daily monitoring; athletes complete check-ins, view their routine and track progress. The router separates the two role-specific experiences, while API modules mediate backend access. The graph includes documented product areas whose page internals were not sampled; their unverified connections are intentionally omitted. Source excerpts establish selected routing, authentication, monitoring, organization and routine relationships, but do not expose the full application call graph.

Main entry points: [`src/router.tsx`](https://github.com/protrainingunaj/protraining-front/blob/develop/src/router.tsx) (Role router), [`src/api/authService.ts`](https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/authService.ts) (Authentication), [`src/components/routine/FinishRoutineModal.tsx`](https://github.com/protrainingunaj/protraining-front/blob/develop/src/components/routine/FinishRoutineModal.tsx) (Routine completion), [`src/api/seguimientoService.ts`](https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/seguimientoService.ts) (Check-in and load API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application shell"]
  node_router["Role router<br/>[router.tsx]"]
  node_coach_layout["Trainer layout<br/>[CoachLayout.tsx]"]
  node_athlete_layout["Athlete layout<br/>[AthleteLayout.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_auth_context["Session context<br/>[AuthContext.tsx]"]
  node_auth_service["Authentication<br/>[authService.ts]"]
end

subgraph group_coach["Trainer workspace"]
  node_organizations["Organizations and athletes"]
  node_planning["Plan authoring<br/>[PlanningPage.tsx]"]
  node_calendar["Season calendar"]
  node_monitoring["Daily monitoring<br/>[MonitoringPage.tsx]"]
end

subgraph group_athlete["Athlete experience"]
  node_routine["Training routine<br/>[RoutinePage.tsx]"]
  node_finish_routine["Routine completion"]
  node_checkin["Wellness check-in<br/>[CheckInPage.tsx]"]
  node_daily_load["Daily load<br/>[DailyLoadPage.tsx]"]
  node_progress["Progress and records<br/>[ProgressPage.tsx]"]
end

subgraph group_integration["Backend integration"]
  node_http_client["HTTP client<br/>[axiosClient.ts]"]
  node_structure_api["Organization API"]
  node_followup_api["Check-in and load API"]
  node_push_service_worker["Push notifications<br/>[push-sw.js]"]
end

node_trainer(("Physical trainer"))
node_athlete_user(("Athlete"))

node_router -->|"routes trainer"| node_coach_layout
node_router -->|"routes athlete"| node_athlete_layout
node_auth_context -->|"calls authentication"| node_auth_service
node_auth_service -->|"sends login"| node_http_client
node_organizations -->|"manages organization data"| node_structure_api
node_monitoring -->|"updates attendance"| node_followup_api
node_routine -->|"opens completion"| node_finish_routine
node_finish_routine -->|"submits session data"| node_followup_api
node_trainer -.->|"uses trainer workspace"| node_router
node_athlete_user -.->|"uses athlete workspace"| node_router

click node_router "https://github.com/protrainingunaj/protraining-front/blob/develop/src/router.tsx"
click node_coach_layout "https://github.com/protrainingunaj/protraining-front/blob/develop/src/layouts/CoachLayout.tsx"
click node_athlete_layout "https://github.com/protrainingunaj/protraining-front/blob/develop/src/layouts/AthleteLayout.tsx"
click node_auth_context "https://github.com/protrainingunaj/protraining-front/blob/develop/src/context/AuthContext.tsx"
click node_auth_service "https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/authService.ts"
click node_http_client "https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/axiosClient.ts"
click node_organizations "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/OrganizationsPage.tsx"
click node_structure_api "https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/structureService.ts"
click node_planning "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/PlanningPage.tsx"
click node_calendar "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/SeasonCalendarPage.tsx"
click node_monitoring "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/MonitoringPage.tsx"
click node_followup_api "https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/seguimientoService.ts"
click node_routine "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/RoutinePage.tsx"
click node_finish_routine "https://github.com/protrainingunaj/protraining-front/blob/develop/src/components/routine/FinishRoutineModal.tsx"
click node_checkin "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/CheckInPage.tsx"
click node_daily_load "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/DailyLoadPage.tsx"
click node_progress "https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/ProgressPage.tsx"
click node_push_service_worker "https://github.com/protrainingunaj/protraining-front/blob/develop/public/push-sw.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_router,node_coach_layout,node_athlete_layout toneBlue
class node_auth_context,node_auth_service toneAmber
class node_organizations,node_planning,node_calendar,node_monitoring toneMint
class node_routine,node_finish_routine,node_checkin,node_daily_load,node_progress toneRose
class node_http_client,node_structure_api,node_followup_api,node_push_service_worker,node_trainer,node_athlete_user toneIndigo
```

## Components

### Application shell

- [Role router](https://github.com/protrainingunaj/protraining-front/blob/develop/src/router.tsx): `src/router.tsx`
- [Trainer layout](https://github.com/protrainingunaj/protraining-front/blob/develop/src/layouts/CoachLayout.tsx): `src/layouts/CoachLayout.tsx`
- [Athlete layout](https://github.com/protrainingunaj/protraining-front/blob/develop/src/layouts/AthleteLayout.tsx): `src/layouts/AthleteLayout.tsx`

### Identity and access

- [Session context](https://github.com/protrainingunaj/protraining-front/blob/develop/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Authentication](https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/authService.ts): `src/api/authService.ts`

### Trainer workspace

- [Organizations and athletes](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/OrganizationsPage.tsx): `src/pages/coach/OrganizationsPage.tsx`
- [Plan authoring](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/PlanningPage.tsx): `src/pages/coach/PlanningPage.tsx`
- [Season calendar](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/SeasonCalendarPage.tsx): `src/pages/coach/SeasonCalendarPage.tsx`
- [Daily monitoring](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/coach/MonitoringPage.tsx): `src/pages/coach/MonitoringPage.tsx`

### Athlete experience

- [Training routine](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/RoutinePage.tsx): `src/pages/athlete/RoutinePage.tsx`
- [Routine completion](https://github.com/protrainingunaj/protraining-front/blob/develop/src/components/routine/FinishRoutineModal.tsx): `src/components/routine/FinishRoutineModal.tsx`
- [Wellness check-in](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/CheckInPage.tsx): `src/pages/athlete/CheckInPage.tsx`
- [Daily load](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/DailyLoadPage.tsx): `src/pages/athlete/DailyLoadPage.tsx`
- [Progress and records](https://github.com/protrainingunaj/protraining-front/blob/develop/src/pages/athlete/ProgressPage.tsx): `src/pages/athlete/ProgressPage.tsx`

### Backend integration

- [HTTP client](https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/axiosClient.ts): `src/api/axiosClient.ts`
- [Organization API](https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/structureService.ts): `src/api/structureService.ts`
- [Check-in and load API](https://github.com/protrainingunaj/protraining-front/blob/develop/src/api/seguimientoService.ts): `src/api/seguimientoService.ts`
- [Push notifications](https://github.com/protrainingunaj/protraining-front/blob/develop/public/push-sw.js): `public/push-sw.js`

### Other components

- **Physical trainer**
- **Athlete**

## Connections

- Role router → Trainer layout: routes trainer (evidence: `src/router.tsx`)
- Role router → Athlete layout: routes athlete (evidence: `src/router.tsx`)
- Session context → Authentication: calls authentication (evidence: `src/context/AuthContext.tsx`)
- Authentication → HTTP client: sends login (evidence: `src/api/authService.ts`)
- Organizations and athletes → Organization API: manages organization data (evidence: `src/pages/coach/OrganizationsPage.tsx`)
- Daily monitoring → Check-in and load API: updates attendance (evidence: `src/pages/coach/MonitoringPage.tsx`)
- Training routine → Routine completion: opens completion (evidence: `src/pages/athlete/RoutinePage.tsx`)
- Routine completion → Check-in and load API: submits session data (evidence: `src/components/routine/FinishRoutineModal.tsx`)
- Physical trainer → Role router: uses trainer workspace (evidence: `README.md`)
- Athlete → Role router: uses athlete workspace (evidence: `README.md`)
