# reksit/health_pilot architecture

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

- Interactive diagram: https://gitdiagram.com/reksit/health_pilot
- Repository: https://github.com/reksit/health_pilot

## Overview

This is a preventive-health web platform: users create a health profile, record daily habits and symptoms, then receive risk analysis, diet guidance, and progress views. The React client calls an Express API backed by MongoDB; prediction requests can call a Python ML service, with rule-based fallback documented in the prediction controller. The graph retains README capabilities whose implementation was not sampled, including analytics, scores, and streaks; links for unsampled integrations are omitted or marked unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/reksit/health_pilot/blob/main/frontend/src/App.jsx) (App routing), [`backend/server.js`](https://github.com/reksit/health_pilot/blob/main/backend/server.js) (Express server), [`backend/models`](https://github.com/reksit/health_pilot/tree/main/backend/models) (Health data models), [`frontend/src/services/api.js`](https://github.com/reksit/health_pilot/blob/main/frontend/src/services/api.js) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routing<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[MainDashboard.jsx]"]
  node_profileui["Health profile<br/>[Profile.jsx]"]
  node_logui["Daily log<br/>[DailyLog.jsx]"]
  node_predictui["Risk predictions<br/>[Predictions.jsx]"]
  node_symptomui["Symptom checker<br/>[SymptomChecker.jsx]"]
  node_dietui["Diet plan<br/>[DietPlan.jsx]"]
  node_analyticsui["Analytics<br/>[Analytics.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_api["Backend API"]
  node_server["Express server<br/>[server.js]"]
  node_auth["Authentication<br/>[authController.js]"]
  node_authmw["JWT middleware<br/>[auth.js]"]
end

subgraph group_health["Health workflows"]
  node_profile["Profile management"]
  node_daily["Daily tracking"]
  node_analytics["Health analytics"]
end

subgraph group_intelligence["Recommendations"]
  node_prediction["Risk analysis"]
  node_diet["Diet generation<br/>[dietController.js]"]
  node_ml["ML service<br/>[app.py]"]
end

subgraph group_persistence["Persistence"]
  node_mongo[("MongoDB<br/>[db.js]")]
  node_models[("Health data models")]
end

node_person(("Health user"))

node_person -->|"uses"| node_app
node_app -->|"routes"| node_dashboard
node_app -->|"routes"| node_profileui
node_app -->|"routes"| node_logui
node_app -->|"routes"| node_predictui
node_app -->|"routes"| node_symptomui
node_app -->|"routes"| node_dietui
node_app -->|"routes"| node_analyticsui
node_dashboard -->|"requests"| node_api_client
node_app -.->|"calls API"| node_server
node_server -->|"connects"| node_mongo
node_server -->|"routes auth"| node_auth
node_server -->|"routes profile"| node_profile
node_server -->|"routes logs"| node_daily
node_server -->|"routes predictions"| node_prediction
node_server -->|"routes diet"| node_diet
node_server -->|"routes analytics"| node_analytics
node_auth -->|"reads users"| node_models
node_authmw -->|"checks user"| node_models
node_profile -->|"reads/writes profile"| node_models
node_daily -->|"updates logs scores"| node_models
node_prediction -->|"reads health data"| node_models
node_prediction -->|"requests analysis"| node_ml
node_diet -->|"reads health data"| node_models
node_analytics -.->|"queries trends"| node_models
node_models -.->|"persists records"| node_mongo
node_profileui -.->|"requests"| node_api_client
node_logui -.->|"requests"| node_api_client
node_predictui -.->|"requests"| node_api_client
node_symptomui -.->|"requests"| node_api_client
node_dietui -.->|"requests"| node_api_client
node_analyticsui -.->|"requests"| node_api_client

click node_app "https://github.com/reksit/health_pilot/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/MainDashboard.jsx"
click node_profileui "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/Profile.jsx"
click node_logui "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/DailyLog.jsx"
click node_predictui "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/Predictions.jsx"
click node_symptomui "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/SymptomChecker.jsx"
click node_dietui "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/DietPlan.jsx"
click node_analyticsui "https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/Analytics.jsx"
click node_api_client "https://github.com/reksit/health_pilot/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/reksit/health_pilot/blob/main/backend/server.js"
click node_auth "https://github.com/reksit/health_pilot/blob/main/backend/controllers/authController.js"
click node_authmw "https://github.com/reksit/health_pilot/blob/main/backend/middleware/auth.js"
click node_profile "https://github.com/reksit/health_pilot/blob/main/backend/controllers/profileController.js"
click node_daily "https://github.com/reksit/health_pilot/blob/main/backend/controllers/dailyLogController.js"
click node_analytics "https://github.com/reksit/health_pilot/blob/main/backend/controllers/analyticsController.js"
click node_prediction "https://github.com/reksit/health_pilot/blob/main/backend/controllers/predictionController.js"
click node_diet "https://github.com/reksit/health_pilot/blob/main/backend/controllers/dietController.js"
click node_ml "https://github.com/reksit/health_pilot/blob/main/ml-service/app.py"
click node_mongo "https://github.com/reksit/health_pilot/blob/main/backend/config/db.js"
click node_models "https://github.com/reksit/health_pilot/tree/main/backend/models"

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_dashboard,node_profileui,node_logui,node_predictui,node_symptomui,node_dietui,node_analyticsui,node_api_client,node_person toneBlue
class node_server,node_auth,node_authmw toneAmber
class node_profile,node_daily,node_analytics toneMint
class node_prediction,node_diet,node_ml toneRose
class node_mongo,node_models toneIndigo
```

## Components

### Web client

- [App routing](https://github.com/reksit/health_pilot/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/MainDashboard.jsx): `frontend/src/pages/MainDashboard.jsx`
- [Health profile](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Daily log](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/DailyLog.jsx): `frontend/src/pages/DailyLog.jsx`
- [Risk predictions](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/Predictions.jsx): `frontend/src/pages/Predictions.jsx`
- [Symptom checker](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/SymptomChecker.jsx): `frontend/src/pages/SymptomChecker.jsx`
- [Diet plan](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/DietPlan.jsx): `frontend/src/pages/DietPlan.jsx`
- [Analytics](https://github.com/reksit/health_pilot/blob/main/frontend/src/pages/Analytics.jsx): `frontend/src/pages/Analytics.jsx`
- [API client](https://github.com/reksit/health_pilot/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Backend API

- [Express server](https://github.com/reksit/health_pilot/blob/main/backend/server.js): `backend/server.js`
- [Authentication](https://github.com/reksit/health_pilot/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT middleware](https://github.com/reksit/health_pilot/blob/main/backend/middleware/auth.js): `backend/middleware/auth.js`

### Health workflows

- [Profile management](https://github.com/reksit/health_pilot/blob/main/backend/controllers/profileController.js): `backend/controllers/profileController.js`
- [Daily tracking](https://github.com/reksit/health_pilot/blob/main/backend/controllers/dailyLogController.js): `backend/controllers/dailyLogController.js`
- [Health analytics](https://github.com/reksit/health_pilot/blob/main/backend/controllers/analyticsController.js): `backend/controllers/analyticsController.js`

### Recommendations

- [Risk analysis](https://github.com/reksit/health_pilot/blob/main/backend/controllers/predictionController.js): `backend/controllers/predictionController.js`
- [Diet generation](https://github.com/reksit/health_pilot/blob/main/backend/controllers/dietController.js): `backend/controllers/dietController.js`
- [ML service](https://github.com/reksit/health_pilot/blob/main/ml-service/app.py): `ml-service/app.py`

### Persistence

- [MongoDB](https://github.com/reksit/health_pilot/blob/main/backend/config/db.js): `backend/config/db.js`
- [Health data models](https://github.com/reksit/health_pilot/tree/main/backend/models): `backend/models`

### Other components

- **Health user**

## Connections

- Health user → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Dashboard: routes (evidence: `frontend/src/App.jsx`)
- App routing → Health profile: routes (evidence: `frontend/src/App.jsx`)
- App routing → Daily log: routes (evidence: `frontend/src/App.jsx`)
- App routing → Risk predictions: routes (evidence: `frontend/src/App.jsx`)
- App routing → Symptom checker: routes (evidence: `frontend/src/App.jsx`)
- App routing → Diet plan: routes (evidence: `frontend/src/App.jsx`)
- App routing → Analytics: routes (evidence: `frontend/src/App.jsx`)
- Dashboard → API client: requests (evidence: `frontend/src/pages/MainDashboard.jsx`)
- App routing → Express server: calls API
- Express server → MongoDB: connects (evidence: `backend/server.js`)
- Express server → Authentication: routes auth (evidence: `backend/server.js`)
- Express server → Profile management: routes profile (evidence: `backend/server.js`)
- Express server → Daily tracking: routes logs (evidence: `backend/server.js`)
- Express server → Risk analysis: routes predictions (evidence: `backend/server.js`)
- Express server → Diet generation: routes diet (evidence: `backend/server.js`)
- Express server → Health analytics: routes analytics (evidence: `backend/server.js`)
- Authentication → Health data models: reads users (evidence: `backend/controllers/authController.js`)
- JWT middleware → Health data models: checks user (evidence: `backend/middleware/auth.js`)
- Profile management → Health data models: reads/writes profile (evidence: `backend/controllers/profileController.js`)
- Daily tracking → Health data models: updates logs scores (evidence: `backend/controllers/dailyLogController.js`)
- Risk analysis → Health data models: reads health data (evidence: `backend/controllers/predictionController.js`)
- Risk analysis → ML service: requests analysis (evidence: `backend/controllers/predictionController.js`)
- Diet generation → Health data models: reads health data (evidence: `backend/controllers/dietController.js`)
- Health analytics → Health data models: queries trends
- Health data models → MongoDB: persists records
- Health profile → API client: requests (evidence: `frontend/src/pages/Profile.jsx`)
- Daily log → API client: requests
- Risk predictions → API client: requests
- Symptom checker → API client: requests (evidence: `frontend/src/pages/SymptomChecker.jsx`)
- Diet plan → API client: requests (evidence: `frontend/src/pages/DietPlan.jsx`)
- Analytics → API client: requests
