# chiadan/yearwhat2eat architecture

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

- Interactive diagram: https://gitdiagram.com/chiadan/yearwhat2eat
- Repository: https://github.com/chiadan/yearwhat2eat

## Overview

YeahWhat2Eat is a personalized recipe-recommendation and cooking Q&A app. Its main path runs from a user’s chat or recommendation request through the Vue client and FastAPI chat endpoint into chat_service and the RAG graph, which analyzes intent, retrieves and ranks recipe knowledge, then streams an answer. Separate branches cover recipe browsing, accounts and personalization, feedback, and recipe-data ingestion. The graph reflects README-described capabilities; several internal links are dashed because their implementation was not sampled.

Main entry points: [`backend/app/services/chat_service.py`](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/chat_service.py) (Chat orchestration), [`backend/app/api/v1/chat.py`](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/chat.py) (Chat endpoint), [`backend/app/core/clients/factory.py`](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/factory.py) (Storage factory), [`backend/app/pipeline/runner.py`](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/runner.py) (Recipe ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web["Vue application<br/>[App.vue]"]
  node_chatview["Chat interface<br/>[ChatView.vue]"]
  node_stream["Stream renderer<br/>[StreamChat.vue]"]
  node_http["HTTP client<br/>[http.ts]"]
  node_chatapi["Chat API client<br/>[chat.ts]"]
end

subgraph group_api["API and services"]
  node_router["API router<br/>[router.py]"]
  node_chatendpoint["Chat endpoint<br/>[chat.py]"]
  node_chatservice["Chat orchestration<br/>[chat_service.py]"]
  node_dishapi["Recipe endpoints<br/>[dishes.py]"]
  node_dishservice["Recipe service<br/>[dish_service.py]"]
  node_feedback["Feedback and favorites"]
  node_profiles["Profile service<br/>[profile_service.py]"]
end

subgraph group_rag["RAG and recommendation"]
  node_recommend["Menu recommendations"]
  node_raggraph["RAG graph<br/>[graph.py]"]
  node_ragnodes["Analysis and retrieval stages"]
  node_retriever["Vector retriever"]
  node_rules["Preference rule engine<br/>[rule_engine.py]"]
end

subgraph group_knowledge["Recipe knowledge"]
  node_pipeline["Recipe ingestion<br/>[runner.py]"]
  node_parser["Recipe parser<br/>[parser.py]"]
  node_indexer["Vector indexer<br/>[vector_indexer.py]"]
end

subgraph group_platform["State and integrations"]
  node_sql[("Relational data<br/>[models.py]")]
  node_session["Database sessions<br/>[session.py]"]
  node_llm["LLM client<br/>[llm.py]"]
  node_embedding["Embedding client<br/>[embedding.py]"]
  node_storefactory["Storage factory<br/>[factory.py]"]
  node_vectorstore[("Vector store<br/>[qdrant.py]")]
end

node_user(("User"))
node_externalmodel{{"LLM provider"}}

node_user -->|"asks or recommends"| node_chatview
node_chatview -->|"submits prompts"| node_chatapi
node_chatapi -->|"uses transport"| node_http
node_http -.->|"sends API requests"| node_chatendpoint
node_chatendpoint -->|"delegates chat"| node_chatservice
node_chatservice -->|"runs agent"| node_raggraph
node_raggraph -.->|"dispatches stages"| node_ragnodes
node_ragnodes -.->|"retrieves recipes"| node_retriever
node_retriever -->|"encodes queries"| node_embedding
node_retriever -->|"builds store"| node_storefactory
node_storefactory -->|"selects provider"| node_vectorstore
node_ragnodes -.->|"filters preferences"| node_rules
node_chatservice -->|"generates response"| node_llm
node_llm -->|"calls model"| node_externalmodel
node_chatservice -->|"streams answer"| node_stream
node_stream -->|"shows response"| node_user
node_router -->|"registers route"| node_chatendpoint
node_router -->|"registers route"| node_dishapi
node_dishapi -->|"delegates recipes"| node_dishservice
node_dishapi -->|"records feedback"| node_feedback
node_feedback -->|"recalculates profile"| node_profiles
node_feedback -->|"mirrors preferences"| node_storefactory
node_chatendpoint -->|"routes recommendations"| node_recommend
node_recommend -.->|"applies hard filters"| node_rules
node_pipeline -.->|"parses source"| node_parser
node_pipeline -.->|"builds indexes"| node_indexer
node_pipeline -.->|"stores recipe metadata"| node_sql
node_indexer -.->|"creates vectors"| node_embedding
node_indexer -.->|"builds vector store"| node_storefactory
node_session -->|"opens sessions"| node_sql
node_chatservice -->|"uses user profile"| node_profiles

click node_web "https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/App.vue"
click node_chatview "https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/views/ChatView.vue"
click node_stream "https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/components/StreamChat.vue"
click node_http "https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/api/http.ts"
click node_chatapi "https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/api/chat.ts"
click node_router "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/router.py"
click node_chatendpoint "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/chat.py"
click node_chatservice "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/chat_service.py"
click node_dishapi "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/dishes.py"
click node_dishservice "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/dish_service.py"
click node_feedback "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/feedback_service.py"
click node_profiles "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/profile_service.py"
click node_recommend "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/recommend_service.py"
click node_raggraph "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/rag/graph.py"
click node_ragnodes "https://github.com/chiadan/yearwhat2eat/tree/master/backend/app/rag/nodes"
click node_retriever "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/rag/retrievers/vector_retriever.py"
click node_rules "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/rag/rule_engine.py"
click node_pipeline "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/runner.py"
click node_parser "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/parser.py"
click node_indexer "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/vector_indexer.py"
click node_sql "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/db/models.py"
click node_session "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/db/session.py"
click node_llm "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/llm.py"
click node_embedding "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/embedding.py"
click node_storefactory "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/factory.py"
click node_vectorstore "https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/qdrant.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_chatview,node_stream,node_http,node_chatapi,node_user toneBlue
class node_router,node_chatendpoint,node_chatservice,node_dishapi,node_dishservice,node_feedback,node_profiles toneAmber
class node_recommend,node_raggraph,node_ragnodes,node_retriever,node_rules toneMint
class node_pipeline,node_parser,node_indexer toneRose
class node_sql,node_session,node_llm,node_embedding,node_storefactory,node_vectorstore,node_externalmodel toneIndigo
```

## Components

### Web client

- [Vue application](https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/App.vue): `frontend/src/App.vue`
- [Chat interface](https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/views/ChatView.vue): `frontend/src/views/ChatView.vue`
- [Stream renderer](https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/components/StreamChat.vue): `frontend/src/components/StreamChat.vue`
- [HTTP client](https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/api/http.ts): `frontend/src/api/http.ts`
- [Chat API client](https://github.com/chiadan/yearwhat2eat/blob/master/frontend/src/api/chat.ts): `frontend/src/api/chat.ts`

### API and services

- [API router](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Chat endpoint](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/chat.py): `backend/app/api/v1/chat.py`
- [Chat orchestration](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/chat_service.py): `backend/app/services/chat_service.py`
- [Recipe endpoints](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/api/v1/dishes.py): `backend/app/api/v1/dishes.py`
- [Recipe service](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/dish_service.py): `backend/app/services/dish_service.py`
- [Feedback and favorites](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/feedback_service.py): `backend/app/services/feedback_service.py`
- [Profile service](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/profile_service.py): `backend/app/services/profile_service.py`

### RAG and recommendation

- [Menu recommendations](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/services/recommend_service.py): `backend/app/services/recommend_service.py`
- [RAG graph](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/rag/graph.py): `backend/app/rag/graph.py`
- [Analysis and retrieval stages](https://github.com/chiadan/yearwhat2eat/tree/master/backend/app/rag/nodes): `backend/app/rag/nodes`
- [Vector retriever](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/rag/retrievers/vector_retriever.py): `backend/app/rag/retrievers/vector_retriever.py`
- [Preference rule engine](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/rag/rule_engine.py): `backend/app/rag/rule_engine.py`

### Recipe knowledge

- [Recipe ingestion](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/runner.py): `backend/app/pipeline/runner.py`
- [Recipe parser](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/parser.py): `backend/app/pipeline/parser.py`
- [Vector indexer](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/pipeline/vector_indexer.py): `backend/app/pipeline/vector_indexer.py`

### State and integrations

- [Relational data](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/db/models.py): `backend/app/db/models.py`
- [Database sessions](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/db/session.py): `backend/app/db/session.py`
- [LLM client](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/llm.py): `backend/app/core/clients/llm.py`
- [Embedding client](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/embedding.py): `backend/app/core/clients/embedding.py`
- [Storage factory](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/factory.py): `backend/app/core/clients/factory.py`
- [Vector store](https://github.com/chiadan/yearwhat2eat/blob/master/backend/app/core/clients/qdrant.py): `backend/app/core/clients/qdrant.py`

### Other components

- **User**
- **LLM provider**

## Connections

- User → Chat interface: asks or recommends (evidence: `README.md`)
- Chat interface → Chat API client: submits prompts (evidence: `frontend/src/views/ChatView.vue`)
- Chat API client → HTTP client: uses transport (evidence: `frontend/src/api/chat.ts`)
- HTTP client → Chat endpoint: sends API requests
- Chat endpoint → Chat orchestration: delegates chat (evidence: `backend/app/api/v1/chat.py`)
- Chat orchestration → RAG graph: runs agent (evidence: `backend/app/services/chat_service.py`)
- RAG graph → Analysis and retrieval stages: dispatches stages
- Analysis and retrieval stages → Vector retriever: retrieves recipes
- Vector retriever → Embedding client: encodes queries (evidence: `backend/app/rag/retrievers/vector_retriever.py`)
- Vector retriever → Storage factory: builds store (evidence: `backend/app/rag/retrievers/vector_retriever.py`)
- Storage factory → Vector store: selects provider (evidence: `backend/app/core/clients/factory.py`)
- Analysis and retrieval stages → Preference rule engine: filters preferences
- Chat orchestration → LLM client: generates response (evidence: `backend/app/services/chat_service.py`)
- LLM client → LLM provider: calls model (evidence: `backend/app/core/clients/llm.py`)
- Chat orchestration → Stream renderer: streams answer (evidence: `README.md`)
- Stream renderer → User: shows response (evidence: `README.md`)
- API router → Chat endpoint: registers route (evidence: `backend/app/api/v1/router.py`)
- API router → Recipe endpoints: registers route (evidence: `backend/app/api/v1/router.py`)
- Recipe endpoints → Recipe service: delegates recipes (evidence: `backend/app/api/v1/dishes.py`)
- Recipe endpoints → Feedback and favorites: records feedback (evidence: `backend/app/api/v1/dishes.py`)
- Feedback and favorites → Profile service: recalculates profile (evidence: `backend/app/services/feedback_service.py`)
- Feedback and favorites → Storage factory: mirrors preferences (evidence: `backend/app/services/feedback_service.py`)
- Chat endpoint → Menu recommendations: routes recommendations (evidence: `backend/app/api/v1/chat.py`)
- Menu recommendations → Preference rule engine: applies hard filters
- Recipe ingestion → Recipe parser: parses source
- Recipe ingestion → Vector indexer: builds indexes
- Recipe ingestion → Relational data: stores recipe metadata
- Vector indexer → Embedding client: creates vectors
- Vector indexer → Storage factory: builds vector store
- Database sessions → Relational data: opens sessions (evidence: `backend/app/db/session.py`)
- Chat orchestration → Profile service: uses user profile (evidence: `backend/app/services/chat_service.py`)
