# ivzxan/nutrisyai architecture

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

- Interactive diagram: https://gitdiagram.com/ivzxan/nutrisyai
- Repository: https://github.com/ivzxan/nutrisyai

## Overview

NutriSyAI is a mobile nutrition app. Users authenticate and set up a health profile, then scan or log meals, manage pantry and recipes, plan meals, and track nutrition and hydration; AI assistance is an additional capability. The graph follows documented navigation and sampled screen-to-service references. Some feature screens and AI/storage integrations were not sampled, so those links are marked unverified rather than inferred as direct calls.

Main entry points: [`navigation/RootNavigator.js`](https://github.com/ivzxan/nutrisyai/blob/main/navigation/RootNavigator.js) (Navigation), [`services/mealService.js`](https://github.com/ivzxan/nutrisyai/blob/main/services/mealService.js) (Meal records), [`services/pantryService.js`](https://github.com/ivzxan/nutrisyai/blob/main/services/pantryService.js) (Pantry records), [`services/firebase.js`](https://github.com/ivzxan/nutrisyai/blob/main/services/firebase.js) (Firebase and Firestore)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App foundation"]
  node_navigation["Navigation<br/>[RootNavigator.js]"]
  node_authstate["Auth state<br/>[AuthContext.js]"]
  node_theme["Theme state<br/>[ThemeContext.js]"]
  node_login["Sign in and register<br/>[LoginScreen.js]"]
  node_profile["Health profile"]
  node_home["Home dashboard<br/>[HomeScreen.js]"]
end

subgraph group_food["Food workflows"]
  node_scanner["Meal scanning<br/>[ScannerScreen.js]"]
  node_result["Meal result"]
  node_history["Meal history"]
  node_pantry["Pantry management<br/>[PantryScreen.js]"]
  node_recipes["Recipe discovery<br/>[RecipesScreen.js]"]
  node_planner["Meal planning"]
  node_assistant["AI nutrition assistant<br/>[AIAssistantChat.js]"]
end

subgraph group_wellness["Health tracking"]
  node_nutrition["Nutrition tracking"]
  node_weekly["Weekly health report"]
  node_water["Water tracking"]
  node_streak["Streak tracking<br/>[StreakScreen.js]"]
end

subgraph group_services["Application services"]
  node_mealservice["Meal records<br/>[mealService.js]"]
  node_pantryservice["Pantry records<br/>[pantryService.js]"]
  node_planservice["Plan records<br/>[mealPlanService.js]"]
  node_recipeservice["Recipe data<br/>[recipeService.js]"]
  node_waterservice["Water records<br/>[waterService.js]"]
  node_authservice["Authentication service<br/>[authService.js]"]
  node_cache[("Offline cache and queue<br/>[offlineCache.js]")]
end

subgraph group_cloud["Cloud and AI"]
  node_firestore[("Firebase and Firestore<br/>[firebase.js]")]
  node_supabase[("Supabase image storage<br/>[supabase.js]")]
  node_gemini["Gemini AI<br/>[gemini.js]"]
end

node_user(("App user"))

node_user -->|"uses"| node_navigation
node_navigation -->|"routes to"| node_login
node_navigation -->|"routes to"| node_profile
node_navigation -->|"routes to"| node_home
node_navigation -->|"routes to"| node_scanner
node_navigation -->|"routes to"| node_result
node_navigation -.->|"routes to"| node_history
node_navigation -.->|"routes to"| node_pantry
node_navigation -->|"routes to"| node_recipes
node_navigation -.->|"routes to"| node_planner
node_navigation -.->|"routes to"| node_nutrition
node_navigation -.->|"routes to"| node_weekly
node_navigation -.->|"routes to"| node_water
node_navigation -.->|"routes to"| node_streak
node_login -.->|"authenticates"| node_authservice
node_profile -->|"updates profile"| node_authservice
node_authstate -->|"loads user"| node_authservice
node_navigation -->|"reads state"| node_authstate
node_scanner -.->|"requests analysis"| node_gemini
node_scanner -.->|"uploads image"| node_supabase
node_result -->|"saves meal"| node_mealservice
node_history -->|"reads meals"| node_mealservice
node_pantry -->|"manages ingredients"| node_pantryservice
node_recipes -->|"loads recipes"| node_recipeservice
node_recipes -->|"uses ingredients"| node_pantryservice
node_planner -->|"manages plans"| node_planservice
node_planner -->|"reads meals"| node_mealservice
node_planner -->|"reads pantry"| node_pantryservice
node_nutrition -.->|"tracks meals"| node_mealservice
node_weekly -->|"summarizes meals"| node_mealservice
node_water -->|"records water"| node_waterservice
node_streak -.->|"derives streak"| node_mealservice
node_assistant -.->|"requests support"| node_gemini
node_assistant -->|"uses meal context"| node_mealservice
node_authservice -->|"reads and writes"| node_firestore
node_mealservice -->|"reads and writes"| node_firestore
node_pantryservice -->|"reads and writes"| node_firestore
node_planservice -->|"uses database"| node_firestore
node_waterservice -->|"uses database"| node_firestore
node_mealservice -->|"updates cache"| node_cache
node_pantryservice -->|"uses offline cache"| node_cache

click node_navigation "https://github.com/ivzxan/nutrisyai/blob/main/navigation/RootNavigator.js"
click node_authstate "https://github.com/ivzxan/nutrisyai/blob/main/utils/AuthContext.js"
click node_theme "https://github.com/ivzxan/nutrisyai/blob/main/utils/ThemeContext.js"
click node_login "https://github.com/ivzxan/nutrisyai/blob/main/screens/LoginScreen.js"
click node_profile "https://github.com/ivzxan/nutrisyai/blob/main/screens/HealthProfileScreen.js"
click node_home "https://github.com/ivzxan/nutrisyai/blob/main/screens/HomeScreen.js"
click node_scanner "https://github.com/ivzxan/nutrisyai/blob/main/screens/ScannerScreen.js"
click node_result "https://github.com/ivzxan/nutrisyai/blob/main/screens/MealResultScreen.js"
click node_history "https://github.com/ivzxan/nutrisyai/blob/main/screens/MealHistoryScreen.js"
click node_pantry "https://github.com/ivzxan/nutrisyai/blob/main/screens/PantryScreen.js"
click node_recipes "https://github.com/ivzxan/nutrisyai/blob/main/screens/RecipesScreen.js"
click node_planner "https://github.com/ivzxan/nutrisyai/blob/main/screens/MealPlannerScreen.js"
click node_nutrition "https://github.com/ivzxan/nutrisyai/blob/main/screens/NutritionTrackerScreen.js"
click node_weekly "https://github.com/ivzxan/nutrisyai/blob/main/screens/WeeklyHealthReportScreen.js"
click node_water "https://github.com/ivzxan/nutrisyai/blob/main/screens/WaterTrackerScreen.js"
click node_streak "https://github.com/ivzxan/nutrisyai/blob/main/screens/StreakScreen.js"
click node_mealservice "https://github.com/ivzxan/nutrisyai/blob/main/services/mealService.js"
click node_pantryservice "https://github.com/ivzxan/nutrisyai/blob/main/services/pantryService.js"
click node_planservice "https://github.com/ivzxan/nutrisyai/blob/main/services/mealPlanService.js"
click node_recipeservice "https://github.com/ivzxan/nutrisyai/blob/main/services/recipeService.js"
click node_waterservice "https://github.com/ivzxan/nutrisyai/blob/main/services/waterService.js"
click node_authservice "https://github.com/ivzxan/nutrisyai/blob/main/services/authService.js"
click node_cache "https://github.com/ivzxan/nutrisyai/blob/main/utils/offlineCache.js"
click node_firestore "https://github.com/ivzxan/nutrisyai/blob/main/services/firebase.js"
click node_supabase "https://github.com/ivzxan/nutrisyai/blob/main/services/supabase.js"
click node_gemini "https://github.com/ivzxan/nutrisyai/blob/main/services/gemini.js"
click node_assistant "https://github.com/ivzxan/nutrisyai/blob/main/components/AIAssistantChat.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_navigation,node_authstate,node_theme,node_login,node_profile,node_home,node_user toneBlue
class node_scanner,node_result,node_history,node_pantry,node_recipes,node_planner,node_assistant toneAmber
class node_nutrition,node_weekly,node_water,node_streak toneMint
class node_mealservice,node_pantryservice,node_planservice,node_recipeservice,node_waterservice,node_authservice,node_cache toneRose
class node_firestore,node_supabase,node_gemini toneIndigo
```

## Components

### App foundation

- [Navigation](https://github.com/ivzxan/nutrisyai/blob/main/navigation/RootNavigator.js): `navigation/RootNavigator.js`
- [Auth state](https://github.com/ivzxan/nutrisyai/blob/main/utils/AuthContext.js): `utils/AuthContext.js`
- [Theme state](https://github.com/ivzxan/nutrisyai/blob/main/utils/ThemeContext.js): `utils/ThemeContext.js`
- [Sign in and register](https://github.com/ivzxan/nutrisyai/blob/main/screens/LoginScreen.js): `screens/LoginScreen.js`
- [Health profile](https://github.com/ivzxan/nutrisyai/blob/main/screens/HealthProfileScreen.js): `screens/HealthProfileScreen.js`
- [Home dashboard](https://github.com/ivzxan/nutrisyai/blob/main/screens/HomeScreen.js): `screens/HomeScreen.js`

### Food workflows

- [Meal scanning](https://github.com/ivzxan/nutrisyai/blob/main/screens/ScannerScreen.js): `screens/ScannerScreen.js`
- [Meal result](https://github.com/ivzxan/nutrisyai/blob/main/screens/MealResultScreen.js): `screens/MealResultScreen.js`
- [Meal history](https://github.com/ivzxan/nutrisyai/blob/main/screens/MealHistoryScreen.js): `screens/MealHistoryScreen.js`
- [Pantry management](https://github.com/ivzxan/nutrisyai/blob/main/screens/PantryScreen.js): `screens/PantryScreen.js`
- [Recipe discovery](https://github.com/ivzxan/nutrisyai/blob/main/screens/RecipesScreen.js): `screens/RecipesScreen.js`
- [Meal planning](https://github.com/ivzxan/nutrisyai/blob/main/screens/MealPlannerScreen.js): `screens/MealPlannerScreen.js`
- [AI nutrition assistant](https://github.com/ivzxan/nutrisyai/blob/main/components/AIAssistantChat.js): `components/AIAssistantChat.js`

### Health tracking

- [Nutrition tracking](https://github.com/ivzxan/nutrisyai/blob/main/screens/NutritionTrackerScreen.js): `screens/NutritionTrackerScreen.js`
- [Weekly health report](https://github.com/ivzxan/nutrisyai/blob/main/screens/WeeklyHealthReportScreen.js): `screens/WeeklyHealthReportScreen.js`
- [Water tracking](https://github.com/ivzxan/nutrisyai/blob/main/screens/WaterTrackerScreen.js): `screens/WaterTrackerScreen.js`
- [Streak tracking](https://github.com/ivzxan/nutrisyai/blob/main/screens/StreakScreen.js): `screens/StreakScreen.js`

### Application services

- [Meal records](https://github.com/ivzxan/nutrisyai/blob/main/services/mealService.js): `services/mealService.js`
- [Pantry records](https://github.com/ivzxan/nutrisyai/blob/main/services/pantryService.js): `services/pantryService.js`
- [Plan records](https://github.com/ivzxan/nutrisyai/blob/main/services/mealPlanService.js): `services/mealPlanService.js`
- [Recipe data](https://github.com/ivzxan/nutrisyai/blob/main/services/recipeService.js): `services/recipeService.js`
- [Water records](https://github.com/ivzxan/nutrisyai/blob/main/services/waterService.js): `services/waterService.js`
- [Authentication service](https://github.com/ivzxan/nutrisyai/blob/main/services/authService.js): `services/authService.js`
- [Offline cache and queue](https://github.com/ivzxan/nutrisyai/blob/main/utils/offlineCache.js): `utils/offlineCache.js`

### Cloud and AI

- [Firebase and Firestore](https://github.com/ivzxan/nutrisyai/blob/main/services/firebase.js): `services/firebase.js`
- [Supabase image storage](https://github.com/ivzxan/nutrisyai/blob/main/services/supabase.js): `services/supabase.js`
- [Gemini AI](https://github.com/ivzxan/nutrisyai/blob/main/services/gemini.js): `services/gemini.js`

### Other components

- **App user**

## Connections

- App user → Navigation: uses (evidence: `README.md`)
- Navigation → Sign in and register: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Health profile: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Home dashboard: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Meal scanning: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Meal result: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Meal history: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Pantry management: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Recipe discovery: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Meal planning: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Nutrition tracking: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Weekly health report: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Water tracking: routes to (evidence: `navigation/RootNavigator.js`)
- Navigation → Streak tracking: routes to (evidence: `navigation/RootNavigator.js`)
- Sign in and register → Authentication service: authenticates (evidence: `README.md`)
- Health profile → Authentication service: updates profile (evidence: `screens/HealthProfileScreen.js`)
- Auth state → Authentication service: loads user (evidence: `utils/AuthContext.js`)
- Navigation → Auth state: reads state (evidence: `navigation/RootNavigator.js`)
- Meal scanning → Gemini AI: requests analysis (evidence: `README.md`)
- Meal scanning → Supabase image storage: uploads image (evidence: `README.md`)
- Meal result → Meal records: saves meal (evidence: `screens/MealResultScreen.js`)
- Meal history → Meal records: reads meals (evidence: `screens/MealHistoryScreen.js`)
- Pantry management → Pantry records: manages ingredients (evidence: `screens/PantryScreen.js`)
- Recipe discovery → Recipe data: loads recipes (evidence: `screens/RecipesScreen.js`)
- Recipe discovery → Pantry records: uses ingredients (evidence: `screens/RecipesScreen.js`)
- Meal planning → Plan records: manages plans (evidence: `screens/MealPlannerScreen.js`)
- Meal planning → Meal records: reads meals (evidence: `screens/MealPlannerScreen.js`)
- Meal planning → Pantry records: reads pantry (evidence: `screens/MealPlannerScreen.js`)
- Nutrition tracking → Meal records: tracks meals (evidence: `README.md`)
- Weekly health report → Meal records: summarizes meals (evidence: `screens/WeeklyHealthReportScreen.js`)
- Water tracking → Water records: records water (evidence: `screens/WaterTrackerScreen.js`)
- Streak tracking → Meal records: derives streak (evidence: `README.md`)
- AI nutrition assistant → Gemini AI: requests support (evidence: `README.md`)
- AI nutrition assistant → Meal records: uses meal context (evidence: `components/AIAssistantChat.js`)
- Authentication service → Firebase and Firestore: reads and writes (evidence: `services/authService.js`)
- Meal records → Firebase and Firestore: reads and writes (evidence: `services/mealService.js`)
- Pantry records → Firebase and Firestore: reads and writes (evidence: `services/pantryService.js`)
- Plan records → Firebase and Firestore: uses database (evidence: `services/mealPlanService.js`)
- Water records → Firebase and Firestore: uses database (evidence: `services/waterService.js`)
- Meal records → Offline cache and queue: updates cache (evidence: `services/mealService.js`)
- Pantry records → Offline cache and queue: uses offline cache (evidence: `services/pantryService.js`)
