# naveencreation/health architecture

> Architecture diagram of the GitHub repository naveencreation/health, 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/naveencreation/health
- Repository: https://github.com/naveencreation/health

## Overview

Health is a mobile wellness-tracking app. Users enter through authentication and onboarding, then reach daily tracking and analytics for nutrition, hydration, movement, and weight; the shared health context holds user and log state. Supporting branches include health-data integration, coaching chat, achievements, subscriptions, and reminders. The README contains no useful product detail, so feature scope is inferred from the source tree. Edges are limited to relationships visible in excerpts or SOURCE INDEX references; unsampled feature internals are represented by their exact directories.

Main entry points: [`src/context/HealthContext.tsx`](https://github.com/naveencreation/health/blob/main/src/context/HealthContext.tsx) (Health context), [`App.tsx`](https://github.com/naveencreation/health/blob/main/App.tsx) (App shell), [`src/services/ai/AIService.ts`](https://github.com/naveencreation/health/blob/main/src/services/ai/AIService.ts) (AI service), [`src/screens/main`](https://github.com/naveencreation/health/tree/main/src/screens/main) (Main screens)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_app["App shell<br/>[App.tsx]"]
  node_auth["Authentication"]
  node_onboarding["Onboarding"]
  node_main["Main screens"]
end

subgraph group_tracking["Wellness tracking"]
  node_healthstate["Health context<br/>[HealthContext.tsx]"]
  node_nutrition["Nutrition logging"]
  node_fooddata["Food catalog<br/>[foodDatabase.ts]"]
  node_hydration["Hydration tracking"]
  node_movement["Movement tracking"]
  node_weight["Weight tracking"]
  node_healthintegration["Health Connect"]
  node_analytics["Reports"]
end

subgraph group_engagement["Coaching and goals"]
  node_gamification["Achievements"]
  node_coachui["Ria chat<br/>[RiaChatModal.tsx]"]
  node_insights["Daily insights"]
  node_aiservice["AI service<br/>[AIService.ts]"]
  node_memory["Conversation memory"]
  node_securekeys["Secure key storage"]
  node_gemini["Gemini provider<br/>[GeminiProvider.ts]"]
end

subgraph group_platform["Platform services"]
  node_firebase[("Firebase services<br/>[firebase.ts]")]
  node_payments["Payments<br/>[paymentService.ts]"]
  node_subscription["Pro membership"]
  node_notifications["Notifications"]
end

node_user(("User"))

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_auth
node_app -->|"mounts tabs"| node_main
node_app -->|"reads auth state"| node_healthstate
node_app -->|"schedules"| node_notifications
node_auth -.->|"continues to"| node_onboarding
node_main -.->|"uses shared state"| node_healthstate
node_healthstate -->|"uses"| node_firebase
node_nutrition -->|"reads and updates"| node_healthstate
node_nutrition -.->|"uses catalog"| node_fooddata
node_hydration -->|"reads and updates"| node_healthstate
node_movement -->|"reads and updates"| node_healthstate
node_movement -.->|"offers sync"| node_healthintegration
node_weight -->|"reads and updates"| node_healthstate
node_main -.->|"routes to"| node_analytics
node_coachui -->|"calls"| node_aiservice
node_insights -->|"calls"| node_aiservice
node_aiservice -->|"uses"| node_memory
node_aiservice -->|"uses"| node_securekeys
node_aiservice -->|"dispatches to"| node_gemini
node_memory -->|"syncs chat data"| node_firebase
node_securekeys -->|"accesses user document"| node_firebase
node_subscription -->|"uses"| node_payments
node_gamification -.->|"uses progress data"| node_healthstate

click node_app "https://github.com/naveencreation/health/blob/main/App.tsx"
click node_auth "https://github.com/naveencreation/health/tree/main/src/screens/auth"
click node_onboarding "https://github.com/naveencreation/health/tree/main/src/features/onboarding"
click node_main "https://github.com/naveencreation/health/tree/main/src/screens/main"
click node_healthstate "https://github.com/naveencreation/health/blob/main/src/context/HealthContext.tsx"
click node_nutrition "https://github.com/naveencreation/health/tree/main/src/features/nutrition"
click node_fooddata "https://github.com/naveencreation/health/blob/main/src/data/foodDatabase.ts"
click node_hydration "https://github.com/naveencreation/health/tree/main/src/features/hydration"
click node_movement "https://github.com/naveencreation/health/tree/main/src/features/movement"
click node_weight "https://github.com/naveencreation/health/tree/main/src/features/weight"
click node_healthintegration "https://github.com/naveencreation/health/tree/main/src/features/health"
click node_analytics "https://github.com/naveencreation/health/blob/main/src/screens/main/AnalyticsScreen.tsx"
click node_gamification "https://github.com/naveencreation/health/tree/main/src/features/gamification"
click node_coachui "https://github.com/naveencreation/health/blob/main/src/components/modals/RiaChatModal.tsx"
click node_insights "https://github.com/naveencreation/health/blob/main/src/hooks/useRiaDailyInsight.ts"
click node_aiservice "https://github.com/naveencreation/health/blob/main/src/services/ai/AIService.ts"
click node_memory "https://github.com/naveencreation/health/blob/main/src/services/ai/memory/ConversationMemoryManager.ts"
click node_securekeys "https://github.com/naveencreation/health/blob/main/src/services/ai/storage/SecureKeyStorage.ts"
click node_gemini "https://github.com/naveencreation/health/blob/main/src/services/ai/providers/GeminiProvider.ts"
click node_firebase "https://github.com/naveencreation/health/blob/main/src/services/firebase.ts"
click node_payments "https://github.com/naveencreation/health/blob/main/src/services/payments/paymentService.ts"
click node_subscription "https://github.com/naveencreation/health/tree/main/src/features/subscription"
click node_notifications "https://github.com/naveencreation/health/tree/main/src/services/notifications"

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_auth,node_onboarding,node_main,node_user toneBlue
class node_healthstate,node_nutrition,node_fooddata,node_hydration,node_movement,node_weight,node_healthintegration,node_analytics toneAmber
class node_gamification,node_coachui,node_insights,node_aiservice,node_memory,node_securekeys,node_gemini toneMint
class node_firebase,node_payments,node_subscription,node_notifications toneRose
```

## Components

### App shell

- [App shell](https://github.com/naveencreation/health/blob/main/App.tsx): `App.tsx`
- [Authentication](https://github.com/naveencreation/health/tree/main/src/screens/auth): `src/screens/auth`
- [Onboarding](https://github.com/naveencreation/health/tree/main/src/features/onboarding): `src/features/onboarding`
- [Main screens](https://github.com/naveencreation/health/tree/main/src/screens/main): `src/screens/main`

### Wellness tracking

- [Health context](https://github.com/naveencreation/health/blob/main/src/context/HealthContext.tsx): `src/context/HealthContext.tsx`
- [Nutrition logging](https://github.com/naveencreation/health/tree/main/src/features/nutrition): `src/features/nutrition`
- [Food catalog](https://github.com/naveencreation/health/blob/main/src/data/foodDatabase.ts): `src/data/foodDatabase.ts`
- [Hydration tracking](https://github.com/naveencreation/health/tree/main/src/features/hydration): `src/features/hydration`
- [Movement tracking](https://github.com/naveencreation/health/tree/main/src/features/movement): `src/features/movement`
- [Weight tracking](https://github.com/naveencreation/health/tree/main/src/features/weight): `src/features/weight`
- [Health Connect](https://github.com/naveencreation/health/tree/main/src/features/health): `src/features/health`
- [Reports](https://github.com/naveencreation/health/blob/main/src/screens/main/AnalyticsScreen.tsx): `src/screens/main/AnalyticsScreen.tsx`

### Coaching and goals

- [Achievements](https://github.com/naveencreation/health/tree/main/src/features/gamification): `src/features/gamification`
- [Ria chat](https://github.com/naveencreation/health/blob/main/src/components/modals/RiaChatModal.tsx): `src/components/modals/RiaChatModal.tsx`
- [Daily insights](https://github.com/naveencreation/health/blob/main/src/hooks/useRiaDailyInsight.ts): `src/hooks/useRiaDailyInsight.ts`
- [AI service](https://github.com/naveencreation/health/blob/main/src/services/ai/AIService.ts): `src/services/ai/AIService.ts`
- [Conversation memory](https://github.com/naveencreation/health/blob/main/src/services/ai/memory/ConversationMemoryManager.ts): `src/services/ai/memory/ConversationMemoryManager.ts`
- [Secure key storage](https://github.com/naveencreation/health/blob/main/src/services/ai/storage/SecureKeyStorage.ts): `src/services/ai/storage/SecureKeyStorage.ts`
- [Gemini provider](https://github.com/naveencreation/health/blob/main/src/services/ai/providers/GeminiProvider.ts): `src/services/ai/providers/GeminiProvider.ts`

### Platform services

- [Firebase services](https://github.com/naveencreation/health/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- [Payments](https://github.com/naveencreation/health/blob/main/src/services/payments/paymentService.ts): `src/services/payments/paymentService.ts`
- [Pro membership](https://github.com/naveencreation/health/tree/main/src/features/subscription): `src/features/subscription`
- [Notifications](https://github.com/naveencreation/health/tree/main/src/services/notifications): `src/services/notifications`

### Other components

- **User**

## Connections

- User → App shell: opens (evidence: `App.tsx`)
- App shell → Authentication: routes to (evidence: `App.tsx`)
- App shell → Main screens: mounts tabs (evidence: `App.tsx`)
- App shell → Health context: reads auth state (evidence: `App.tsx`)
- App shell → Notifications: schedules (evidence: `App.tsx`)
- Authentication → Onboarding: continues to
- Main screens → Health context: uses shared state (evidence: `src/screens/main/ProfileScreen.tsx`)
- Health context → Firebase services: uses (evidence: `src/context/HealthContext.tsx`)
- Nutrition logging → Health context: reads and updates (evidence: `src/features/nutrition/hooks/useNutrition.ts`)
- Nutrition logging → Food catalog: uses catalog
- Hydration tracking → Health context: reads and updates (evidence: `src/features/hydration/hooks/useHydration.ts`)
- Movement tracking → Health context: reads and updates (evidence: `src/features/movement/hooks/useMovement.ts`)
- Movement tracking → Health Connect: offers sync (evidence: `src/features/movement/index.ts`)
- Weight tracking → Health context: reads and updates (evidence: `src/features/weight/hooks/useWeight.ts`)
- Main screens → Reports: routes to
- Ria chat → AI service: calls (evidence: `src/components/modals/RiaChatModal.tsx`)
- Daily insights → AI service: calls (evidence: `src/hooks/useRiaDailyInsight.ts`)
- AI service → Conversation memory: uses (evidence: `src/services/ai/AIService.ts`)
- AI service → Secure key storage: uses (evidence: `src/services/ai/AIService.ts`)
- AI service → Gemini provider: dispatches to (evidence: `src/services/ai/AIService.ts`)
- Conversation memory → Firebase services: syncs chat data (evidence: `src/services/ai/memory/ConversationMemoryManager.ts`)
- Secure key storage → Firebase services: accesses user document (evidence: `src/services/ai/storage/SecureKeyStorage.ts`)
- Pro membership → Payments: uses (evidence: `src/features/subscription/hooks/usePro.ts`)
- Achievements → Health context: uses progress data
