# ahmdlka/menu-bergizi-generator architecture

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

- Interactive diagram: https://gitdiagram.com/ahmdlka/menu-bergizi-generator
- Repository: https://github.com/ahmdlka/menu-bergizi-generator

## Overview

Menu Bergizi Generator is a React frontend backed by a Go REST API and a Python RAG service. The primary workflow is selecting Fast or Specific generation, submitting duration/budget and optionally profile constraints, then displaying a meal plan; dashboard chat supports plan refinement and nutrition questions. The README documents JWT authentication, profile management, versioned plans, PDF-backed ChromaDB retrieval, and Gemini generation. Relationships below follow shown calls or README architecture; many backend internals and frontend chat wiring were not excerpted, so uncertain links are omitted.

Main entry points: [`frontend/src/app/pages/DashboardPage.tsx`](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/DashboardPage.tsx) (Meal dashboard), [`frontend/src/app/lib/api.ts`](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/api.ts) (API client), [`frontend/src/app/App.tsx`](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/App.tsx) (Route shell), [`frontend/src/app/pages/AuthPage.tsx`](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/AuthPage.tsx) (Sign in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_app["Route shell<br/>[App.tsx]"]
  node_authpage["Sign in<br/>[AuthPage.tsx]"]
  node_dashboard["Meal dashboard<br/>[DashboardPage.tsx]"]
  node_profileui["Profile screens<br/>[ProfilePage.tsx]"]
  node_forms["Generator forms"]
  node_mealview["Plan display<br/>[MealPlanView.tsx]"]
  node_chatui["AI chat panel<br/>[ChatPanel.tsx]"]
  node_client["API client<br/>[api.ts]"]
  node_session["Token storage<br/>[auth.ts]"]
  node_planstate["Plan state<br/>[mealPlanStore.tsx]"]
end

subgraph group_api["Go API"]
  node_authroutes["Auth routes<br/>[routes.go]"]
  node_authservice["JWT authentication<br/>[auth_service.go]"]
  node_userapi["User profile<br/>[user_controller.go]"]
  node_mealapi["Meal plan API"]
  node_mealservice["Plan orchestration"]
  node_chatapi["Chat API<br/>[chat_controller.go]"]
  node_chatservice["Chat intent<br/>[chat_service.go]"]
  node_ragclient["RAG client<br/>[rag_client.go]"]
end

subgraph group_ai["AI and retrieval"]
  node_ragservice["RAG endpoints<br/>[main.py]"]
  node_retrieval["PDF retrieval<br/>[rag_pipeline.py]"]
  node_chromadb[("ChromaDB vectors")]
end

subgraph group_state["Persistent data"]
  node_postgres[("PostgreSQL records<br/>[database.go]")]
end

node_person(("User"))
node_gemini["Gemini API"]

node_person -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_authpage
node_person -->|"submits constraints"| node_dashboard
node_dashboard -->|"selects mode"| node_forms
node_dashboard -->|"requests generation"| node_client
node_client -->|"HTTP requests"| node_mealapi
node_dashboard -->|"sets plan"| node_planstate
node_dashboard -->|"renders plan"| node_mealview
node_dashboard -->|"opens chat"| node_chatui
node_authpage -->|"calls auth API"| node_client
node_authpage -->|"stores token"| node_session
node_client -->|"reads token"| node_session
node_authroutes -->|"dispatches"| node_authservice
node_client -->|"HTTP requests"| node_authroutes
node_client -->|"HTTP requests"| node_userapi
node_client -->|"HTTP requests"| node_chatapi
node_mealapi -->|"delegates"| node_mealservice
node_mealservice -->|"requests AI plan"| node_ragclient
node_chatapi -->|"delegates"| node_chatservice
node_chatservice -->|"requests AI chat"| node_ragclient
node_mealservice -.->|"persists plans"| node_postgres
node_chatservice -.->|"stores history"| node_postgres
node_ragclient -->|"forwards requests"| node_ragservice
node_ragservice -->|"retrieves context"| node_retrieval
node_retrieval -->|"queries vectors"| node_chromadb
node_ragservice -->|"generates responses"| node_gemini
node_retrieval -->|"adds PDF chunks"| node_chromadb

click node_app "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/App.tsx"
click node_authpage "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/AuthPage.tsx"
click node_dashboard "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/DashboardPage.tsx"
click node_profileui "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/ProfilePage.tsx"
click node_forms "https://github.com/ahmdlka/menu-bergizi-generator/tree/main/frontend/src/app/components/forms"
click node_mealview "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/components/MealPlanView.tsx"
click node_chatui "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/components/ChatPanel.tsx"
click node_client "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/api.ts"
click node_session "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/auth.ts"
click node_planstate "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/mealPlanStore.tsx"
click node_authroutes "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/auth/routes.go"
click node_authservice "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/auth/service/auth_service.go"
click node_userapi "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/user/controller/user_controller.go"
click node_mealapi "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/meal_plan/controller/meal_plan_controller.go"
click node_mealservice "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/meal_plan/service/meal_plan_service.go"
click node_chatapi "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/chat/controller/chat_controller.go"
click node_chatservice "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/chat/service/chat_service.go"
click node_ragclient "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/pkg/ragclient/rag_client.go"
click node_postgres "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/config/database.go"
click node_ragservice "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/ai/main.py"
click node_retrieval "https://github.com/ahmdlka/menu-bergizi-generator/blob/main/ai/rag_pipeline.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_authpage,node_dashboard,node_profileui,node_forms,node_mealview,node_chatui,node_client,node_session,node_planstate,node_person toneBlue
class node_authroutes,node_authservice,node_userapi,node_mealapi,node_mealservice,node_chatapi,node_chatservice,node_ragclient toneAmber
class node_ragservice,node_retrieval,node_chromadb,node_gemini toneMint
class node_postgres toneRose
```

## Components

### Web experience

- [Route shell](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [Sign in](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/AuthPage.tsx): `frontend/src/app/pages/AuthPage.tsx`
- [Meal dashboard](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/DashboardPage.tsx): `frontend/src/app/pages/DashboardPage.tsx`
- [Profile screens](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/pages/ProfilePage.tsx): `frontend/src/app/pages/ProfilePage.tsx`
- [Generator forms](https://github.com/ahmdlka/menu-bergizi-generator/tree/main/frontend/src/app/components/forms): `frontend/src/app/components/forms`
- [Plan display](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/components/MealPlanView.tsx): `frontend/src/app/components/MealPlanView.tsx`
- [AI chat panel](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/components/ChatPanel.tsx): `frontend/src/app/components/ChatPanel.tsx`
- [API client](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/api.ts): `frontend/src/app/lib/api.ts`
- [Token storage](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/auth.ts): `frontend/src/app/lib/auth.ts`
- [Plan state](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/frontend/src/app/lib/mealPlanStore.tsx): `frontend/src/app/lib/mealPlanStore.tsx`

### Go API

- [Auth routes](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/auth/routes.go): `backend/modules/auth/routes.go`
- [JWT authentication](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/auth/service/auth_service.go): `backend/modules/auth/service/auth_service.go`
- [User profile](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/user/controller/user_controller.go): `backend/modules/user/controller/user_controller.go`
- [Meal plan API](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/meal_plan/controller/meal_plan_controller.go): `backend/modules/meal_plan/controller/meal_plan_controller.go`
- [Plan orchestration](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/meal_plan/service/meal_plan_service.go): `backend/modules/meal_plan/service/meal_plan_service.go`
- [Chat API](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/chat/controller/chat_controller.go): `backend/modules/chat/controller/chat_controller.go`
- [Chat intent](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/modules/chat/service/chat_service.go): `backend/modules/chat/service/chat_service.go`
- [RAG client](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/pkg/ragclient/rag_client.go): `backend/pkg/ragclient/rag_client.go`

### AI and retrieval

- [RAG endpoints](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/ai/main.py): `ai/main.py`
- [PDF retrieval](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/ai/rag_pipeline.py): `ai/rag_pipeline.py`
- **ChromaDB vectors**

### Persistent data

- [PostgreSQL records](https://github.com/ahmdlka/menu-bergizi-generator/blob/main/backend/config/database.go): `backend/config/database.go`

### Other components

- **User**
- **Gemini API**

## Connections

- User → Route shell: uses (evidence: `README.md`)
- Route shell → Meal dashboard: routes to (evidence: `frontend/src/app/App.tsx`)
- Route shell → Sign in: routes to (evidence: `frontend/src/app/App.tsx`)
- User → Meal dashboard: submits constraints (evidence: `README.md`)
- Meal dashboard → Generator forms: selects mode (evidence: `frontend/src/app/pages/DashboardPage.tsx`)
- Meal dashboard → API client: requests generation (evidence: `frontend/src/app/pages/DashboardPage.tsx`)
- API client → Meal plan API: HTTP requests (evidence: `README.md`)
- Meal dashboard → Plan state: sets plan (evidence: `frontend/src/app/pages/DashboardPage.tsx`)
- Meal dashboard → Plan display: renders plan (evidence: `frontend/src/app/pages/DashboardPage.tsx`)
- Meal dashboard → AI chat panel: opens chat (evidence: `frontend/src/app/pages/DashboardPage.tsx`)
- Sign in → API client: calls auth API (evidence: `frontend/src/app/pages/AuthPage.tsx`)
- Sign in → Token storage: stores token (evidence: `frontend/src/app/pages/AuthPage.tsx`)
- API client → Token storage: reads token (evidence: `frontend/src/app/lib/api.ts`)
- Auth routes → JWT authentication: dispatches (evidence: `backend/modules/auth/routes.go`)
- API client → Auth routes: HTTP requests (evidence: `README.md`)
- API client → User profile: HTTP requests (evidence: `README.md`)
- API client → Chat API: HTTP requests (evidence: `README.md`)
- Meal plan API → Plan orchestration: delegates (evidence: `backend/modules/meal_plan/controller/meal_plan_controller.go`)
- Plan orchestration → RAG client: requests AI plan (evidence: `README.md`)
- Chat API → Chat intent: delegates (evidence: `backend/modules/chat/controller/chat_controller.go`)
- Chat intent → RAG client: requests AI chat (evidence: `README.md`)
- Plan orchestration → PostgreSQL records: persists plans
- Chat intent → PostgreSQL records: stores history
- RAG client → RAG endpoints: forwards requests (evidence: `README.md`)
- RAG endpoints → PDF retrieval: retrieves context (evidence: `ai/main.py`)
- PDF retrieval → ChromaDB vectors: queries vectors (evidence: `ai/rag_pipeline.py`)
- RAG endpoints → Gemini API: generates responses (evidence: `ai/main.py`)
- PDF retrieval → ChromaDB vectors: adds PDF chunks (evidence: `ai/rag_pipeline.py`)
