# gopalvutukuri14-netizen/smartpick architecture

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

- Interactive diagram: https://gitdiagram.com/gopalvutukuri14-netizen/smartpick
- Repository: https://github.com/gopalvutukuri14-netizen/smartpick

## Overview

SmartPick is a conversational retail recommendation application: a shopper submits a query with persona and prior-product context, the backend interprets and routes it through specialized agents, then returns ranked, review-grounded recommendations for the chat UI. Documented branches handle comparisons, follow-ups, general questions, and out-of-scope requests. Authentication and preference memory support personalization; catalog indexing and sentiment processing support retrieval and ranking. Relationships for unsampled agent internals are based on README documentation, not direct source inspection.

Main entry points: [`backend/orchestrator/nodes.py`](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/nodes.py) (Intent routing), [`frontend/src/App.jsx`](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/App.jsx) (Chat application), [`backend/auth/router.py`](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/auth/router.py) (Auth routes), [`backend/Agents/response/agent.py`](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/response/agent.py) (Response synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Shopping experience"]
  node_app["Chat application<br/>[App.jsx]"]
  node_chat_ui["Chat UI<br/>[ChatWindow.jsx]"]
  node_product_cards["Recommendation cards<br/>[ProductCard.jsx]"]
  node_profile_ui["Profile selector"]
  node_recommend_api["Recommendation client<br/>[recommend.js]"]
  node_auth_context["Auth state<br/>[AuthContext.jsx]"]
  node_auth_api["Auth client<br/>[auth.js]"]
end

subgraph group_api["API and identity"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_auth_router["Auth routes<br/>[router.py]"]
  node_auth_security["Token security<br/>[security.py]"]
end

subgraph group_orchestration["Conversation orchestration"]
  node_graph["LangGraph workflow<br/>[graph.py]"]
  node_routing["Intent routing<br/>[nodes.py]"]
  node_pipeline_state["Pipeline state<br/>[state.py]"]
end

subgraph group_agents["Recommendation agents"]
  node_query_agent["Query understanding<br/>[agent.py]"]
  node_retrieval_agent["Product retrieval<br/>[agent.py]"]
  node_memory_agent["Persona memory<br/>[agent.py]"]
  node_ranking_agent["Recommendation ranking<br/>[agent.py]"]
  node_xai_agent["Match explanations<br/>[agent.py]"]
  node_followup_agent["Follow-up suggestions<br/>[agent.py]"]
  node_response_agent["Response synthesis<br/>[agent.py]"]
  node_retry["Gemini retry<br/>[gemini_retry.py]"]
end

subgraph group_data["Catalog and state"]
  node_retriever["Vector search<br/>[retrieval.py]"]
  node_catalog_index["Catalog embeddings"]
  node_catalog_loader["Vector index loading<br/>[load_chromadb.py]"]
  node_image_lookup["Product images<br/>[product_images.py]"]
  node_sentiment["Review sentiment<br/>[sentiment_full.py]"]
  node_db_session["Database sessions<br/>[session.py]"]
  node_db_models["User and preference records<br/>[models.py]"]
  node_product_store[("ChromaDB catalog")]
  node_user_store[("User database")]
end

node_shopper(("Shopper"))
node_gemini(("Google Gemini"))
node_email_service(("Email delivery"))

node_shopper -->|"submits query"| node_app
node_app -->|"renders conversation"| node_chat_ui
node_app -->|"selects persona"| node_profile_ui
node_app -->|"requests recommendations"| node_recommend_api
node_recommend_api -->|"calls API"| node_backend
node_backend -->|"runs pipeline"| node_graph
node_graph -->|"dispatches nodes"| node_routing
node_graph -->|"shares state"| node_pipeline_state
node_routing -->|"interprets query"| node_query_agent
node_routing -->|"retrieves candidates"| node_retrieval_agent
node_routing -->|"loads preferences"| node_memory_agent
node_routing -->|"ranks candidates"| node_ranking_agent
node_routing -->|"explains matches"| node_xai_agent
node_routing -->|"suggests next steps"| node_followup_agent
node_routing -->|"builds response"| node_response_agent
node_retrieval_agent -->|"searches catalog"| node_retriever
node_retriever -->|"queries vectors"| node_product_store
node_catalog_index -.->|"prepares vectors"| node_catalog_loader
node_catalog_loader -.->|"loads catalog"| node_product_store
node_memory_agent -->|"reads and updates"| node_db_session
node_db_session -->|"provides sessions"| node_db_models
node_db_models -.->|"persists records"| node_user_store
node_ranking_agent -.->|"uses review signals"| node_sentiment
node_response_agent -->|"resolves images"| node_image_lookup
node_query_agent -.->|"calls model"| node_gemini
node_retry -.->|"retries calls"| node_gemini
node_response_agent -->|"uses retry helper"| node_retry
node_app -->|"reads identity"| node_auth_context
node_auth_context -->|"manages credentials"| node_auth_api
node_auth_api -->|"calls auth endpoints"| node_auth_router
node_backend -->|"registers routes"| node_auth_router
node_auth_router -.->|"verifies credentials"| node_auth_security
node_auth_router -->|"uses sessions"| node_db_session
node_auth_router -.->|"sends verification mail"| node_email_service
node_response_agent -.->|"returns recommendations"| node_product_cards

click node_app "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/App.jsx"
click node_chat_ui "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/components/ChatWindow.jsx"
click node_product_cards "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/components/ProductCard.jsx"
click node_profile_ui "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/components/ProfileSelector.jsx"
click node_recommend_api "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/api/recommend.js"
click node_auth_context "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/context/AuthContext.jsx"
click node_auth_api "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/api/auth.js"
click node_backend "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/main.py"
click node_auth_router "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/auth/router.py"
click node_auth_security "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/auth/security.py"
click node_graph "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/graph.py"
click node_routing "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/nodes.py"
click node_pipeline_state "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/state.py"
click node_query_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/query_understanding/agent.py"
click node_retrieval_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/retrieval/agent.py"
click node_memory_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/memory/agent.py"
click node_ranking_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/ranking/agent.py"
click node_xai_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/xai/agent.py"
click node_followup_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/follow_up/agent.py"
click node_response_agent "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/response/agent.py"
click node_retry "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/gemini_retry.py"
click node_retriever "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/retrieval.py"
click node_catalog_index "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/generate_embeddings.py"
click node_catalog_loader "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/load_chromadb.py"
click node_image_lookup "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/product_images.py"
click node_sentiment "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/sentiment_full.py"
click node_db_session "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/database/session.py"
click node_db_models "https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/database/models.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_app,node_chat_ui,node_product_cards,node_profile_ui,node_recommend_api,node_auth_context,node_auth_api toneBlue
class node_backend,node_auth_router,node_auth_security toneAmber
class node_graph,node_routing,node_pipeline_state toneMint
class node_query_agent,node_retrieval_agent,node_memory_agent,node_ranking_agent,node_xai_agent,node_followup_agent,node_response_agent,node_retry toneRose
class node_retriever,node_catalog_index,node_catalog_loader,node_image_lookup,node_sentiment,node_db_session,node_db_models,node_product_store,node_user_store,node_shopper,node_gemini,node_email_service toneIndigo
```

## Components

### Shopping experience

- [Chat application](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Chat UI](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/components/ChatWindow.jsx): `frontend/src/components/ChatWindow.jsx`
- [Recommendation cards](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/components/ProductCard.jsx): `frontend/src/components/ProductCard.jsx`
- [Profile selector](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/components/ProfileSelector.jsx): `frontend/src/components/ProfileSelector.jsx`
- [Recommendation client](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/api/recommend.js): `frontend/src/api/recommend.js`
- [Auth state](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Auth client](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/frontend/src/api/auth.js): `frontend/src/api/auth.js`

### API and identity

- [FastAPI endpoints](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/main.py): `backend/main.py`
- [Auth routes](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/auth/router.py): `backend/auth/router.py`
- [Token security](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/auth/security.py): `backend/auth/security.py`

### Conversation orchestration

- [LangGraph workflow](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/graph.py): `backend/orchestrator/graph.py`
- [Intent routing](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/nodes.py): `backend/orchestrator/nodes.py`
- [Pipeline state](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/orchestrator/state.py): `backend/orchestrator/state.py`

### Recommendation agents

- [Query understanding](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/query_understanding/agent.py): `backend/Agents/query_understanding/agent.py`
- [Product retrieval](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/retrieval/agent.py): `backend/Agents/retrieval/agent.py`
- [Persona memory](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/memory/agent.py): `backend/Agents/memory/agent.py`
- [Recommendation ranking](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/ranking/agent.py): `backend/Agents/ranking/agent.py`
- [Match explanations](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/xai/agent.py): `backend/Agents/xai/agent.py`
- [Follow-up suggestions](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/follow_up/agent.py): `backend/Agents/follow_up/agent.py`
- [Response synthesis](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/response/agent.py): `backend/Agents/response/agent.py`
- [Gemini retry](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/Agents/gemini_retry.py): `backend/Agents/gemini_retry.py`

### Catalog and state

- [Vector search](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/retrieval.py): `backend/pipeline/retrieval.py`
- [Catalog embeddings](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/generate_embeddings.py): `backend/pipeline/generate_embeddings.py`
- [Vector index loading](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/load_chromadb.py): `backend/pipeline/load_chromadb.py`
- [Product images](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/product_images.py): `backend/pipeline/product_images.py`
- [Review sentiment](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/pipeline/sentiment_full.py): `backend/pipeline/sentiment_full.py`
- [Database sessions](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/database/session.py): `backend/database/session.py`
- [User and preference records](https://github.com/gopalvutukuri14-netizen/smartpick/blob/main/backend/database/models.py): `backend/database/models.py`
- **ChromaDB catalog**
- **User database**

### Other components

- **Shopper**
- **Google Gemini**
- **Email delivery**

## Connections

- Shopper → Chat application: submits query (evidence: `frontend/src/App.jsx`)
- Chat application → Chat UI: renders conversation (evidence: `frontend/src/App.jsx`)
- Chat application → Profile selector: selects persona (evidence: `frontend/src/App.jsx`)
- Chat application → Recommendation client: requests recommendations (evidence: `frontend/src/App.jsx`)
- Recommendation client → FastAPI endpoints: calls API
- FastAPI endpoints → LangGraph workflow: runs pipeline (evidence: `backend/main.py`)
- LangGraph workflow → Intent routing: dispatches nodes (evidence: `backend/orchestrator/graph.py`)
- LangGraph workflow → Pipeline state: shares state (evidence: `backend/orchestrator/graph.py`)
- Intent routing → Query understanding: interprets query
- Intent routing → Product retrieval: retrieves candidates (evidence: `backend/orchestrator/nodes.py`)
- Intent routing → Persona memory: loads preferences
- Intent routing → Recommendation ranking: ranks candidates
- Intent routing → Match explanations: explains matches
- Intent routing → Follow-up suggestions: suggests next steps
- Intent routing → Response synthesis: builds response
- Product retrieval → Vector search: searches catalog (evidence: `backend/Agents/retrieval/agent.py`)
- Vector search → ChromaDB catalog: queries vectors (evidence: `backend/pipeline/retrieval.py`)
- Catalog embeddings → Vector index loading: prepares vectors
- Vector index loading → ChromaDB catalog: loads catalog
- Persona memory → Database sessions: reads and updates (evidence: `backend/Agents/memory/agent.py`)
- Database sessions → User and preference records: provides sessions (evidence: `backend/database/models.py`)
- User and preference records → User database: persists records
- Recommendation ranking → Review sentiment: uses review signals
- Response synthesis → Product images: resolves images (evidence: `backend/Agents/response/agent.py`)
- Query understanding → Google Gemini: calls model
- Gemini retry → Google Gemini: retries calls
- Response synthesis → Gemini retry: uses retry helper (evidence: `backend/Agents/response/agent.py`)
- Chat application → Auth state: reads identity (evidence: `frontend/src/App.jsx`)
- Auth state → Auth client: manages credentials (evidence: `frontend/src/context/AuthContext.jsx`)
- Auth client → Auth routes: calls auth endpoints (evidence: `frontend/src/api/auth.js`)
- FastAPI endpoints → Auth routes: registers routes (evidence: `backend/main.py`)
- Auth routes → Token security: verifies credentials (evidence: `backend/auth/router.py`)
- Auth routes → Database sessions: uses sessions (evidence: `backend/auth/router.py`)
- Auth routes → Email delivery: sends verification mail
- Response synthesis → Recommendation cards: returns recommendations
