# deen7028/healthymate architecture

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

- Interactive diagram: https://gitdiagram.com/deen7028/healthymate
- Repository: https://github.com/deen7028/healthymate

## Overview

HealthyMate is a Flutter personal-health app with PHP/MySQL APIs and local SQLite storage. Its user workflow spans onboarding and account access, daily health tracking (workouts, nutrition, routines), dashboard/calculator results, and profile management. The README also documents food recognition, notifications, badges, exports, and health-platform synchronization, so these remain visible despite unsampled Dart implementations. Relationships among Dart features are mostly based on the documented product flow; their exact calls are not shown in the excerpts.

Main entry points: [`lib/core/services/api_service.dart`](https://github.com/deen7028/healthymate/blob/main/lib/core/services/api_service.dart) (API client), [`api/db_connect.php`](https://github.com/deen7028/healthymate/blob/main/api/db_connect.php) (API auth and DB), [`api/media/upload_image.php`](https://github.com/deen7028/healthymate/blob/main/api/media/upload_image.php) (Image upload), [`lib/features/auth/login/controllers/login_controller.dart`](https://github.com/deen7028/healthymate/blob/main/lib/features/auth/login/controllers/login_controller.dart) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Flutter app"]
  node_onboarding["Onboarding"]
  node_auth_ui["Authentication"]
end

subgraph group_tracking["Health tracking"]
  node_workout["GPS workouts"]
  node_nutrition["Nutrition logs<br/>[nutrition_dao.dart]"]
  node_food_recognition["Food recognition"]
  node_routine["Habits and routines"]
  node_notifications["Notifications"]
  node_badges["Badges<br/>[badges.php]"]
end

subgraph group_account["Account and insights"]
  node_dashboard["Daily dashboard"]
  node_calculator["Health calculator"]
  node_profile["Profile settings"]
  node_export["Data export"]
end

subgraph group_backend["PHP API"]
  node_api_service["API client<br/>[api_service.dart]"]
  node_api_auth["Auth endpoints<br/>[login.php]"]
  node_api_dashboard["Dashboard endpoint<br/>[dashboard.php]"]
  node_api_workouts["Workout endpoint<br/>[workouts.php]"]
  node_api_nutrition["Nutrition endpoint<br/>[nutrition_logs.php]"]
  node_api_routines["Routine endpoints<br/>[routines.php]"]
  node_api_profile["Profile endpoints<br/>[user_profile.php]"]
  node_api_media["Image upload<br/>[upload_image.php]"]
  node_api_email["Email OTP<br/>[send_email_otp.php]"]
end

subgraph group_storage["Data and integrations"]
  node_sync["Health sync"]
  node_db_helper["API auth and DB<br/>[db_connect.php]"]
  node_local_db[("SQLite store<br/>[app_database.dart]")]
  node_server_db[("MySQL store<br/>[HealthyMate.sql]")]
end

node_user(("User"))
node_email_service["Email delivery"]
node_health_platforms["Apple Health / Google Fit"]

node_user -.->|"starts"| node_onboarding
node_onboarding -.->|"continues to"| node_auth_ui
node_user -.->|"signs in"| node_auth_ui
node_auth_ui -.->|"requests"| node_api_service
node_dashboard -.->|"loads data"| node_api_service
node_workout -.->|"syncs workout"| node_api_service
node_nutrition -.->|"syncs logs"| node_api_service
node_routine -.->|"syncs routines"| node_api_service
node_profile -.->|"updates profile"| node_api_service
node_food_recognition -.->|"supports logging"| node_nutrition
node_calculator -.->|"stores history"| node_local_db
node_routine -.->|"schedules reminders"| node_notifications
node_workout -.->|"earns achievements"| node_badges
node_export -.->|"reads data"| node_local_db
node_sync -.->|"connects"| node_health_platforms
node_api_service -.->|"calls"| node_api_auth
node_api_service -.->|"calls"| node_api_dashboard
node_api_service -.->|"calls"| node_api_workouts
node_api_service -.->|"calls"| node_api_nutrition
node_api_service -.->|"calls"| node_api_routines
node_api_service -.->|"calls"| node_api_profile
node_api_service -.->|"calls"| node_api_media
node_api_auth -->|"loads"| node_db_helper
node_api_dashboard -->|"loads"| node_db_helper
node_api_workouts -->|"loads"| node_db_helper
node_api_nutrition -->|"loads"| node_db_helper
node_api_routines -->|"loads"| node_db_helper
node_api_profile -->|"loads"| node_db_helper
node_api_media -->|"loads"| node_db_helper
node_api_email -->|"loads"| node_db_helper
node_api_media -.->|"sends OTP"| node_email_service
node_db_helper -.->|"connects"| node_server_db

click node_onboarding "https://github.com/deen7028/healthymate/blob/main/lib/features/onboarding/pages/onboarding_wizard_page.dart"
click node_auth_ui "https://github.com/deen7028/healthymate/blob/main/lib/features/auth/login/controllers/login_controller.dart"
click node_dashboard "https://github.com/deen7028/healthymate/blob/main/lib/features/dashboard/controllers/dashboard_controller.dart"
click node_workout "https://github.com/deen7028/healthymate/tree/main/lib/features/workout"
click node_nutrition "https://github.com/deen7028/healthymate/blob/main/lib/core/database/daos/activity_and_goals/nutrition_dao.dart"
click node_food_recognition "https://github.com/deen7028/healthymate/blob/main/lib/features/food_recognition/services/food_recognition_service.dart"
click node_routine "https://github.com/deen7028/healthymate/blob/main/lib/features/practice/controllers/routine_controller.dart"
click node_notifications "https://github.com/deen7028/healthymate/blob/main/lib/features/notifications/controllers/notification_controller.dart"
click node_calculator "https://github.com/deen7028/healthymate/blob/main/lib/features/health_calculator/controllers/health_calculator_controller.dart"
click node_profile "https://github.com/deen7028/healthymate/tree/main/lib/features/profile"
click node_badges "https://github.com/deen7028/healthymate/blob/main/api/routines/badges.php"
click node_export "https://github.com/deen7028/healthymate/blob/main/lib/core/services/export/data_export_service.dart"
click node_sync "https://github.com/deen7028/healthymate/blob/main/lib/core/services/health_kit/health_kit_connect_service.dart"
click node_api_service "https://github.com/deen7028/healthymate/blob/main/lib/core/services/api_service.dart"
click node_api_auth "https://github.com/deen7028/healthymate/blob/main/api/auth/login.php"
click node_api_dashboard "https://github.com/deen7028/healthymate/blob/main/api/dashboard/dashboard.php"
click node_api_workouts "https://github.com/deen7028/healthymate/blob/main/api/workouts/workouts.php"
click node_api_nutrition "https://github.com/deen7028/healthymate/blob/main/api/nutrition/nutrition_logs.php"
click node_api_routines "https://github.com/deen7028/healthymate/blob/main/api/routines.php"
click node_api_profile "https://github.com/deen7028/healthymate/blob/main/api/profile/user_profile.php"
click node_api_media "https://github.com/deen7028/healthymate/blob/main/api/media/upload_image.php"
click node_api_email "https://github.com/deen7028/healthymate/blob/main/api/auth/send_email_otp.php"
click node_db_helper "https://github.com/deen7028/healthymate/blob/main/api/db_connect.php"
click node_local_db "https://github.com/deen7028/healthymate/blob/main/lib/core/database/app_database.dart"
click node_server_db "https://github.com/deen7028/healthymate/blob/main/HealthyMate.sql"

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_onboarding,node_auth_ui,node_user toneBlue
class node_workout,node_nutrition,node_food_recognition,node_routine,node_notifications,node_badges toneAmber
class node_dashboard,node_calculator,node_profile,node_export toneMint
class node_api_service,node_api_auth,node_api_dashboard,node_api_workouts,node_api_nutrition,node_api_routines,node_api_profile,node_api_media,node_api_email toneRose
class node_sync,node_db_helper,node_local_db,node_server_db,node_email_service,node_health_platforms toneIndigo
```

## Components

### Flutter app

- [Onboarding](https://github.com/deen7028/healthymate/blob/main/lib/features/onboarding/pages/onboarding_wizard_page.dart): `lib/features/onboarding/pages/onboarding_wizard_page.dart`
- [Authentication](https://github.com/deen7028/healthymate/blob/main/lib/features/auth/login/controllers/login_controller.dart): `lib/features/auth/login/controllers/login_controller.dart`

### Health tracking

- [GPS workouts](https://github.com/deen7028/healthymate/tree/main/lib/features/workout): `lib/features/workout`
- [Nutrition logs](https://github.com/deen7028/healthymate/blob/main/lib/core/database/daos/activity_and_goals/nutrition_dao.dart): `lib/core/database/daos/activity_and_goals/nutrition_dao.dart`
- [Food recognition](https://github.com/deen7028/healthymate/blob/main/lib/features/food_recognition/services/food_recognition_service.dart): `lib/features/food_recognition/services/food_recognition_service.dart`
- [Habits and routines](https://github.com/deen7028/healthymate/blob/main/lib/features/practice/controllers/routine_controller.dart): `lib/features/practice/controllers/routine_controller.dart`
- [Notifications](https://github.com/deen7028/healthymate/blob/main/lib/features/notifications/controllers/notification_controller.dart): `lib/features/notifications/controllers/notification_controller.dart`
- [Badges](https://github.com/deen7028/healthymate/blob/main/api/routines/badges.php): `api/routines/badges.php`

### Account and insights

- [Daily dashboard](https://github.com/deen7028/healthymate/blob/main/lib/features/dashboard/controllers/dashboard_controller.dart): `lib/features/dashboard/controllers/dashboard_controller.dart`
- [Health calculator](https://github.com/deen7028/healthymate/blob/main/lib/features/health_calculator/controllers/health_calculator_controller.dart): `lib/features/health_calculator/controllers/health_calculator_controller.dart`
- [Profile settings](https://github.com/deen7028/healthymate/tree/main/lib/features/profile): `lib/features/profile`
- [Data export](https://github.com/deen7028/healthymate/blob/main/lib/core/services/export/data_export_service.dart): `lib/core/services/export/data_export_service.dart`

### PHP API

- [API client](https://github.com/deen7028/healthymate/blob/main/lib/core/services/api_service.dart): `lib/core/services/api_service.dart`
- [Auth endpoints](https://github.com/deen7028/healthymate/blob/main/api/auth/login.php): `api/auth/login.php`
- [Dashboard endpoint](https://github.com/deen7028/healthymate/blob/main/api/dashboard/dashboard.php): `api/dashboard/dashboard.php`
- [Workout endpoint](https://github.com/deen7028/healthymate/blob/main/api/workouts/workouts.php): `api/workouts/workouts.php`
- [Nutrition endpoint](https://github.com/deen7028/healthymate/blob/main/api/nutrition/nutrition_logs.php): `api/nutrition/nutrition_logs.php`
- [Routine endpoints](https://github.com/deen7028/healthymate/blob/main/api/routines.php): `api/routines.php`
- [Profile endpoints](https://github.com/deen7028/healthymate/blob/main/api/profile/user_profile.php): `api/profile/user_profile.php`
- [Image upload](https://github.com/deen7028/healthymate/blob/main/api/media/upload_image.php): `api/media/upload_image.php`
- [Email OTP](https://github.com/deen7028/healthymate/blob/main/api/auth/send_email_otp.php): `api/auth/send_email_otp.php`

### Data and integrations

- [Health sync](https://github.com/deen7028/healthymate/blob/main/lib/core/services/health_kit/health_kit_connect_service.dart): `lib/core/services/health_kit/health_kit_connect_service.dart`
- [API auth and DB](https://github.com/deen7028/healthymate/blob/main/api/db_connect.php): `api/db_connect.php`
- [SQLite store](https://github.com/deen7028/healthymate/blob/main/lib/core/database/app_database.dart): `lib/core/database/app_database.dart`
- [MySQL store](https://github.com/deen7028/healthymate/blob/main/HealthyMate.sql): `HealthyMate.sql`

### Other components

- **User**
- **Email delivery**
- **Apple Health / Google Fit**

## Connections

- User → Onboarding: starts
- Onboarding → Authentication: continues to
- User → Authentication: signs in
- Authentication → API client: requests
- Daily dashboard → API client: loads data
- GPS workouts → API client: syncs workout
- Nutrition logs → API client: syncs logs
- Habits and routines → API client: syncs routines
- Profile settings → API client: updates profile
- Food recognition → Nutrition logs: supports logging
- Health calculator → SQLite store: stores history
- Habits and routines → Notifications: schedules reminders
- GPS workouts → Badges: earns achievements
- Data export → SQLite store: reads data
- Health sync → Apple Health / Google Fit: connects
- API client → Auth endpoints: calls
- API client → Dashboard endpoint: calls
- API client → Workout endpoint: calls
- API client → Nutrition endpoint: calls
- API client → Routine endpoints: calls
- API client → Profile endpoints: calls
- API client → Image upload: calls
- Auth endpoints → API auth and DB: loads (evidence: `api/auth/login.php`)
- Dashboard endpoint → API auth and DB: loads (evidence: `api/dashboard/dashboard.php`)
- Workout endpoint → API auth and DB: loads (evidence: `api/workouts/workouts.php`)
- Nutrition endpoint → API auth and DB: loads (evidence: `api/nutrition/nutrition_logs.php`)
- Routine endpoints → API auth and DB: loads (evidence: `api/routines.php`)
- Profile endpoints → API auth and DB: loads (evidence: `api/profile/user_profile.php`)
- Image upload → API auth and DB: loads (evidence: `api/media/upload_image.php`)
- Email OTP → API auth and DB: loads (evidence: `api/auth/send_email_otp.php`)
- Image upload → Email delivery: sends OTP
- API auth and DB → MySQL store: connects
