# jlmontielc/sistema-informacion-vantiopp4 architecture

> Architecture diagram of the GitHub repository jlmontielc/sistema-informacion-vantiopp4, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jlmontielc/sistema-informacion-vantiopp4
- Repository: https://github.com/jlmontielc/sistema-informacion-vantiopp4

## Overview

PP4 is a personal-trainer management system whose central workflow is client assessment, AI-assisted training and nutrition proposals, medical-safety screening, and trainer approval before delivery. The Node.js modular backend serves the application and delegates specialized HITL/AI work to Flask; the product also covers client records, metabolic assessment, workout logging, reporting, and payments. The README documents the service topology and capabilities; sampled excerpts confirm selected route and call relationships, while unsampled modules are represented only at their supported paths.

Main entry points: [`backend-node/src/app.js`](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/app.js) (Node API), [`frontend/src/App.jsx`](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/App.jsx) (Web application), [`backend-flask/services/hitl_engine.py`](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/hitl_engine.py) (Recommendation engine), [`backend-flask/api/hitl_routes.py`](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/api/hitl_routes.py) (AI service API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web["Web application<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_client_ui["Client profiles<br/>[ClientesPage.jsx]"]
  node_workout_ui["Workout workspace"]
  node_diet_ui["Diet workspace<br/>[DietasPage.jsx]"]
  node_report_ui["Progress reports<br/>[ReportesPage.jsx]"]
  node_payment_ui["Plans and payments<br/>[PlanesPage.jsx]"]
end

subgraph group_management["Client management"]
  node_clients["Client records"]
  node_medical["Medical profiles"]
  node_metabolism["Metabolic assessment"]
  node_reports["Progress reporting<br/>[reportes.routes.js]"]
  node_payments["Subscription payments<br/>[pagos.routes.js]"]
end

subgraph group_prescription["Training and nutrition"]
  node_training["Workout plans and logs"]
  node_diets["Diet plans<br/>[dietas.routes.js]"]
end

subgraph group_platform["Platform services"]
  node_node_api["Node API<br/>[app.js]"]
  node_auth["Authentication and roles<br/>[auth.routes.js]"]
  node_redis[("Redis cache")]
end

subgraph group_learning["Safety and learning"]
  node_flask["AI service API<br/>[hitl_routes.py]"]
  node_hitl_engine["Recommendation engine<br/>[hitl_engine.py]"]
  node_guardian["Safety guardian<br/>[guardian.py]"]
  node_injury_rules["Injury rules<br/>[injury_rules.py]"]
  node_nutrition_engine["Nutrition engine"]
  node_feedback["Feedback and recalibration"]
end

node_user(("Trainer or client"))

node_user -->|"uses"| node_web
node_web -->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_node_api
node_web -->|"shows clients"| node_client_ui
node_web -->|"shows training"| node_workout_ui
node_web -->|"shows diets"| node_diet_ui
node_web -->|"shows reports"| node_report_ui
node_web -->|"shows plans"| node_payment_ui
node_node_api -->|"mounts routes"| node_auth
node_node_api -->|"mounts routes"| node_clients
node_node_api -->|"mounts routes"| node_metabolism
node_node_api -->|"mounts routes"| node_training
node_node_api -->|"mounts routes"| node_diets
node_node_api -->|"mounts routes"| node_payments
node_node_api -->|"mounts routes"| node_reports
node_clients -->|"routes profiles"| node_medical
node_diets -->|"requests AI diet"| node_flask
node_flask -->|"invokes engine"| node_hitl_engine
node_hitl_engine -->|"checks safety"| node_guardian
node_guardian -->|"uses rules"| node_injury_rules
node_hitl_engine -->|"generates nutrition"| node_nutrition_engine
node_flask -->|"records feedback"| node_feedback
node_hitl_engine -->|"recalibrates weights"| node_feedback
node_node_api -->|"uses cache"| node_redis

click node_web "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/App.jsx"
click node_api_client "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/services/api.js"
click node_client_ui "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/ClientesPage.jsx"
click node_workout_ui "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/EntrenamientoPage.jsx"
click node_diet_ui "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/DietasPage.jsx"
click node_report_ui "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/ReportesPage.jsx"
click node_payment_ui "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/PlanesPage.jsx"
click node_node_api "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/app.js"
click node_auth "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/auth/auth.routes.js"
click node_clients "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/instruidos/instruido.routes.js"
click node_medical "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/instruidos/perfil-medico.routes.js"
click node_metabolism "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/metabolismo/metabolismo.service.js"
click node_training "https://github.com/jlmontielc/sistema-informacion-vantiopp4/tree/main/backend-node/src/modules/entrenamiento"
click node_diets "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/dietas/dietas.routes.js"
click node_reports "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/reportes/reportes.routes.js"
click node_payments "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/pagos/pagos.routes.js"
click node_flask "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/api/hitl_routes.py"
click node_hitl_engine "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/hitl_engine.py"
click node_guardian "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/guardian.py"
click node_injury_rules "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/models/rules/injury_rules.py"
click node_nutrition_engine "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/nutricion_engine.py"
click node_feedback "https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/feedback_learner.py"

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,node_api_client,node_client_ui,node_workout_ui,node_diet_ui,node_report_ui,node_payment_ui,node_user toneBlue
class node_clients,node_medical,node_metabolism,node_reports,node_payments toneAmber
class node_training,node_diets toneMint
class node_node_api,node_auth,node_redis toneRose
class node_flask,node_hitl_engine,node_guardian,node_injury_rules,node_nutrition_engine,node_feedback toneIndigo
```

## Components

### User experience

- [Web application](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Client profiles](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/ClientesPage.jsx): `frontend/src/pages/ClientesPage.jsx`
- [Workout workspace](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/EntrenamientoPage.jsx): `frontend/src/pages/EntrenamientoPage.jsx`
- [Diet workspace](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/DietasPage.jsx): `frontend/src/pages/DietasPage.jsx`
- [Progress reports](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/ReportesPage.jsx): `frontend/src/pages/ReportesPage.jsx`
- [Plans and payments](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/frontend/src/pages/PlanesPage.jsx): `frontend/src/pages/PlanesPage.jsx`

### Client management

- [Client records](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/instruidos/instruido.routes.js): `backend-node/src/modules/instruidos/instruido.routes.js`
- [Medical profiles](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/instruidos/perfil-medico.routes.js): `backend-node/src/modules/instruidos/perfil-medico.routes.js`
- [Metabolic assessment](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/metabolismo/metabolismo.service.js): `backend-node/src/modules/metabolismo/metabolismo.service.js`
- [Progress reporting](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/reportes/reportes.routes.js): `backend-node/src/modules/reportes/reportes.routes.js`
- [Subscription payments](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/pagos/pagos.routes.js): `backend-node/src/modules/pagos/pagos.routes.js`

### Training and nutrition

- [Workout plans and logs](https://github.com/jlmontielc/sistema-informacion-vantiopp4/tree/main/backend-node/src/modules/entrenamiento): `backend-node/src/modules/entrenamiento`
- [Diet plans](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/dietas/dietas.routes.js): `backend-node/src/modules/dietas/dietas.routes.js`

### Platform services

- [Node API](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/app.js): `backend-node/src/app.js`
- [Authentication and roles](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-node/src/modules/auth/auth.routes.js): `backend-node/src/modules/auth/auth.routes.js`
- **Redis cache**

### Safety and learning

- [AI service API](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/api/hitl_routes.py): `backend-flask/api/hitl_routes.py`
- [Recommendation engine](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/hitl_engine.py): `backend-flask/services/hitl_engine.py`
- [Safety guardian](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/guardian.py): `backend-flask/services/guardian.py`
- [Injury rules](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/models/rules/injury_rules.py): `backend-flask/models/rules/injury_rules.py`
- [Nutrition engine](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/nutricion_engine.py): `backend-flask/services/nutricion_engine.py`
- [Feedback and recalibration](https://github.com/jlmontielc/sistema-informacion-vantiopp4/blob/main/backend-flask/services/feedback_learner.py): `backend-flask/services/feedback_learner.py`

### Other components

- **Trainer or client**

## Connections

- Trainer or client → Web application: uses
- Web application → API client: requests data (evidence: `frontend/src/App.jsx`)
- API client → Node API: calls API
- Web application → Client profiles: shows clients (evidence: `frontend/src/App.jsx`)
- Web application → Workout workspace: shows training (evidence: `frontend/src/App.jsx`)
- Web application → Diet workspace: shows diets (evidence: `frontend/src/App.jsx`)
- Web application → Progress reports: shows reports (evidence: `frontend/src/App.jsx`)
- Web application → Plans and payments: shows plans (evidence: `frontend/src/App.jsx`)
- Node API → Authentication and roles: mounts routes (evidence: `backend-node/src/app.js`)
- Node API → Client records: mounts routes (evidence: `backend-node/src/app.js`)
- Node API → Metabolic assessment: mounts routes (evidence: `backend-node/src/app.js`)
- Node API → Workout plans and logs: mounts routes (evidence: `backend-node/src/app.js`)
- Node API → Diet plans: mounts routes (evidence: `backend-node/src/app.js`)
- Node API → Subscription payments: mounts routes (evidence: `backend-node/src/app.js`)
- Node API → Progress reporting: mounts routes (evidence: `backend-node/src/app.js`)
- Client records → Medical profiles: routes profiles (evidence: `backend-node/src/modules/instruidos/instruido.routes.js`)
- Diet plans → AI service API: requests AI diet (evidence: `backend-node/src/modules/dietas/dietas.routes.js`)
- AI service API → Recommendation engine: invokes engine (evidence: `backend-flask/api/hitl_routes.py`)
- Recommendation engine → Safety guardian: checks safety (evidence: `backend-flask/services/hitl_engine.py`)
- Safety guardian → Injury rules: uses rules (evidence: `backend-flask/models/rules/injury_rules.py`)
- Recommendation engine → Nutrition engine: generates nutrition (evidence: `backend-flask/services/hitl_engine.py`)
- AI service API → Feedback and recalibration: records feedback (evidence: `backend-flask/api/hitl_routes.py`)
- Recommendation engine → Feedback and recalibration: recalibrates weights (evidence: `backend-flask/services/hitl_engine.py`)
- Node API → Redis cache: uses cache
