# magnusinst84-sudo/food-sightai architecture

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

- Interactive diagram: https://gitdiagram.com/magnusinst84-sudo/food-sightai
- Repository: https://github.com/magnusinst84-sudo/food-sightai

## Overview

FoodSight AI lets people recognize Indian dishes from uploaded or camera-captured images, inspect nutrition, and track meals and health goals. The main path runs from the web interface to Flask prediction, LiteRT inference, and nutrition enrichment, then into meal tracking. Other documented capabilities include dish search, category/region browsing, accounts, profiles, and dietary indicators. The README also describes ESP32-CAM capture; its device implementation is not in this tree. Backend routes and some client wiring are only partially sampled, so uncertain links are omitted.

Main entry points: [`app.py`](https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py) (Flask API), [`static/js/app.js`](https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/app.js) (Recognition interface), [`templates/index.html`](https://github.com/magnusinst84-sudo/food-sightai/blob/main/templates/index.html) (FoodSight dashboard), [`templates/profile.html`](https://github.com/magnusinst84-sudo/food-sightai/blob/main/templates/profile.html) (Profile page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web experience"]
  node_web["FoodSight dashboard<br/>[index.html]"]
  node_profile_page["Profile page<br/>[profile.html]"]
  node_app_js["Recognition interface<br/>[app.js]"]
  node_tracker_js["Meal tracker<br/>[auth_tracker.js]"]
  node_auth_js["Auth tracking<br/>[auth_tracker.js]"]
  node_browser_store[("Browser local storage")]
end

subgraph group_api["Application API"]
  node_flask["Flask API<br/>[app.py]"]
end

subgraph group_food["Food intelligence"]
  node_model["Food classifier"]
  node_image_prep["Image preprocessing<br/>[app.py]"]
  node_food_catalog["Dish taxonomy<br/>[dataset_config.py]"]
  node_nutrition["Nutrition engine<br/>[nutrition_data.py]"]
end

subgraph group_account["Accounts and tracking"]
  node_user_account["Account and profile<br/>[app.py]"]
  node_history["Scan history<br/>[app.py]"]
  node_database[("Application database<br/>[app.py]")]
end

node_person(("Person"))
node_camera(("ESP32-CAM"))

node_person -->|"uses"| node_web
node_web -->|"loads interface"| node_app_js
node_person -->|"uploads image"| node_app_js
node_camera -.->|"posts capture"| node_flask
node_app_js -->|"requests prediction"| node_flask
node_flask -->|"prepares image"| node_image_prep
node_image_prep -->|"feeds tensor"| node_model
node_flask -->|"looks up dish"| node_nutrition
node_flask -->|"reads mappings"| node_food_catalog
node_flask -->|"returns results"| node_app_js
node_app_js -->|"requests nutrition"| node_flask
node_person -->|"searches dishes"| node_app_js
node_app_js -->|"requests browse or search"| node_flask
node_app_js -->|"logs scan"| node_tracker_js
node_tracker_js -->|"reads and writes logs"| node_browser_store
node_person -->|"signs in"| node_auth_js
node_auth_js -->|"requests authentication"| node_flask
node_person -->|"views profile"| node_profile_page
node_profile_page -->|"requests profile"| node_flask
node_flask -->|"handles account routes"| node_user_account
node_user_account -->|"reads and writes users"| node_database
node_flask -->|"handles history routes"| node_history
node_history -->|"stores scan records"| node_database

click node_web "https://github.com/magnusinst84-sudo/food-sightai/blob/main/templates/index.html"
click node_profile_page "https://github.com/magnusinst84-sudo/food-sightai/blob/main/templates/profile.html"
click node_app_js "https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/app.js"
click node_tracker_js "https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/auth_tracker.js"
click node_auth_js "https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/auth_tracker.js"
click node_flask "https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py"
click node_model "https://github.com/magnusinst84-sudo/food-sightai/blob/main/foodsight_v6.tflite"
click node_image_prep "https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py"
click node_food_catalog "https://github.com/magnusinst84-sudo/food-sightai/blob/main/dataset_config.py"
click node_nutrition "https://github.com/magnusinst84-sudo/food-sightai/blob/main/nutrition_data.py"
click node_user_account "https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py"
click node_history "https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py"
click node_database "https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.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_web,node_profile_page,node_app_js,node_tracker_js,node_auth_js,node_browser_store toneBlue
class node_flask toneAmber
class node_model,node_image_prep,node_food_catalog,node_nutrition toneMint
class node_user_account,node_history,node_database toneRose
class node_person,node_camera toneIndigo
```

## Components

### Web experience

- [FoodSight dashboard](https://github.com/magnusinst84-sudo/food-sightai/blob/main/templates/index.html): `templates/index.html`
- [Profile page](https://github.com/magnusinst84-sudo/food-sightai/blob/main/templates/profile.html): `templates/profile.html`
- [Recognition interface](https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/app.js): `static/js/app.js`
- [Meal tracker](https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/auth_tracker.js): `static/js/auth_tracker.js`
- [Auth tracking](https://github.com/magnusinst84-sudo/food-sightai/blob/main/static/js/auth_tracker.js): `static/js/auth_tracker.js`
- **Browser local storage**

### Application API

- [Flask API](https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py): `app.py`

### Food intelligence

- [Food classifier](https://github.com/magnusinst84-sudo/food-sightai/blob/main/foodsight_v6.tflite): `foodsight_v6.tflite`
- [Image preprocessing](https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py): `app.py`
- [Dish taxonomy](https://github.com/magnusinst84-sudo/food-sightai/blob/main/dataset_config.py): `dataset_config.py`
- [Nutrition engine](https://github.com/magnusinst84-sudo/food-sightai/blob/main/nutrition_data.py): `nutrition_data.py`

### Accounts and tracking

- [Account and profile](https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py): `app.py`
- [Scan history](https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py): `app.py`
- [Application database](https://github.com/magnusinst84-sudo/food-sightai/blob/main/app.py): `app.py`

### Other components

- **Person**
- **ESP32-CAM**

## Connections

- Person → FoodSight dashboard: uses
- FoodSight dashboard → Recognition interface: loads interface
- Person → Recognition interface: uploads image
- ESP32-CAM → Flask API: posts capture
- Recognition interface → Flask API: requests prediction
- Flask API → Image preprocessing: prepares image
- Image preprocessing → Food classifier: feeds tensor
- Flask API → Nutrition engine: looks up dish
- Flask API → Dish taxonomy: reads mappings
- Flask API → Recognition interface: returns results
- Recognition interface → Flask API: requests nutrition
- Person → Recognition interface: searches dishes
- Recognition interface → Flask API: requests browse or search
- Recognition interface → Meal tracker: logs scan
- Meal tracker → Browser local storage: reads and writes logs
- Person → Auth tracking: signs in
- Auth tracking → Flask API: requests authentication
- Person → Profile page: views profile
- Profile page → Flask API: requests profile
- Flask API → Account and profile: handles account routes
- Account and profile → Application database: reads and writes users
- Flask API → Scan history: handles history routes
- Scan history → Application database: stores scan records
