# ndricimrr/bilmenu architecture

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

- Interactive diagram: https://gitdiagram.com/ndricimrr/bilmenu
- Repository: https://github.com/ndricimrr/bilmenu

## Overview

BilMenu publishes Bilkent cafeteria menus as weekly JSON and presents them through a bilingual web app and mobile app. The documented data workflow fetches cafeteria HTML, tries format-specific parsers, and writes weekly menu JSON; AI parsing scripts provide a separate parsing route with validation and vegan enrichment. Web and mobile menu display, meal categories, and mobile meal submission are distinct product capabilities. The excerpts establish parser dispatch and selected module references; unsampled mobile wiring and JSON delivery details are not inferred.

Main entry points: [`webapp/legacy/parser.js`](https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/parser.js) (Parser Dispatcher), [`mobile/bilmenu/app/(tabs)/submit.tsx`](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/submit.tsx) (Meal Submission), [`webapp/js/day.js`](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/day.js) (Day Model), [`webapp/js/utilities_node.js`](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/utilities_node.js) (Weekly Menu JSON)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web Menu Experience"]
  node_webapp["Web Menu UI<br/>[week.js]"]
  node_menu_fetch["Menu Fetch<br/>[fetchMealPlan.js]"]
  node_day_view["Day Menu<br/>[day.js]"]
  node_meal_view["Meal Details<br/>[meal.js]"]
  node_web_language["Language Switching"]
end

subgraph group_mobile["Mobile App"]
  node_mobile_app["Mobile Menu<br/>[index.tsx]"]
  node_mobile_settings["App Settings<br/>[settings.tsx]"]
  node_mobile_submit["Meal Submission<br/>[submit.tsx]"]
  node_submit_steps["Submission Steps<br/>[Step3.tsx]"]
  node_submit_search["Meal Search<br/>[SearchView.tsx]"]
  node_submit_data["Submission Data<br/>[useSubmitData.ts]"]
end

subgraph group_parse["Menu Parsing"]
  node_parser["Parser Dispatcher<br/>[parser.js]"]
  node_mso_parser["MSO Parser"]
  node_mso_2024_parser["MSO 2024 Parser"]
  node_icerik_parser["Icerik Parser"]
  node_day_model["Day Model<br/>[day.js]"]
  node_meal_model["Meal Model<br/>[meal.js]"]
  node_week_model["Week Model<br/>[week.js]"]
  node_week_files[("Weekly Menu JSON<br/>[utilities_node.js]")]
end

subgraph group_ai["AI Parsing"]
  node_gemini_parser["Gemini Parsing<br/>[callGemini_v2.js]"]
  node_openrouter_parser["OpenRouter Parsing<br/>[callOpenRouter.js]"]
  node_ai_shared["AI Validation"]
end

node_student(("Student"))
node_cafeteria["Cafeteria Menu Site"]
node_gemini["Google Gemini"]
node_openrouter["OpenRouter API"]

node_student -->|"browses menus"| node_webapp
node_menu_fetch -.->|"loads weekly JSON"| node_week_files
node_webapp -->|"renders days"| node_day_view
node_day_view -->|"uses meals"| node_meal_view
node_student -->|"views menus"| node_mobile_app
node_student -->|"submits meals"| node_mobile_submit
node_mobile_submit -.->|"presents steps"| node_submit_steps
node_mobile_submit -.->|"offers search"| node_submit_search
node_mobile_submit -.->|"uses submission data"| node_submit_data
node_cafeteria -->|"provides HTML"| node_parser
node_parser -->|"tries first"| node_mso_2024_parser
node_parser -->|"tries next"| node_mso_parser
node_parser -->|"tries fallback"| node_icerik_parser
node_parser -->|"writes weekly JSON"| node_week_files
node_mso_parser -->|"constructs days"| node_day_model
node_mso_parser -->|"constructs meals"| node_meal_model
node_mso_2024_parser -->|"constructs days"| node_day_model
node_mso_2024_parser -->|"constructs meals"| node_meal_model
node_day_model -->|"serializes meals"| node_meal_model
node_week_model -->|"uses day model"| node_day_model
node_gemini_parser -->|"requests parsing"| node_gemini
node_gemini_parser -->|"validates output"| node_ai_shared
node_gemini_parser -->|"writes weekly JSON"| node_week_files
node_openrouter_parser -->|"requests parsing"| node_openrouter
node_openrouter_parser -->|"validates output"| node_ai_shared
node_openrouter_parser -->|"writes weekly JSON"| node_week_files

click node_webapp "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/week.js"
click node_menu_fetch "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/fetchMealPlan.js"
click node_day_view "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/day.js"
click node_meal_view "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/meal.js"
click node_web_language "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/language-switcher.js"
click node_mobile_app "https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/index.tsx"
click node_mobile_settings "https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/settings.tsx"
click node_mobile_submit "https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/submit.tsx"
click node_submit_steps "https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/components/submit/Step3.tsx"
click node_submit_search "https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/components/submit/SearchView.tsx"
click node_submit_data "https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/hooks/useSubmitData.ts"
click node_parser "https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/parser.js"
click node_mso_parser "https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/meal-parser-node-MsoNormalTable.js"
click node_mso_2024_parser "https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/parser-node-Mso-07-2024.js"
click node_icerik_parser "https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/meal-parser-node-icerik.js"
click node_day_model "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/day.js"
click node_meal_model "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/meal.js"
click node_week_model "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/week.js"
click node_week_files "https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/utilities_node.js"
click node_gemini_parser "https://github.com/ndricimrr/bilmenu/blob/main/scripts/ai/callGemini_v2.js"
click node_openrouter_parser "https://github.com/ndricimrr/bilmenu/blob/main/scripts/ai/callOpenRouter.js"
click node_ai_shared "https://github.com/ndricimrr/bilmenu/blob/main/scripts/ai/mealPlanParseShared.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_webapp,node_menu_fetch,node_day_view,node_meal_view,node_web_language toneBlue
class node_mobile_app,node_mobile_settings,node_mobile_submit,node_submit_steps,node_submit_search,node_submit_data toneAmber
class node_parser,node_mso_parser,node_mso_2024_parser,node_icerik_parser,node_day_model,node_meal_model,node_week_model,node_week_files,node_openrouter toneMint
class node_gemini_parser,node_openrouter_parser,node_ai_shared toneRose
class node_student,node_cafeteria,node_gemini toneIndigo
```

## Components

### Web Menu Experience

- [Web Menu UI](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/week.js): `webapp/js/week.js`
- [Menu Fetch](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/fetchMealPlan.js): `webapp/js/fetchMealPlan.js`
- [Day Menu](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/day.js): `webapp/js/day.js`
- [Meal Details](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/meal.js): `webapp/js/meal.js`
- [Language Switching](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/language-switcher.js): `webapp/js/language-switcher.js`

### Mobile App

- [Mobile Menu](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/index.tsx): `mobile/bilmenu/app/(tabs)/index.tsx`
- [App Settings](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/settings.tsx): `mobile/bilmenu/app/(tabs)/settings.tsx`
- [Meal Submission](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/app/(tabs)/submit.tsx): `mobile/bilmenu/app/(tabs)/submit.tsx`
- [Submission Steps](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/components/submit/Step3.tsx): `mobile/bilmenu/components/submit/Step3.tsx`
- [Meal Search](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/components/submit/SearchView.tsx): `mobile/bilmenu/components/submit/SearchView.tsx`
- [Submission Data](https://github.com/ndricimrr/bilmenu/blob/main/mobile/bilmenu/hooks/useSubmitData.ts): `mobile/bilmenu/hooks/useSubmitData.ts`

### Menu Parsing

- [Parser Dispatcher](https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/parser.js): `webapp/legacy/parser.js`
- [MSO Parser](https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/meal-parser-node-MsoNormalTable.js): `webapp/legacy/meal-parser-node-MsoNormalTable.js`
- [MSO 2024 Parser](https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/parser-node-Mso-07-2024.js): `webapp/legacy/parser-node-Mso-07-2024.js`
- [Icerik Parser](https://github.com/ndricimrr/bilmenu/blob/main/webapp/legacy/meal-parser-node-icerik.js): `webapp/legacy/meal-parser-node-icerik.js`
- [Day Model](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/day.js): `webapp/js/day.js`
- [Meal Model](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/meal.js): `webapp/js/meal.js`
- [Week Model](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/week.js): `webapp/js/week.js`
- [Weekly Menu JSON](https://github.com/ndricimrr/bilmenu/blob/main/webapp/js/utilities_node.js): `webapp/js/utilities_node.js`

### AI Parsing

- [Gemini Parsing](https://github.com/ndricimrr/bilmenu/blob/main/scripts/ai/callGemini_v2.js): `scripts/ai/callGemini_v2.js`
- [OpenRouter Parsing](https://github.com/ndricimrr/bilmenu/blob/main/scripts/ai/callOpenRouter.js): `scripts/ai/callOpenRouter.js`
- [AI Validation](https://github.com/ndricimrr/bilmenu/blob/main/scripts/ai/mealPlanParseShared.js): `scripts/ai/mealPlanParseShared.js`

### Other components

- **Student**
- **Cafeteria Menu Site**
- **Google Gemini**
- **OpenRouter API**

## Connections

- Student → Web Menu UI: browses menus
- Menu Fetch → Weekly Menu JSON: loads weekly JSON
- Web Menu UI → Day Menu: renders days (evidence: `webapp/js/week.js`)
- Day Menu → Meal Details: uses meals (evidence: `webapp/js/day.js`)
- Student → Mobile Menu: views menus
- Student → Meal Submission: submits meals
- Meal Submission → Submission Steps: presents steps
- Meal Submission → Meal Search: offers search
- Meal Submission → Submission Data: uses submission data
- Cafeteria Menu Site → Parser Dispatcher: provides HTML (evidence: `webapp/legacy/parser.js`)
- Parser Dispatcher → MSO 2024 Parser: tries first (evidence: `webapp/legacy/parser.js`)
- Parser Dispatcher → MSO Parser: tries next (evidence: `webapp/legacy/parser.js`)
- Parser Dispatcher → Icerik Parser: tries fallback (evidence: `webapp/legacy/parser.js`)
- Parser Dispatcher → Weekly Menu JSON: writes weekly JSON (evidence: `webapp/legacy/parser.js`)
- MSO Parser → Day Model: constructs days (evidence: `webapp/legacy/meal-parser-node-MsoNormalTable.js`)
- MSO Parser → Meal Model: constructs meals (evidence: `webapp/legacy/meal-parser-node-MsoNormalTable.js`)
- MSO 2024 Parser → Day Model: constructs days (evidence: `webapp/legacy/parser-node-Mso-07-2024.js`)
- MSO 2024 Parser → Meal Model: constructs meals (evidence: `webapp/legacy/parser-node-Mso-07-2024.js`)
- Day Model → Meal Model: serializes meals (evidence: `webapp/js/day.js`)
- Week Model → Day Model: uses day model (evidence: `webapp/js/week.js`)
- Gemini Parsing → Google Gemini: requests parsing (evidence: `scripts/ai/callGemini_v2.js`)
- Gemini Parsing → AI Validation: validates output (evidence: `scripts/ai/callGemini_v2.js`)
- Gemini Parsing → Weekly Menu JSON: writes weekly JSON (evidence: `scripts/ai/callGemini_v2.js`)
- OpenRouter Parsing → OpenRouter API: requests parsing (evidence: `scripts/ai/callOpenRouter.js`)
- OpenRouter Parsing → AI Validation: validates output (evidence: `scripts/ai/callOpenRouter.js`)
- OpenRouter Parsing → Weekly Menu JSON: writes weekly JSON (evidence: `scripts/ai/callOpenRouter.js`)
