# medi-meal/apex architecture

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

- Interactive diagram: https://gitdiagram.com/medi-meal/apex
- Repository: https://github.com/medi-meal/apex

## Overview

Medimeal is a health-focused meal recommendation web app. Users enter health and dietary details, request AI-generated meal plans or food-safety checks, and can review saved activity and profile information. The React app routes users through landing, authentication, profile, and recommendation screens; the Express API handles authentication, AI requests, and persistence. README-documented features such as email notifications and meal tracking are included, though their implementation is not visible in the excerpts. Backend relationships are shown only where excerpts or README documentation support them.

Main entry points: [`client/src/App.jsx`](https://github.com/medi-meal/apex/blob/main/client/src/App.jsx) (App routing), [`client/src/pages/GeminiRecommend.jsx`](https://github.com/medi-meal/apex/blob/main/client/src/pages/GeminiRecommend.jsx) (Meal planner), [`server/index.js`](https://github.com/medi-meal/apex/blob/main/server/index.js) (Authentication routes), [`client/src/pages/UserProfile.jsx`](https://github.com/medi-meal/apex/blob/main/client/src/pages/UserProfile.jsx) (Profile dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_entry["React entry<br/>[main.jsx]"]
  node_app["App routing<br/>[App.jsx]"]
  node_navigation["Navigation<br/>[Navbar.jsx]"]
  node_landing["Landing page<br/>[Landing.jsx]"]
  node_login["Login<br/>[Login.jsx]"]
  node_signup["Signup<br/>[Signup.jsx]"]
  node_recommend["Meal planner"]
  node_profile["Profile dashboard<br/>[UserProfile.jsx]"]
  node_feedback["Feedback<br/>[Feedback.jsx]"]
end

subgraph group_api["Backend API"]
  node_api["Express routes<br/>[index.js]"]
  node_auth["Authentication routes<br/>[index.js]"]
  node_mealapi["Meal and safety API<br/>[index.js]"]
  node_profileapi["Profile and stats API<br/>[index.js]"]
  node_historyapi["Input history API<br/>[index.js]"]
end

subgraph group_data["Persistence"]
  node_userrecord[("User record<br/>[User.js]")]
  node_inputrecord[("Input history record<br/>[UserInput.js]")]
end

subgraph group_integrations["External services"]
  node_mongo[("MongoDB")]
  node_gemini["Google Gemini"]
  node_google["Google OAuth"]
  node_email["Email service"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_entry
node_entry -->|"renders"| node_app
node_app -->|"renders"| node_navigation
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_recommend
node_app -->|"routes to"| node_feedback
node_login -->|"submits credentials"| node_auth
node_signup -->|"registers account"| node_auth
node_auth -->|"reads and writes"| node_userrecord
node_auth -->|"verifies identity"| node_google
node_recommend -->|"requests meal plan"| node_mealapi
node_recommend -->|"saves profile"| node_profileapi
node_recommend -->|"saves inputs"| node_historyapi
node_recommend -->|"checks food safety"| node_mealapi
node_mealapi -->|"requests generation"| node_gemini
node_historyapi -->|"reads and writes"| node_inputrecord
node_profile -->|"loads history"| node_historyapi
node_profile -->|"loads statistics"| node_profileapi
node_profileapi -->|"reads activity"| node_inputrecord
node_profileapi -->|"reads user"| node_userrecord
node_userrecord -.->|"persists in"| node_mongo
node_inputrecord -.->|"persists in"| node_mongo
node_api -.->|"sends notifications"| node_email

click node_entry "https://github.com/medi-meal/apex/blob/main/client/src/main.jsx"
click node_app "https://github.com/medi-meal/apex/blob/main/client/src/App.jsx"
click node_navigation "https://github.com/medi-meal/apex/blob/main/client/src/components/Navbar.jsx"
click node_landing "https://github.com/medi-meal/apex/blob/main/client/src/pages/Landing.jsx"
click node_login "https://github.com/medi-meal/apex/blob/main/client/src/pages/Login.jsx"
click node_signup "https://github.com/medi-meal/apex/blob/main/client/src/pages/Signup.jsx"
click node_recommend "https://github.com/medi-meal/apex/blob/main/client/src/pages/GeminiRecommend.jsx"
click node_profile "https://github.com/medi-meal/apex/blob/main/client/src/pages/UserProfile.jsx"
click node_feedback "https://github.com/medi-meal/apex/blob/main/client/src/pages/Feedback.jsx"
click node_api "https://github.com/medi-meal/apex/blob/main/server/index.js"
click node_auth "https://github.com/medi-meal/apex/blob/main/server/index.js"
click node_mealapi "https://github.com/medi-meal/apex/blob/main/server/index.js"
click node_profileapi "https://github.com/medi-meal/apex/blob/main/server/index.js"
click node_historyapi "https://github.com/medi-meal/apex/blob/main/server/index.js"
click node_userrecord "https://github.com/medi-meal/apex/blob/main/server/models/User.js"
click node_inputrecord "https://github.com/medi-meal/apex/blob/main/server/models/UserInput.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_entry,node_app,node_navigation,node_landing,node_login,node_signup,node_recommend,node_profile,node_feedback toneBlue
class node_api,node_auth,node_mealapi,node_profileapi,node_historyapi toneAmber
class node_userrecord,node_inputrecord toneMint
class node_mongo,node_gemini,node_google,node_email toneRose
class node_visitor toneIndigo
```

## Components

### Web application

- [React entry](https://github.com/medi-meal/apex/blob/main/client/src/main.jsx): `client/src/main.jsx`
- [App routing](https://github.com/medi-meal/apex/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Navigation](https://github.com/medi-meal/apex/blob/main/client/src/components/Navbar.jsx): `client/src/components/Navbar.jsx`
- [Landing page](https://github.com/medi-meal/apex/blob/main/client/src/pages/Landing.jsx): `client/src/pages/Landing.jsx`
- [Login](https://github.com/medi-meal/apex/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Signup](https://github.com/medi-meal/apex/blob/main/client/src/pages/Signup.jsx): `client/src/pages/Signup.jsx`
- [Meal planner](https://github.com/medi-meal/apex/blob/main/client/src/pages/GeminiRecommend.jsx): `client/src/pages/GeminiRecommend.jsx`
- [Profile dashboard](https://github.com/medi-meal/apex/blob/main/client/src/pages/UserProfile.jsx): `client/src/pages/UserProfile.jsx`
- [Feedback](https://github.com/medi-meal/apex/blob/main/client/src/pages/Feedback.jsx): `client/src/pages/Feedback.jsx`

### Backend API

- [Express routes](https://github.com/medi-meal/apex/blob/main/server/index.js): `server/index.js`
- [Authentication routes](https://github.com/medi-meal/apex/blob/main/server/index.js): `server/index.js`
- [Meal and safety API](https://github.com/medi-meal/apex/blob/main/server/index.js): `server/index.js`
- [Profile and stats API](https://github.com/medi-meal/apex/blob/main/server/index.js): `server/index.js`
- [Input history API](https://github.com/medi-meal/apex/blob/main/server/index.js): `server/index.js`

### Persistence

- [User record](https://github.com/medi-meal/apex/blob/main/server/models/User.js): `server/models/User.js`
- [Input history record](https://github.com/medi-meal/apex/blob/main/server/models/UserInput.js): `server/models/UserInput.js`

### External services

- **MongoDB**
- **Google Gemini**
- **Google OAuth**
- **Email service**

### Other components

- **Visitor**

## Connections

- Visitor → React entry: opens (evidence: `README.md`)
- React entry → App routing: renders (evidence: `client/src/main.jsx`)
- App routing → Navigation: renders (evidence: `client/src/App.jsx`)
- App routing → Landing page: routes to (evidence: `client/src/App.jsx`)
- App routing → Login: routes to (evidence: `client/src/App.jsx`)
- App routing → Signup: routes to (evidence: `client/src/App.jsx`)
- App routing → Profile dashboard: routes to (evidence: `client/src/App.jsx`)
- App routing → Meal planner: routes to (evidence: `client/src/App.jsx`)
- App routing → Feedback: routes to (evidence: `client/src/App.jsx`)
- Login → Authentication routes: submits credentials (evidence: `README.md`)
- Signup → Authentication routes: registers account (evidence: `README.md`)
- Authentication routes → User record: reads and writes (evidence: `server/index.js`)
- Authentication routes → Google OAuth: verifies identity (evidence: `server/index.js`)
- Meal planner → Meal and safety API: requests meal plan (evidence: `client/src/pages/GeminiRecommend.jsx`)
- Meal planner → Profile and stats API: saves profile (evidence: `client/src/pages/GeminiRecommend.jsx`)
- Meal planner → Input history API: saves inputs (evidence: `client/src/pages/GeminiRecommend.jsx`)
- Meal planner → Meal and safety API: checks food safety (evidence: `client/src/pages/GeminiRecommend.jsx`)
- Meal and safety API → Google Gemini: requests generation (evidence: `server/index.js`)
- Input history API → Input history record: reads and writes (evidence: `server/index.js`)
- Profile dashboard → Input history API: loads history (evidence: `client/src/pages/UserProfile.jsx`)
- Profile dashboard → Profile and stats API: loads statistics (evidence: `client/src/pages/UserProfile.jsx`)
- Profile and stats API → Input history record: reads activity (evidence: `server/index.js`)
- Profile and stats API → User record: reads user (evidence: `server/index.js`)
- User record → MongoDB: persists in
- Input history record → MongoDB: persists in
- Express routes → Email service: sends notifications (evidence: `README.md`)
