# baba-ti/foodiea_remaster architecture

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

- Interactive diagram: https://gitdiagram.com/baba-ti/foodiea_remaster
- Repository: https://github.com/baba-ti/foodiea_remaster

## Overview

Foodia is a mobile meal-recommendation app backed by FastAPI and LangGraph. Its main flow combines a user’s request with preferences, restaurant history, date, and weather, then returns source-linked recipe suggestions; separate flows analyze ingredient photos and search for recipes. The README documents these capabilities and workflow stages. Several frontend screens and graph implementations were not sampled, so their internal links are included only where the README or source index supports them.

Main entry points: [`frontend-expo/src/api/foodiaApi.js`](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/api/foodiaApi.js) (Foodia API client), [`backend/src/app.py`](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/app.py) (FastAPI app), [`frontend-expo/src/screens/AssistantHome.js`](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/AssistantHome.js) (AI assistant), [`backend/src/routes/ingredients.py`](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/ingredients.py) (Image analysis endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_mobile_app["App shell<br/>[App.js]"]
  node_navigation["Navigation<br/>[stack.js]"]
  node_assistant_screen["AI assistant<br/>[AssistantHome.js]"]
  node_api_client["Foodia API client<br/>[foodiaApi.js]"]
  node_camera_screen["Ingredient camera<br/>[CameraScreen.js]"]
  node_ingredient_confirm["Confirm ingredients"]
  node_recipe_screen["Recipe results"]
  node_recipe_detail["Recipe detail<br/>[RecipeDetail.js]"]
end

subgraph group_personalization["Personalization"]
  node_preferences_screen["Preference setup"]
  node_preferences[("Food preferences")]
  node_recommendation_context["Recommendation context"]
end

subgraph group_assistant["Assistant workflow"]
  node_backend["FastAPI app<br/>[app.py]"]
  node_assistant_route["Recommendation endpoint<br/>[assistant.py]"]
  node_assistant_nodes["Context and recommendation<br/>[assistant_nodes.py]"]
  node_weather_service["Weather lookup<br/>[weather_service.py]"]
  node_search_service["Recipe web search<br/>[search_service.py]"]
end

subgraph group_food_workflows["Food workflows"]
  node_ingredient_route["Image analysis endpoint<br/>[ingredients.py]"]
  node_ingredient_graph["Ingredient workflow"]
  node_ingredient_nodes["Image recognition"]
  node_image_service["Vision model service<br/>[image_service.py]"]
  node_recipe_route["Recipe search endpoint<br/>[recipes.py]"]
  node_recipe_graph["Recipe workflow<br/>[recipe_graph.py]"]
  node_recipe_nodes["Recipe validation<br/>[recipe_nodes.py]"]
end

subgraph group_local_records["Local records"]
  node_restaurant_diary["Restaurant diary"]
  node_restaurant_entry["Restaurant entry"]
  node_restaurant_db[("Restaurant records")]
  node_restaurant_map["Diary map<br/>[RestaurantMap.js]"]
end

node_user(("User"))
node_openai{{"OpenAI search"}}

node_user -->|"uses"| node_mobile_app
node_mobile_app -->|"opens"| node_navigation
node_navigation -->|"routes"| node_preferences_screen
node_navigation -->|"routes"| node_assistant_screen
node_preferences_screen -->|"saves"| node_preferences
node_assistant_screen -->|"builds context"| node_recommendation_context
node_recommendation_context -->|"reads history"| node_restaurant_db
node_restaurant_diary -->|"reads and writes"| node_restaurant_db
node_restaurant_entry -->|"writes entries"| node_restaurant_db
node_restaurant_diary -->|"renders map"| node_restaurant_map
node_assistant_screen -.->|"requests suggestions"| node_api_client
node_camera_screen -->|"submits image"| node_api_client
node_api_client -.->|"calls API"| node_backend
node_backend -->|"registers route"| node_assistant_route
node_assistant_route -->|"starts workflow"| node_assistant_nodes
node_assistant_nodes -->|"gets weather"| node_weather_service
node_assistant_nodes -->|"searches recipes"| node_search_service
node_search_service -->|"searches web"| node_openai
node_ingredient_confirm -.->|"continues recommendation"| node_assistant_screen
node_backend -->|"registers route"| node_ingredient_route
node_ingredient_route -->|"starts workflow"| node_ingredient_graph
node_ingredient_route -->|"uses vision service"| node_image_service
node_ingredient_graph -->|"dispatches nodes"| node_ingredient_nodes
node_ingredient_nodes -.->|"analyzes image"| node_image_service
node_api_client -.->|"requests analysis"| node_ingredient_route
node_camera_screen -.->|"shows candidates"| node_ingredient_confirm
node_backend -->|"registers route"| node_recipe_route
node_recipe_route -->|"starts workflow"| node_recipe_graph
node_recipe_graph -.->|"dispatches nodes"| node_recipe_nodes
node_recipe_nodes -->|"searches candidates"| node_search_service
node_recipe_nodes -.->|"optional verification"| node_openai
node_recipe_screen -.->|"opens recipe"| node_recipe_detail
node_api_client -.->|"searches recipes"| node_recipe_route

click node_mobile_app "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/App.js"
click node_navigation "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/navigations/stack.js"
click node_preferences_screen "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/FoodPreferencesOnboardingScreen.js"
click node_preferences "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/context/FoodPreferencesContext.js"
click node_assistant_screen "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/AssistantHome.js"
click node_recommendation_context "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/services/recommendationContext.js"
click node_restaurant_diary "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RestaurantDiaryScreen.js"
click node_restaurant_entry "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RestaurantEntryScreen.js"
click node_restaurant_db "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/storage/restaurantDatabase.js"
click node_restaurant_map "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/components/RestaurantMap.js"
click node_api_client "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/api/foodiaApi.js"
click node_backend "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/app.py"
click node_assistant_route "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/assistant.py"
click node_assistant_nodes "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/nodes/assistant_nodes.py"
click node_weather_service "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/services/weather_service.py"
click node_search_service "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/services/search_service.py"
click node_camera_screen "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/CameraScreen.js"
click node_ingredient_confirm "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/IngredientConfirmScreen.js"
click node_ingredient_route "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/ingredients.py"
click node_ingredient_graph "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/ingredient_graph.py"
click node_ingredient_nodes "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/nodes/ingredient_nodes.py"
click node_image_service "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/services/image_service.py"
click node_recipe_screen "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RecipeListScreen.js"
click node_recipe_detail "https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RecipeDetail.js"
click node_recipe_route "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/recipes.py"
click node_recipe_graph "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/recipe_graph.py"
click node_recipe_nodes "https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/nodes/recipe_nodes.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_mobile_app,node_navigation,node_assistant_screen,node_api_client,node_camera_screen,node_ingredient_confirm,node_recipe_screen,node_recipe_detail,node_user toneBlue
class node_preferences_screen,node_preferences,node_recommendation_context toneAmber
class node_backend,node_assistant_route,node_assistant_nodes,node_weather_service,node_search_service toneMint
class node_ingredient_route,node_ingredient_graph,node_ingredient_nodes,node_image_service,node_recipe_route,node_recipe_graph,node_recipe_nodes toneRose
class node_restaurant_diary,node_restaurant_entry,node_restaurant_db,node_restaurant_map,node_openai toneIndigo
```

## Components

### Mobile app

- [App shell](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/App.js): `frontend-expo/src/App.js`
- [Navigation](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/navigations/stack.js): `frontend-expo/src/navigations/stack.js`
- [AI assistant](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/AssistantHome.js): `frontend-expo/src/screens/AssistantHome.js`
- [Foodia API client](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/api/foodiaApi.js): `frontend-expo/src/api/foodiaApi.js`
- [Ingredient camera](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/CameraScreen.js): `frontend-expo/src/screens/CameraScreen.js`
- [Confirm ingredients](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/IngredientConfirmScreen.js): `frontend-expo/src/screens/IngredientConfirmScreen.js`
- [Recipe results](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RecipeListScreen.js): `frontend-expo/src/screens/RecipeListScreen.js`
- [Recipe detail](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RecipeDetail.js): `frontend-expo/src/screens/RecipeDetail.js`

### Personalization

- [Preference setup](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/FoodPreferencesOnboardingScreen.js): `frontend-expo/src/screens/FoodPreferencesOnboardingScreen.js`
- [Food preferences](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/context/FoodPreferencesContext.js): `frontend-expo/src/context/FoodPreferencesContext.js`
- [Recommendation context](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/services/recommendationContext.js): `frontend-expo/src/services/recommendationContext.js`

### Assistant workflow

- [FastAPI app](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/app.py): `backend/src/app.py`
- [Recommendation endpoint](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/assistant.py): `backend/src/routes/assistant.py`
- [Context and recommendation](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/nodes/assistant_nodes.py): `backend/src/workflows/foodia/nodes/assistant_nodes.py`
- [Weather lookup](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/services/weather_service.py): `backend/src/services/weather_service.py`
- [Recipe web search](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/services/search_service.py): `backend/src/services/search_service.py`

### Food workflows

- [Image analysis endpoint](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/ingredients.py): `backend/src/routes/ingredients.py`
- [Ingredient workflow](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/ingredient_graph.py): `backend/src/workflows/foodia/ingredient_graph.py`
- [Image recognition](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/nodes/ingredient_nodes.py): `backend/src/workflows/foodia/nodes/ingredient_nodes.py`
- [Vision model service](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/services/image_service.py): `backend/src/services/image_service.py`
- [Recipe search endpoint](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/routes/recipes.py): `backend/src/routes/recipes.py`
- [Recipe workflow](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/recipe_graph.py): `backend/src/workflows/foodia/recipe_graph.py`
- [Recipe validation](https://github.com/baba-ti/foodiea_remaster/blob/main/backend/src/workflows/foodia/nodes/recipe_nodes.py): `backend/src/workflows/foodia/nodes/recipe_nodes.py`

### Local records

- [Restaurant diary](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RestaurantDiaryScreen.js): `frontend-expo/src/screens/RestaurantDiaryScreen.js`
- [Restaurant entry](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/screens/RestaurantEntryScreen.js): `frontend-expo/src/screens/RestaurantEntryScreen.js`
- [Restaurant records](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/storage/restaurantDatabase.js): `frontend-expo/src/storage/restaurantDatabase.js`
- [Diary map](https://github.com/baba-ti/foodiea_remaster/blob/main/frontend-expo/src/components/RestaurantMap.js): `frontend-expo/src/components/RestaurantMap.js`

### Other components

- **User**
- **OpenAI search**

## Connections

- User → App shell: uses
- App shell → Navigation: opens (evidence: `frontend-expo/src/App.js`)
- Navigation → Preference setup: routes (evidence: `frontend-expo/src/navigations/stack.js`)
- Navigation → AI assistant: routes
- Preference setup → Food preferences: saves (evidence: `frontend-expo/src/screens/FoodPreferencesOnboardingScreen.js`)
- AI assistant → Recommendation context: builds context
- Recommendation context → Restaurant records: reads history (evidence: `frontend-expo/src/services/recommendationContext.js`)
- Restaurant diary → Restaurant records: reads and writes (evidence: `frontend-expo/src/screens/RestaurantDiaryScreen.js`)
- Restaurant entry → Restaurant records: writes entries (evidence: `frontend-expo/src/screens/RestaurantEntryScreen.js`)
- Restaurant diary → Diary map: renders map (evidence: `frontend-expo/src/screens/RestaurantDiaryScreen.js`)
- AI assistant → Foodia API client: requests suggestions
- Ingredient camera → Foodia API client: submits image (evidence: `frontend-expo/src/screens/CameraScreen.js`)
- Foodia API client → FastAPI app: calls API
- FastAPI app → Recommendation endpoint: registers route (evidence: `backend/src/app.py`)
- Recommendation endpoint → Context and recommendation: starts workflow (evidence: `backend/src/routes/assistant.py`)
- Context and recommendation → Weather lookup: gets weather (evidence: `backend/src/workflows/foodia/nodes/assistant_nodes.py`)
- Context and recommendation → Recipe web search: searches recipes (evidence: `backend/src/workflows/foodia/nodes/assistant_nodes.py`)
- Recipe web search → OpenAI search: searches web (evidence: `backend/src/services/search_service.py`)
- Confirm ingredients → AI assistant: continues recommendation
- FastAPI app → Image analysis endpoint: registers route (evidence: `backend/src/app.py`)
- Image analysis endpoint → Ingredient workflow: starts workflow (evidence: `backend/src/routes/ingredients.py`)
- Image analysis endpoint → Vision model service: uses vision service (evidence: `backend/src/routes/ingredients.py`)
- Ingredient workflow → Image recognition: dispatches nodes (evidence: `backend/src/workflows/foodia/ingredient_graph.py`)
- Image recognition → Vision model service: analyzes image
- Foodia API client → Image analysis endpoint: requests analysis
- Ingredient camera → Confirm ingredients: shows candidates
- FastAPI app → Recipe search endpoint: registers route (evidence: `backend/src/app.py`)
- Recipe search endpoint → Recipe workflow: starts workflow (evidence: `backend/src/routes/recipes.py`)
- Recipe workflow → Recipe validation: dispatches nodes
- Recipe validation → Recipe web search: searches candidates (evidence: `backend/src/workflows/foodia/nodes/recipe_nodes.py`)
- Recipe validation → OpenAI search: optional verification
- Recipe results → Recipe detail: opens recipe
- Foodia API client → Recipe search endpoint: searches recipes
