# bmhb19/foodie- architecture

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

- Interactive diagram: https://gitdiagram.com/bmhb19/foodie-
- Repository: https://github.com/bmhb19/foodie-

## Overview

FoodieHub is a full-stack food-ordering app. Customers browse and filter dishes, manage a cart, authenticate, check out, and track orders; admins manage dishes and advance order status. The React client calls a REST API implemented in Express, which uses MongoDB/Mongoose when configured and documents a JSON-store fallback. README capabilities are retained where source was unsampled; those UI and route details are represented by their existing page or server paths, with links omitted where no shown evidence supports them.

Main entry points: [`server.ts`](https://github.com/bmhb19/foodie-/blob/main/server.ts) (Express API), [`backend/config/db.ts`](https://github.com/bmhb19/foodie-/blob/main/backend/config/db.ts) (Database Setup), [`src/App.tsx`](https://github.com/bmhb19/foodie-/blob/main/src/App.tsx) (App Router), [`src/services/api.ts`](https://github.com/bmhb19/foodie-/blob/main/src/services/api.ts) (REST Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer Ordering"]
  node_home["Home Discovery<br/>[HomePage.tsx]"]
  node_menu["Menu Browse<br/>[MenuPage.tsx]"]
  node_dish["Dish Details"]
  node_cartui["Cart Drawer<br/>[CartDrawer.tsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.tsx]"]
  node_orders["Order Tracking<br/>[OrdersPage.tsx]"]
  node_authui["Sign In<br/>[AuthModal.tsx]"]
end

subgraph group_admin["Restaurant Admin"]
  node_adminpage["Kitchen Dashboard<br/>[AdminDashboard.tsx]"]
end

subgraph group_client["Client State and API"]
  node_app["App Router<br/>[App.tsx]"]
  node_cart["Cart and Coupons<br/>[CartContext.tsx]"]
  node_authstate["Authentication State<br/>[AuthContext.tsx]"]
  node_api["REST Client<br/>[api.ts]"]
end

subgraph group_backend["API and Persistence"]
  node_server["Express API<br/>[server.ts]"]
  node_seed["Seed Catalog<br/>[seedData.ts]"]
  node_dbconfig["Database Setup<br/>[db.ts]"]
  node_foodmodel[("Food Records<br/>[Food.ts]")]
  node_usermodel[("User Records<br/>[User.ts]")]
  node_ordermodel[("Order Records<br/>[Order.ts]")]
end

node_customer(("Customer"))
node_adminuser(("Admin"))
node_mongo[("MongoDB")]

node_customer -.->|"browses"| node_home
node_customer -.->|"searches"| node_menu
node_menu -.->|"opens details"| node_dish
node_dish -->|"adds items"| node_cart
node_cartui -->|"reads and updates"| node_cart
node_checkout -->|"reads cart"| node_cart
node_checkout -->|"reads identity"| node_authstate
node_checkout -->|"places order"| node_api
node_orders -->|"loads and updates"| node_api
node_authui -->|"submits credentials"| node_authstate
node_authstate -->|"authenticates"| node_api
node_adminuser -.->|"manages operations"| node_adminpage
node_adminpage -->|"manages dishes and orders"| node_api
node_api -.->|"HTTP requests"| node_server
node_server -->|"connects and seeds"| node_dbconfig
node_dbconfig -->|"loads seed dishes"| node_seed
node_dbconfig -->|"seeds records"| node_foodmodel
node_dbconfig -->|"seeds records"| node_usermodel
node_dbconfig -->|"seeds records"| node_ordermodel
node_server -->|"serves food routes"| node_foodmodel
node_server -->|"serves auth routes"| node_usermodel
node_server -->|"serves order routes"| node_ordermodel
node_dbconfig -->|"connects"| node_mongo
node_server -.->|"uses configured store"| node_mongo
node_app -.->|"routes to"| node_home
node_app -.->|"routes to"| node_menu
node_app -.->|"routes to"| node_checkout
node_app -.->|"routes to"| node_orders
node_app -.->|"routes to"| node_adminpage

click node_app "https://github.com/bmhb19/foodie-/blob/main/src/App.tsx"
click node_home "https://github.com/bmhb19/foodie-/blob/main/src/pages/HomePage.tsx"
click node_menu "https://github.com/bmhb19/foodie-/blob/main/src/pages/MenuPage.tsx"
click node_dish "https://github.com/bmhb19/foodie-/blob/main/src/components/FoodDetailModal.tsx"
click node_cart "https://github.com/bmhb19/foodie-/blob/main/src/context/CartContext.tsx"
click node_cartui "https://github.com/bmhb19/foodie-/blob/main/src/components/CartDrawer.tsx"
click node_checkout "https://github.com/bmhb19/foodie-/blob/main/src/pages/CheckoutPage.tsx"
click node_orders "https://github.com/bmhb19/foodie-/blob/main/src/pages/OrdersPage.tsx"
click node_authui "https://github.com/bmhb19/foodie-/blob/main/src/components/AuthModal.tsx"
click node_authstate "https://github.com/bmhb19/foodie-/blob/main/src/context/AuthContext.tsx"
click node_adminpage "https://github.com/bmhb19/foodie-/blob/main/src/pages/AdminDashboard.tsx"
click node_api "https://github.com/bmhb19/foodie-/blob/main/src/services/api.ts"
click node_server "https://github.com/bmhb19/foodie-/blob/main/server.ts"
click node_seed "https://github.com/bmhb19/foodie-/blob/main/backend/data/seedData.ts"
click node_dbconfig "https://github.com/bmhb19/foodie-/blob/main/backend/config/db.ts"
click node_foodmodel "https://github.com/bmhb19/foodie-/blob/main/backend/models/Food.ts"
click node_usermodel "https://github.com/bmhb19/foodie-/blob/main/backend/models/User.ts"
click node_ordermodel "https://github.com/bmhb19/foodie-/blob/main/backend/models/Order.ts"

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_home,node_menu,node_dish,node_cartui,node_checkout,node_orders,node_authui toneBlue
class node_adminpage,node_mongo toneAmber
class node_app,node_cart,node_authstate,node_api toneMint
class node_server,node_seed,node_dbconfig,node_foodmodel,node_usermodel,node_ordermodel toneRose
class node_customer,node_adminuser toneIndigo
```

## Components

### Customer Ordering

- [Home Discovery](https://github.com/bmhb19/foodie-/blob/main/src/pages/HomePage.tsx): `src/pages/HomePage.tsx`
- [Menu Browse](https://github.com/bmhb19/foodie-/blob/main/src/pages/MenuPage.tsx): `src/pages/MenuPage.tsx`
- [Dish Details](https://github.com/bmhb19/foodie-/blob/main/src/components/FoodDetailModal.tsx): `src/components/FoodDetailModal.tsx`
- [Cart Drawer](https://github.com/bmhb19/foodie-/blob/main/src/components/CartDrawer.tsx): `src/components/CartDrawer.tsx`
- [Checkout](https://github.com/bmhb19/foodie-/blob/main/src/pages/CheckoutPage.tsx): `src/pages/CheckoutPage.tsx`
- [Order Tracking](https://github.com/bmhb19/foodie-/blob/main/src/pages/OrdersPage.tsx): `src/pages/OrdersPage.tsx`
- [Sign In](https://github.com/bmhb19/foodie-/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`

### Restaurant Admin

- [Kitchen Dashboard](https://github.com/bmhb19/foodie-/blob/main/src/pages/AdminDashboard.tsx): `src/pages/AdminDashboard.tsx`

### Client State and API

- [App Router](https://github.com/bmhb19/foodie-/blob/main/src/App.tsx): `src/App.tsx`
- [Cart and Coupons](https://github.com/bmhb19/foodie-/blob/main/src/context/CartContext.tsx): `src/context/CartContext.tsx`
- [Authentication State](https://github.com/bmhb19/foodie-/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [REST Client](https://github.com/bmhb19/foodie-/blob/main/src/services/api.ts): `src/services/api.ts`

### API and Persistence

- [Express API](https://github.com/bmhb19/foodie-/blob/main/server.ts): `server.ts`
- [Seed Catalog](https://github.com/bmhb19/foodie-/blob/main/backend/data/seedData.ts): `backend/data/seedData.ts`
- [Database Setup](https://github.com/bmhb19/foodie-/blob/main/backend/config/db.ts): `backend/config/db.ts`
- [Food Records](https://github.com/bmhb19/foodie-/blob/main/backend/models/Food.ts): `backend/models/Food.ts`
- [User Records](https://github.com/bmhb19/foodie-/blob/main/backend/models/User.ts): `backend/models/User.ts`
- [Order Records](https://github.com/bmhb19/foodie-/blob/main/backend/models/Order.ts): `backend/models/Order.ts`

### Other components

- **Customer**
- **Admin**
- **MongoDB**

## Connections

- Customer → Home Discovery: browses (evidence: `README.md`)
- Customer → Menu Browse: searches (evidence: `README.md`)
- Menu Browse → Dish Details: opens details (evidence: `README.md`)
- Dish Details → Cart and Coupons: adds items (evidence: `src/components/FoodDetailModal.tsx`)
- Cart Drawer → Cart and Coupons: reads and updates (evidence: `src/components/CartDrawer.tsx`)
- Checkout → Cart and Coupons: reads cart (evidence: `src/pages/CheckoutPage.tsx`)
- Checkout → Authentication State: reads identity (evidence: `src/pages/CheckoutPage.tsx`)
- Checkout → REST Client: places order (evidence: `src/pages/CheckoutPage.tsx`)
- Order Tracking → REST Client: loads and updates (evidence: `src/pages/OrdersPage.tsx`)
- Sign In → Authentication State: submits credentials (evidence: `src/components/AuthModal.tsx`)
- Authentication State → REST Client: authenticates (evidence: `src/context/AuthContext.tsx`)
- Admin → Kitchen Dashboard: manages operations (evidence: `README.md`)
- Kitchen Dashboard → REST Client: manages dishes and orders (evidence: `src/pages/AdminDashboard.tsx`)
- REST Client → Express API: HTTP requests (evidence: `README.md`)
- Express API → Database Setup: connects and seeds (evidence: `server.ts`)
- Database Setup → Seed Catalog: loads seed dishes (evidence: `backend/config/db.ts`)
- Database Setup → Food Records: seeds records (evidence: `backend/config/db.ts`)
- Database Setup → User Records: seeds records (evidence: `backend/config/db.ts`)
- Database Setup → Order Records: seeds records (evidence: `backend/config/db.ts`)
- Express API → Food Records: serves food routes (evidence: `server.ts`)
- Express API → User Records: serves auth routes (evidence: `server.ts`)
- Express API → Order Records: serves order routes (evidence: `server.ts`)
- Database Setup → MongoDB: connects (evidence: `backend/config/db.ts`)
- Express API → MongoDB: uses configured store
- App Router → Home Discovery: routes to
- App Router → Menu Browse: routes to
- App Router → Checkout: routes to
- App Router → Order Tracking: routes to
- App Router → Kitchen Dashboard: routes to
