# krezzy88/capstone-project architecture

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

- Interactive diagram: https://gitdiagram.com/krezzy88/capstone-project
- Repository: https://github.com/krezzy88/capstone-project

## Overview

Wealthy Eater is a nutrition HealthTech platform connecting customers and nutritionists through mobile clients, an admin dashboard, and a Node API. The main workflow is user authentication and profile/dietary setup, meal-plan generation and tracking, then expert consultation and payment; AI optimization, food-image/pantry automation, recipes, shopping, and administration are distinct capabilities. The mobile app’s Dart source is absent from the supplied tree, so mobile behavior is represented only as documented clients. Several subsystem links below rely on README documentation because their implementing source was not sampled.

Main entry points: [`wealthy_eater_backend/src/controllers/mealPlan.controller.js`](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/mealPlan.controller.js) (Meal Planning), [`wealthy_eater_backend/src/app.js`](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/app.js) (Express API), [`wealthy_eater_backend/src/config/database.js`](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/database.js) (MongoDB), [`wealthy-eater-admin/src/pages`](https://github.com/krezzy88/capstone-project/tree/main/wealthy-eater-admin/src/pages) (Admin Management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Clients"]
  node_mobile["Mobile App"]
  node_adminui["Admin Dashboard<br/>[App.jsx]"]
  node_adminpages["Admin Management"]
end

subgraph group_api["Backend API"]
  node_apiapp["Express API<br/>[app.js]"]
  node_auth["Authentication<br/>[auth.service.js]"]
end

subgraph group_nutrition["Nutrition Services"]
  node_mealplan["Meal Planning"]
  node_aiopt["AI Optimizers"]
  node_mealtracking["Meal Tracking"]
  node_recipes["Recipe Catalog"]
  node_pantry["Smart Pantry<br/>[pantry.service.js]"]
  node_shopping["Shopping Lists"]
  node_consult["Consultation Chat<br/>[chat.service.js]"]
  node_chatbot["Nutrition Chatbot"]
end

subgraph group_operations["Platform Operations"]
  node_payment["Payment Flow<br/>[payos.config.js]"]
  node_analytics["Analytics"]
  node_adminfeatures["Admin Operations"]
end

subgraph group_state["Persistence and Integrations"]
  node_mongo[("MongoDB<br/>[database.js]")]
  node_redis[("Redis Cache<br/>[redisClient.js]")]
  node_firebase["Firebase Push<br/>[firebase.js]"]
  node_gemini["Gemini Vision<br/>[gemini.service.js]"]
  node_n8n["n8n Automation<br/>[n8n.service.js]"]
  node_payos["PayOS"]
end

node_customer(("Customer"))
node_nutritionist(("Nutritionist"))

node_customer -->|"uses"| node_mobile
node_nutritionist -->|"uses"| node_mobile
node_mobile -->|"REST and sockets"| node_apiapp
node_adminui -->|"routes to"| node_adminpages
node_adminui -->|"REST requests"| node_apiapp
node_adminpages -->|"administers"| node_adminfeatures
node_apiapp -.->|"serves auth"| node_auth
node_apiapp -.->|"routes requests"| node_mealplan
node_mealplan -->|"requests optimization"| node_aiopt
node_apiapp -->|"routes admin recipes"| node_recipes
node_recipes -->|"reads and writes"| node_mongo
node_mealplan -->|"reads and writes"| node_mongo
node_mealplan -->|"caches previews"| node_redis
node_mealplan -.->|"uses vision service"| node_gemini
node_mealplan -->|"supports logs"| node_mealtracking
node_mealplan -->|"generates lists"| node_shopping
node_mobile -->|"scans pantry"| node_pantry
node_pantry -->|"invokes workflows"| node_n8n
node_n8n -->|"analyzes images"| node_gemini
node_n8n -->|"syncs pantry"| node_mongo
node_mobile -->|"chats live"| node_consult
node_mobile -->|"asks questions"| node_chatbot
node_mobile -->|"starts payment"| node_payment
node_payment -->|"creates payment link"| node_payos
node_payos -->|"sends webhook"| node_apiapp
node_payment -->|"sends confirmation"| node_firebase
node_adminpages -->|"views analytics"| node_analytics
node_adminfeatures -.->|"manages records"| node_mongo
node_apiapp -->|"HTTP optimization"| node_aiopt
node_aiopt -.->|"returns plan"| node_mealplan

click node_adminui "https://github.com/krezzy88/capstone-project/blob/main/wealthy-eater-admin/src/App.jsx"
click node_adminpages "https://github.com/krezzy88/capstone-project/tree/main/wealthy-eater-admin/src/pages"
click node_apiapp "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/app.js"
click node_auth "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/auth.service.js"
click node_mealplan "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/mealPlan.controller.js"
click node_aiopt "https://github.com/krezzy88/capstone-project/tree/main/wealthy-eater-ai/app/services"
click node_mealtracking "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/mealPlan.controller.js"
click node_recipes "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/admin.recipe.controller.js"
click node_pantry "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/pantry.service.js"
click node_shopping "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/shopping_list.service.js"
click node_consult "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/chat.service.js"
click node_chatbot "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/user.chatbot.service.js"
click node_payment "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/payos.config.js"
click node_analytics "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/analytics.service.js"
click node_adminfeatures "https://github.com/krezzy88/capstone-project/tree/main/wealthy_eater_backend/src/controllers"
click node_mongo "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/database.js"
click node_redis "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/utils/redisClient.js"
click node_firebase "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/firebase.js"
click node_gemini "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/gemini.service.js"
click node_n8n "https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/n8n.service.js"

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_mobile,node_adminui,node_adminpages toneBlue
class node_apiapp,node_auth toneAmber
class node_mealplan,node_aiopt,node_mealtracking,node_recipes,node_pantry,node_shopping,node_consult,node_chatbot toneMint
class node_payment,node_analytics,node_adminfeatures toneRose
class node_mongo,node_redis,node_firebase,node_gemini,node_n8n,node_payos,node_customer,node_nutritionist toneIndigo
```

## Components

### Clients

- **Mobile App**
- [Admin Dashboard](https://github.com/krezzy88/capstone-project/blob/main/wealthy-eater-admin/src/App.jsx): `wealthy-eater-admin/src/App.jsx`
- [Admin Management](https://github.com/krezzy88/capstone-project/tree/main/wealthy-eater-admin/src/pages): `wealthy-eater-admin/src/pages`

### Backend API

- [Express API](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/app.js): `wealthy_eater_backend/src/app.js`
- [Authentication](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/auth.service.js): `wealthy_eater_backend/src/services/auth.service.js`

### Nutrition Services

- [Meal Planning](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/mealPlan.controller.js): `wealthy_eater_backend/src/controllers/mealPlan.controller.js`
- [AI Optimizers](https://github.com/krezzy88/capstone-project/tree/main/wealthy-eater-ai/app/services): `wealthy-eater-ai/app/services`
- [Meal Tracking](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/mealPlan.controller.js): `wealthy_eater_backend/src/controllers/mealPlan.controller.js`
- [Recipe Catalog](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/controllers/admin.recipe.controller.js): `wealthy_eater_backend/src/controllers/admin.recipe.controller.js`
- [Smart Pantry](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/pantry.service.js): `wealthy_eater_backend/src/services/pantry.service.js`
- [Shopping Lists](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/shopping_list.service.js): `wealthy_eater_backend/src/services/shopping_list.service.js`
- [Consultation Chat](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/chat.service.js): `wealthy_eater_backend/src/services/chat.service.js`
- [Nutrition Chatbot](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/user.chatbot.service.js): `wealthy_eater_backend/src/services/user.chatbot.service.js`

### Platform Operations

- [Payment Flow](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/payos.config.js): `wealthy_eater_backend/src/config/payos.config.js`
- [Analytics](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/analytics.service.js): `wealthy_eater_backend/src/services/analytics.service.js`
- [Admin Operations](https://github.com/krezzy88/capstone-project/tree/main/wealthy_eater_backend/src/controllers): `wealthy_eater_backend/src/controllers`

### Persistence and Integrations

- [MongoDB](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/database.js): `wealthy_eater_backend/src/config/database.js`
- [Redis Cache](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/utils/redisClient.js): `wealthy_eater_backend/src/utils/redisClient.js`
- [Firebase Push](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/config/firebase.js): `wealthy_eater_backend/src/config/firebase.js`
- [Gemini Vision](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/gemini.service.js): `wealthy_eater_backend/src/services/gemini.service.js`
- [n8n Automation](https://github.com/krezzy88/capstone-project/blob/main/wealthy_eater_backend/src/services/n8n.service.js): `wealthy_eater_backend/src/services/n8n.service.js`
- **PayOS**

### Other components

- **Customer**
- **Nutritionist**

## Connections

- Customer → Mobile App: uses (evidence: `README.md`)
- Nutritionist → Mobile App: uses (evidence: `README.md`)
- Mobile App → Express API: REST and sockets (evidence: `README.md`)
- Admin Dashboard → Admin Management: routes to (evidence: `wealthy-eater-admin/src/App.jsx`)
- Admin Dashboard → Express API: REST requests (evidence: `README.md`)
- Admin Management → Admin Operations: administers (evidence: `README.md`)
- Express API → Authentication: serves auth
- Express API → Meal Planning: routes requests
- Meal Planning → AI Optimizers: requests optimization (evidence: `README.md`)
- Express API → Recipe Catalog: routes admin recipes (evidence: `wealthy_eater_backend/src/app.js`)
- Recipe Catalog → MongoDB: reads and writes (evidence: `wealthy_eater_backend/src/controllers/admin.recipe.controller.js`)
- Meal Planning → MongoDB: reads and writes (evidence: `wealthy_eater_backend/src/controllers/mealPlan.controller.js`)
- Meal Planning → Redis Cache: caches previews (evidence: `wealthy_eater_backend/src/controllers/mealPlan.controller.js`)
- Meal Planning → Gemini Vision: uses vision service (evidence: `wealthy_eater_backend/src/controllers/mealPlan.controller.js`)
- Meal Planning → Meal Tracking: supports logs (evidence: `README.md`)
- Meal Planning → Shopping Lists: generates lists (evidence: `README.md`)
- Mobile App → Smart Pantry: scans pantry (evidence: `README.md`)
- Smart Pantry → n8n Automation: invokes workflows (evidence: `README.md`)
- n8n Automation → Gemini Vision: analyzes images (evidence: `README.md`)
- n8n Automation → MongoDB: syncs pantry (evidence: `README.md`)
- Mobile App → Consultation Chat: chats live (evidence: `README.md`)
- Mobile App → Nutrition Chatbot: asks questions (evidence: `README.md`)
- Mobile App → Payment Flow: starts payment (evidence: `README.md`)
- Payment Flow → PayOS: creates payment link (evidence: `README.md`)
- PayOS → Express API: sends webhook (evidence: `README.md`)
- Payment Flow → Firebase Push: sends confirmation (evidence: `README.md`)
- Admin Management → Analytics: views analytics (evidence: `README.md`)
- Admin Operations → MongoDB: manages records
- Express API → AI Optimizers: HTTP optimization (evidence: `README.md`)
- AI Optimizers → Meal Planning: returns plan
