# greeshmita-23/foodiehub-v2 architecture

> Architecture diagram of the GitHub repository greeshmita-23/foodiehub-v2, 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/greeshmita-23/foodiehub-v2
- Repository: https://github.com/greeshmita-23/foodiehub-v2

## Overview

FoodieHub is a full-stack food-ordering and restaurant-management application. Customers browse and search restaurants, manage favorites and a cart, check out with delivery details and coupons, then view orders; admins manage restaurants and order status. The React app routes users to these experiences and calls an Express API backed by MongoDB. The graph preserves the documented authentication, reviews, coupons and dashboard capabilities. Some feature pages and backend modules were not excerpted, so their internal call relationships are omitted where the evidence does not establish them.

Main entry points: [`frontend/src/App.jsx`](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/App.jsx) (App routes), [`backend/server.js`](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/server.js) (API server), [`frontend/src/api/api.js`](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/api/api.js) (API client), [`frontend/src/pages/Checkout.jsx`](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Checkout.jsx) (Cart and checkout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React application"]
  node_app["App routes<br/>[App.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_experience["Customer experience"]
  node_home["Restaurant discovery<br/>[Home.jsx]"]
  node_restaurant_pages["Restaurant pages"]
  node_restaurant_admin["Restaurant management<br/>[Admin.jsx]"]
  node_cart_state["Cart state<br/>[CartContext.jsx]"]
  node_cart_checkout["Cart and checkout<br/>[Checkout.jsx]"]
  node_favorites["Favorites"]
  node_orders_ui["Order history<br/>[MyOrders.jsx]"]
  node_auth_ui["Sign in and signup<br/>[Login.jsx]"]
end

subgraph group_api["Express API"]
  node_backend_server["API server<br/>[server.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_restaurant_routes["Restaurant routes"]
  node_order_routes["Order routes<br/>[orderRoutes.js]"]
  node_coupon_routes["Coupon routes<br/>[couponRoutes.js]"]
  node_review_routes["Review routes<br/>[reviewRoutes.js]"]
end

subgraph group_domain["Domain services and data"]
  node_restaurant_controller["Restaurant service"]
  node_restaurant_data[("Restaurant records<br/>[Restaurant.js]")]
  node_order_controller["Order service<br/>[orderController.js]"]
  node_order_data[("Order records<br/>[Order.js]")]
  node_coupon_controller["Coupon validation"]
  node_coupon_data[("Coupon records<br/>[Coupon.js]")]
  node_review_controller["Reviews"]
  node_review_data[("Review records<br/>[Review.js]")]
  node_dashboard["Admin dashboard"]
end

subgraph group_identity["Identity and access"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_auth_middleware["JWT authorization<br/>[authMiddleware.js]"]
  node_user_data[("User records<br/>[User.js]")]
end

node_customer(("Customer"))
node_admin(("Administrator"))

node_customer -->|"uses"| node_app
node_admin -->|"uses"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_restaurant_pages
node_app -->|"routes to"| node_restaurant_admin
node_app -->|"routes to"| node_cart_checkout
node_app -->|"routes to"| node_orders_ui
node_home -->|"requests data"| node_api_client
node_cart_checkout -->|"reads and updates"| node_cart_state
node_cart_checkout -->|"submits order"| node_api_client
node_restaurant_admin -->|"manages restaurants"| node_api_client
node_favorites -.->|"supports browsing"| node_restaurant_pages
node_orders_ui -.->|"requests orders"| node_api_client
node_auth_ui -.->|"authenticates"| node_api_client
node_api_client -->|"sends API requests"| node_backend_server
node_backend_server -->|"mounts"| node_auth_routes
node_backend_server -->|"mounts"| node_restaurant_routes
node_backend_server -->|"mounts"| node_order_routes
node_backend_server -->|"mounts"| node_review_routes
node_backend_server -->|"mounts"| node_coupon_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads and writes"| node_user_data
node_order_routes -->|"checks token"| node_auth_middleware
node_review_routes -->|"checks token"| node_auth_middleware
node_restaurant_routes -->|"dispatches"| node_restaurant_controller
node_restaurant_controller -->|"reads and updates"| node_restaurant_data
node_order_routes -->|"dispatches"| node_order_controller
node_order_controller -->|"manages orders"| node_order_data
node_coupon_routes -->|"dispatches"| node_coupon_controller
node_coupon_controller -->|"validates against"| node_coupon_data
node_review_routes -->|"dispatches"| node_review_controller
node_review_controller -->|"reads and writes"| node_review_data

click node_app "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/App.jsx"
click node_home "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Home.jsx"
click node_restaurant_pages "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/RestaurantDetails.jsx"
click node_restaurant_admin "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Admin.jsx"
click node_cart_state "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/context/CartContext.jsx"
click node_cart_checkout "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Checkout.jsx"
click node_favorites "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/context/FavoritesContext.jsx"
click node_orders_ui "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/MyOrders.jsx"
click node_auth_ui "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Login.jsx"
click node_api_client "https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/api/api.js"
click node_backend_server "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/server.js"
click node_auth_routes "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/authRoutes.js"
click node_auth_controller "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/authController.js"
click node_auth_middleware "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/middleware/authMiddleware.js"
click node_restaurant_routes "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/restaurantRoutes.js"
click node_restaurant_controller "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/restaurantController.js"
click node_restaurant_data "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Restaurant.js"
click node_order_routes "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/orderRoutes.js"
click node_order_controller "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/orderController.js"
click node_order_data "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Order.js"
click node_coupon_routes "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/couponRoutes.js"
click node_coupon_controller "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/couponController.js"
click node_coupon_data "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Coupon.js"
click node_review_routes "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/reviewRoutes.js"
click node_review_controller "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/reviewController.js"
click node_review_data "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Review.js"
click node_dashboard "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/dashboardController.js"
click node_user_data "https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/User.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_app,node_api_client toneBlue
class node_home,node_restaurant_pages,node_restaurant_admin,node_cart_state,node_cart_checkout,node_favorites,node_orders_ui,node_auth_ui toneAmber
class node_backend_server,node_auth_routes,node_restaurant_routes,node_order_routes,node_coupon_routes,node_review_routes toneMint
class node_restaurant_controller,node_restaurant_data,node_order_controller,node_order_data,node_coupon_controller,node_coupon_data,node_review_controller,node_review_data,node_dashboard toneRose
class node_auth_controller,node_auth_middleware,node_user_data,node_customer,node_admin toneIndigo
```

## Components

### React application

- [App routes](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [API client](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/api/api.js): `frontend/src/api/api.js`

### Customer experience

- [Restaurant discovery](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Restaurant pages](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/RestaurantDetails.jsx): `frontend/src/pages/RestaurantDetails.jsx`
- [Restaurant management](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`
- [Cart state](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`
- [Cart and checkout](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Favorites](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/context/FavoritesContext.jsx): `frontend/src/context/FavoritesContext.jsx`
- [Order history](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/MyOrders.jsx): `frontend/src/pages/MyOrders.jsx`
- [Sign in and signup](https://github.com/greeshmita-23/foodiehub-v2/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`

### Express API

- [API server](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/server.js): `backend/server.js`
- [Authentication routes](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Restaurant routes](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/restaurantRoutes.js): `backend/routes/restaurantRoutes.js`
- [Order routes](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [Coupon routes](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/couponRoutes.js): `backend/routes/couponRoutes.js`
- [Review routes](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/routes/reviewRoutes.js): `backend/routes/reviewRoutes.js`

### Domain services and data

- [Restaurant service](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/restaurantController.js): `backend/controllers/restaurantController.js`
- [Restaurant records](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Restaurant.js): `backend/models/Restaurant.js`
- [Order service](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/orderController.js): `backend/controllers/orderController.js`
- [Order records](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Order.js): `backend/models/Order.js`
- [Coupon validation](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/couponController.js): `backend/controllers/couponController.js`
- [Coupon records](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Coupon.js): `backend/models/Coupon.js`
- [Reviews](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/reviewController.js): `backend/controllers/reviewController.js`
- [Review records](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/Review.js): `backend/models/Review.js`
- [Admin dashboard](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/dashboardController.js): `backend/controllers/dashboardController.js`

### Identity and access

- [Authentication](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT authorization](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [User records](https://github.com/greeshmita-23/foodiehub-v2/blob/main/backend/models/User.js): `backend/models/User.js`

### Other components

- **Customer**
- **Administrator**

## Connections

- Customer → App routes: uses (evidence: `README.md`)
- Administrator → App routes: uses (evidence: `README.md`)
- App routes → Restaurant discovery: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Restaurant pages: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Restaurant management: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Cart and checkout: routes to (evidence: `frontend/src/App.jsx`)
- App routes → Order history: routes to (evidence: `frontend/src/App.jsx`)
- Restaurant discovery → API client: requests data (evidence: `frontend/src/pages/Home.jsx`)
- Cart and checkout → Cart state: reads and updates (evidence: `frontend/src/pages/Checkout.jsx`)
- Cart and checkout → API client: submits order (evidence: `frontend/src/pages/Checkout.jsx`)
- Restaurant management → API client: manages restaurants (evidence: `frontend/src/pages/Admin.jsx`)
- Favorites → Restaurant pages: supports browsing
- Order history → API client: requests orders
- Sign in and signup → API client: authenticates
- API client → API server: sends API requests (evidence: `README.md`)
- API server → Authentication routes: mounts (evidence: `backend/server.js`)
- API server → Restaurant routes: mounts (evidence: `backend/server.js`)
- API server → Order routes: mounts (evidence: `backend/server.js`)
- API server → Review routes: mounts (evidence: `backend/server.js`)
- API server → Coupon routes: mounts (evidence: `backend/server.js`)
- Authentication routes → Authentication: dispatches (evidence: `backend/routes/authRoutes.js`)
- Authentication → User records: reads and writes (evidence: `backend/controllers/authController.js`)
- Order routes → JWT authorization: checks token (evidence: `backend/routes/orderRoutes.js`)
- Review routes → JWT authorization: checks token (evidence: `backend/routes/reviewRoutes.js`)
- Restaurant routes → Restaurant service: dispatches (evidence: `backend/routes/restaurantRoutes.js`)
- Restaurant service → Restaurant records: reads and updates (evidence: `backend/controllers/restaurantController.js`)
- Order routes → Order service: dispatches (evidence: `backend/routes/orderRoutes.js`)
- Order service → Order records: manages orders (evidence: `backend/controllers/orderController.js`)
- Coupon routes → Coupon validation: dispatches (evidence: `backend/routes/couponRoutes.js`)
- Coupon validation → Coupon records: validates against (evidence: `backend/controllers/couponController.js`)
- Review routes → Reviews: dispatches (evidence: `backend/routes/reviewRoutes.js`)
- Reviews → Review records: reads and writes (evidence: `backend/controllers/reviewController.js`)
