# sachith34129-coder/macrosnap architecture

> Architecture diagram of the GitHub repository sachith34129-coder/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/sachith34129-coder/macrosnap
- Repository: https://github.com/sachith34129-coder/macrosnap

## Overview

MacroSnap is a Streamlit nutrition assistant: a user provides a name and WhatsApp number, then chats about meals by text or photo; Gemini estimates nutrition, and the user can request a conversation summary sent through WhatsApp. The workflow and integrations are implemented in app.py, with behavioral and message templates in prompts.py. The repository is small, so the stages below are conceptual responsibilities within that single application file, not separate modules.

Main entry points: [`app.py`](https://github.com/sachith34129-coder/macrosnap/blob/main/app.py) (Summary request), [`prompts.py`](https://github.com/sachith34129-coder/macrosnap/blob/main/prompts.py) (Prompt templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_onboarding["Onboarding<br/>[app.py]"]
  node_meal_chat["Meal chat<br/>[app.py]"]
  node_session[("Chat session<br/>[app.py]")]
end

subgraph group_ai["Nutrition AI"]
  node_prompts["Prompt templates<br/>[prompts.py]"]
  node_gemini["Gemini API"]
end

subgraph group_delivery["WhatsApp delivery"]
  node_summary["Summary request<br/>[app.py]"]
  node_whatsapp["WhatsApp messaging<br/>[app.py]"]
  node_twilio["Twilio API"]
end

node_user(("User"))

node_user -->|"provides details"| node_onboarding
node_onboarding -->|"loads instructions"| node_prompts
node_onboarding -->|"creates chat"| node_gemini
node_onboarding -->|"stores profile and chat"| node_session
node_user -->|"sends text or photo"| node_meal_chat
node_meal_chat -->|"updates messages"| node_session
node_meal_chat -->|"sends meal input"| node_gemini
node_meal_chat -->|"uses welcome text"| node_prompts
node_gemini -->|"returns estimate"| node_meal_chat
node_user -->|"requests summary"| node_summary
node_summary -->|"reads conversation"| node_session
node_summary -->|"loads summary prompt"| node_prompts
node_summary -->|"requests summary"| node_gemini
node_summary -->|"passes summary"| node_whatsapp
node_whatsapp -->|"sends message"| node_twilio
node_twilio -->|"returns delivery result"| node_whatsapp

click node_onboarding "https://github.com/sachith34129-coder/macrosnap/blob/main/app.py"
click node_meal_chat "https://github.com/sachith34129-coder/macrosnap/blob/main/app.py"
click node_session "https://github.com/sachith34129-coder/macrosnap/blob/main/app.py"
click node_prompts "https://github.com/sachith34129-coder/macrosnap/blob/main/prompts.py"
click node_summary "https://github.com/sachith34129-coder/macrosnap/blob/main/app.py"
click node_whatsapp "https://github.com/sachith34129-coder/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_onboarding,node_meal_chat,node_session,node_user toneBlue
class node_prompts,node_gemini toneAmber
class node_summary,node_whatsapp,node_twilio toneMint
```

## Components

### User experience

- [Onboarding](https://github.com/sachith34129-coder/macrosnap/blob/main/app.py): `app.py`
- [Meal chat](https://github.com/sachith34129-coder/macrosnap/blob/main/app.py): `app.py`
- [Chat session](https://github.com/sachith34129-coder/macrosnap/blob/main/app.py): `app.py`

### Nutrition AI

- [Prompt templates](https://github.com/sachith34129-coder/macrosnap/blob/main/prompts.py): `prompts.py`
- **Gemini API**

### WhatsApp delivery

- [Summary request](https://github.com/sachith34129-coder/macrosnap/blob/main/app.py): `app.py`
- [WhatsApp messaging](https://github.com/sachith34129-coder/macrosnap/blob/main/app.py): `app.py`
- **Twilio API**

### Other components

- **User**

## Connections

- User → Onboarding: provides details
- Onboarding → Prompt templates: loads instructions
- Onboarding → Gemini API: creates chat
- Onboarding → Chat session: stores profile and chat
- User → Meal chat: sends text or photo
- Meal chat → Chat session: updates messages
- Meal chat → Gemini API: sends meal input
- Meal chat → Prompt templates: uses welcome text
- Gemini API → Meal chat: returns estimate
- User → Summary request: requests summary
- Summary request → Chat session: reads conversation
- Summary request → Prompt templates: loads summary prompt
- Summary request → Gemini API: requests summary
- Summary request → WhatsApp messaging: passes summary
- WhatsApp messaging → Twilio API: sends message
- Twilio API → WhatsApp messaging: returns delivery result
