# manishvgiri/macrosnap architecture

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

- Interactive diagram: https://gitdiagram.com/manishvgiri/macrosnap
- Repository: https://github.com/manishvgiri/macrosnap

## Overview

MacroSnap is a Streamlit nutrition-chat app: users provide a name and WhatsApp number, then submit meal text or photos for calorie and macro estimates from Gemini. They can request a conversation-wide meal summary, which the app sends to their WhatsApp number through Twilio. Prompts are defined separately in prompts.py. The tree is minimal and the README is empty; this map reflects the supplied app.py and prompts.py, without assuming additional persistence or services.

Main entry points: [`app.py`](https://github.com/manishvgiri/macrosnap/blob/main/app.py) (Streamlit UI), [`prompts.py`](https://github.com/manishvgiri/macrosnap/blob/main/prompts.py) (Nutrition prompts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_streamlit["Streamlit UI<br/>[app.py]"]
  node_chat_state["Chat session<br/>[app.py]"]
end

subgraph group_nutrition["Nutrition AI"]
  node_prompts["Nutrition prompts<br/>[prompts.py]"]
  node_gemini["Gemini API"]
  node_meal_response["Meal estimates<br/>[app.py]"]
  node_summary["Meal summary<br/>[app.py]"]
end

subgraph group_messaging["WhatsApp delivery"]
  node_twilio["Twilio API"]
end

node_user(("User"))
node_whatsapp(("WhatsApp recipient"))

node_user -->|"submits profile and meals"| node_streamlit
node_streamlit -->|"stores chat state"| node_chat_state
node_streamlit -->|"reads prompt text"| node_prompts
node_streamlit -->|"creates chat"| node_gemini
node_streamlit -->|"sends meal input"| node_gemini
node_gemini -->|"returns response"| node_streamlit
node_streamlit -->|"displays estimate"| node_meal_response
node_streamlit -->|"requests summary"| node_gemini
node_gemini -->|"returns summary text"| node_summary
node_streamlit -->|"sends summary"| node_twilio
node_twilio -->|"delivers message"| node_whatsapp

click node_streamlit "https://github.com/manishvgiri/macrosnap/blob/main/app.py"
click node_chat_state "https://github.com/manishvgiri/macrosnap/blob/main/app.py"
click node_prompts "https://github.com/manishvgiri/macrosnap/blob/main/prompts.py"
click node_meal_response "https://github.com/manishvgiri/macrosnap/blob/main/app.py"
click node_summary "https://github.com/manishvgiri/macrosnap/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_streamlit,node_chat_state,node_user toneBlue
class node_prompts,node_gemini,node_meal_response,node_summary toneAmber
class node_twilio toneMint
class node_whatsapp toneIndigo
```

## Components

### User experience

- [Streamlit UI](https://github.com/manishvgiri/macrosnap/blob/main/app.py): `app.py`
- [Chat session](https://github.com/manishvgiri/macrosnap/blob/main/app.py): `app.py`

### Nutrition AI

- [Nutrition prompts](https://github.com/manishvgiri/macrosnap/blob/main/prompts.py): `prompts.py`
- **Gemini API**
- [Meal estimates](https://github.com/manishvgiri/macrosnap/blob/main/app.py): `app.py`
- [Meal summary](https://github.com/manishvgiri/macrosnap/blob/main/app.py): `app.py`

### WhatsApp delivery

- **Twilio API**

### Other components

- **User**
- **WhatsApp recipient**

## Connections

- User → Streamlit UI: submits profile and meals
- Streamlit UI → Chat session: stores chat state
- Streamlit UI → Nutrition prompts: reads prompt text
- Streamlit UI → Gemini API: creates chat
- Streamlit UI → Gemini API: sends meal input
- Gemini API → Streamlit UI: returns response
- Streamlit UI → Meal estimates: displays estimate
- Streamlit UI → Gemini API: requests summary
- Gemini API → Meal summary: returns summary text
- Streamlit UI → Twilio API: sends summary
- Twilio API → WhatsApp recipient: delivers message
