# pranati-parandkar/snap2serve architecture

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

- Interactive diagram: https://gitdiagram.com/pranati-parandkar/snap2serve
- Repository: https://github.com/pranati-parandkar/snap2serve

## Overview

Snap2Serve is an AI recipe-discovery web app: users provide ingredient photos and cooking constraints, receive generated recipe options, then explore and cook a selection. The React app is the main interaction surface; Gemini handles ingredient detection, recipe generation, constrained recommendations, and chat. The app also includes recipe imagery, account data, feedback, and admin analytics. The README documents cooking-mode, dietary, comparison, sharing, and personalization capabilities, but the supplied excerpts do not show every UI-to-service connection; those links are omitted where wiring is uncertain.

Main entry points: [`src/App.tsx`](https://github.com/pranati-parandkar/snap2serve/blob/main/src/App.tsx) (Recipe app), [`server.ts`](https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts) (Express API), [`src/services/geminiService.ts`](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts) (Ingredient detection), [`src/services/pixabayService.ts`](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/pixabayService.ts) (Recipe imagery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_recipe["Recipe discovery"]
  node_app["Recipe app<br/>[App.tsx]"]
  node_ingredient_ai["Ingredient detection<br/>[geminiService.ts]"]
  node_recipe_ai["Recipe generation<br/>[geminiService.ts]"]
  node_recommend["Smart recommendations<br/>[geminiService.ts]"]
  node_image_service["Recipe imagery<br/>[pixabayService.ts]"]
end

subgraph group_assistant["AI assistance"]
  node_chatbot["Chat assistant<br/>[ChatBot.tsx]"]
  node_chat_ai["Chat response<br/>[geminiService.ts]"]
end

subgraph group_accounts["Accounts and insights"]
  node_client_api["API client<br/>[apiservice.ts]"]
  node_account_data["Accounts and preferences<br/>[server.ts]"]
  node_feedback["Community feedback<br/>[server.ts]"]
  node_analytics["Session analytics<br/>[server.ts]"]
end

subgraph group_backend["Backend services"]
  node_server["Express API<br/>[server.ts]"]
  node_models["Data models<br/>[Models.ts]"]
end

node_user(("Cook"))
node_pixabay["Pixabay"]
node_gemini["Google Gemini"]
node_mongo[("MongoDB")]

node_user -->|"provides ingredients"| node_app
node_app -->|"requests detection"| node_ingredient_ai
node_app -->|"requests recipes"| node_recipe_ai
node_app -->|"requests ranking"| node_recommend
node_ingredient_ai -->|"analyzes images"| node_gemini
node_recipe_ai -->|"generates recipes"| node_gemini
node_recommend -->|"ranks options"| node_gemini
node_app -->|"requests images"| node_image_service
node_image_service -.->|"fetches photos"| node_pixabay
node_app -->|"opens assistant"| node_chatbot
node_chatbot -->|"sends messages"| node_chat_ai
node_chat_ai -->|"generates replies"| node_gemini
node_client_api -->|"sends API requests"| node_server
node_server -->|"uses schemas"| node_models
node_models -->|"persists records"| node_mongo
node_server -->|"handles account data"| node_account_data
node_server -->|"handles feedback"| node_feedback
node_server -->|"tracks sessions"| node_analytics

click node_app "https://github.com/pranati-parandkar/snap2serve/blob/main/src/App.tsx"
click node_ingredient_ai "https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts"
click node_recipe_ai "https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts"
click node_recommend "https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts"
click node_image_service "https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/pixabayService.ts"
click node_chatbot "https://github.com/pranati-parandkar/snap2serve/blob/main/src/components/ChatBot.tsx"
click node_chat_ai "https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts"
click node_client_api "https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/apiservice.ts"
click node_server "https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts"
click node_models "https://github.com/pranati-parandkar/snap2serve/blob/main/models/Models.ts"
click node_account_data "https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts"
click node_feedback "https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts"
click node_analytics "https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts"

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_app,node_ingredient_ai,node_recipe_ai,node_recommend,node_image_service toneBlue
class node_chatbot,node_chat_ai,node_mongo toneAmber
class node_client_api,node_account_data,node_feedback,node_analytics toneMint
class node_server,node_models toneRose
class node_user,node_pixabay,node_gemini toneIndigo
```

## Components

### Recipe discovery

- [Recipe app](https://github.com/pranati-parandkar/snap2serve/blob/main/src/App.tsx): `src/App.tsx`
- [Ingredient detection](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts): `src/services/geminiService.ts`
- [Recipe generation](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts): `src/services/geminiService.ts`
- [Smart recommendations](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts): `src/services/geminiService.ts`
- [Recipe imagery](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/pixabayService.ts): `src/services/pixabayService.ts`

### AI assistance

- [Chat assistant](https://github.com/pranati-parandkar/snap2serve/blob/main/src/components/ChatBot.tsx): `src/components/ChatBot.tsx`
- [Chat response](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/geminiService.ts): `src/services/geminiService.ts`

### Accounts and insights

- [API client](https://github.com/pranati-parandkar/snap2serve/blob/main/src/services/apiservice.ts): `src/services/apiservice.ts`
- [Accounts and preferences](https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts): `server.ts`
- [Community feedback](https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts): `server.ts`
- [Session analytics](https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts): `server.ts`

### Backend services

- [Express API](https://github.com/pranati-parandkar/snap2serve/blob/main/server.ts): `server.ts`
- [Data models](https://github.com/pranati-parandkar/snap2serve/blob/main/models/Models.ts): `models/Models.ts`

### Other components

- **Cook**
- **Pixabay**
- **Google Gemini**
- **MongoDB**

## Connections

- Cook → Recipe app: provides ingredients
- Recipe app → Ingredient detection: requests detection
- Recipe app → Recipe generation: requests recipes
- Recipe app → Smart recommendations: requests ranking
- Ingredient detection → Google Gemini: analyzes images
- Recipe generation → Google Gemini: generates recipes
- Smart recommendations → Google Gemini: ranks options
- Recipe app → Recipe imagery: requests images
- Recipe imagery → Pixabay: fetches photos
- Recipe app → Chat assistant: opens assistant
- Chat assistant → Chat response: sends messages
- Chat response → Google Gemini: generates replies
- API client → Express API: sends API requests
- Express API → Data models: uses schemas
- Data models → MongoDB: persists records
- Express API → Accounts and preferences: handles account data
- Express API → Community feedback: handles feedback
- Express API → Session analytics: tracks sessions
