# darshan0001-top/urban-food-cart architecture

> Architecture diagram of the GitHub repository darshan0001-top/urban-food-cart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/darshan0001-top/urban-food-cart
- Repository: https://github.com/darshan0001-top/urban-food-cart

## Overview

Urban Foodkart is a three-role food-delivery application. Customers authenticate, browse city-based shops and dishes, maintain a persistent cart, check out, and follow orders; owners manage shops, menus, and order preparation; delivery partners accept ready orders and update delivery progress. The frontend communicates with an Express API, whose controllers coordinate MongoDB-backed models and optional email/Firebase services. The README documents several frontend and backend capabilities whose individual source was not sampled, so subsystem paths use supported enclosing directories and uncertain internal wiring is omitted.

Main entry points: [`backend/index.js`](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/index.js) (Express API), [`frontend/src/App.jsx`](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/App.jsx) (Web application), [`backend/models`](https://github.com/darshan0001-top/urban-food-cart/tree/main/backend/models) (Mongoose domain models), [`backend/controllers/auth.controllers.js`](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/auth.controllers.js) (Authentication and OTP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Customer and role apps"]
  node_webapp["Web application<br/>[App.jsx]"]
  node_authui["Accounts UI<br/>[AuthContext.jsx]"]
  node_catalogui["Shop and dish browsing<br/>[Home.jsx]"]
  node_shopui["Shop and menu management<br/>[CreateEditShop.jsx]"]
  node_cartui["Persistent cart<br/>[CartContext.jsx]"]
  node_checkoutui["Checkout<br/>[Checkout.jsx]"]
  node_ordersui["Customer orders<br/>[MyOrders.jsx]"]
  node_ownerui["Owner order dashboard<br/>[OwnerDashboard.jsx]"]
  node_deliveryui["Delivery dashboard"]
end

subgraph group_api["Backend API"]
  node_api["Express API<br/>[index.js]"]
  node_auth["Authentication and OTP"]
  node_catalog["Shop and item services"]
  node_cart["Cart services"]
  node_orders["Order lifecycle"]
  node_authroutes["Auth routes<br/>[auth.routes.js]"]
  node_itemroutes["Item routes<br/>[item.routes.js]"]
  node_shoproutes["Shop routes<br/>[shop.routes.js]"]
  node_orderroutes["Order routes<br/>[order.routes.js]"]
end

subgraph group_data["Domain persistence"]
  node_dbconn["Database connection<br/>[db.js]"]
  node_models["Mongoose domain models"]
  node_mongodb[("MongoDB")]
end

subgraph group_integrations["External integrations"]
  node_firebase["Firebase identity<br/>[firebase.js]"]
  node_mail["OTP email<br/>[mail.js]"]
  node_emailservice["Email service"]
end

node_customer(("Customer"))
node_owner(("Restaurant owner"))
node_courier(("Delivery partner"))

node_customer -->|"uses"| node_webapp
node_owner -->|"uses"| node_webapp
node_courier -->|"uses"| node_webapp
node_webapp -->|"provides routes"| node_authui
node_webapp -->|"provides routes"| node_catalogui
node_webapp -->|"provides routes"| node_shopui
node_webapp -->|"provides routes"| node_cartui
node_webapp -->|"provides routes"| node_checkoutui
node_webapp -->|"provides routes"| node_ordersui
node_webapp -->|"provides routes"| node_ownerui
node_webapp -->|"provides routes"| node_deliveryui
node_authui -->|"sends requests"| node_api
node_catalogui -->|"requests catalog"| node_api
node_shopui -->|"manages shop"| node_api
node_cartui -->|"updates cart"| node_api
node_checkoutui -->|"places order"| node_api
node_ordersui -->|"reads and cancels"| node_api
node_ownerui -->|"updates statuses"| node_api
node_deliveryui -->|"accepts and updates"| node_api
node_api -->|"mounts"| node_authroutes
node_api -->|"mounts"| node_itemroutes
node_api -->|"mounts"| node_shoproutes
node_api -->|"mounts"| node_orderroutes
node_authroutes -->|"dispatches"| node_auth
node_itemroutes -->|"dispatches"| node_catalog
node_shoproutes -->|"dispatches shop actions"| node_catalog
node_orderroutes -->|"dispatches"| node_orders
node_orders -->|"loads cart"| node_cart
node_auth -->|"reads and writes users"| node_models
node_catalog -->|"reads and writes shops and items"| node_models
node_cart -->|"reads and writes cart and items"| node_models
node_orders -->|"reads and writes orders"| node_models
node_dbconn -->|"connects"| node_mongodb
node_models -->|"persists domain data"| node_mongodb
node_auth -.->|"verifies Google tokens"| node_firebase
node_firebase -.->|"none"| node_mongodb
node_auth -->|"sends reset OTP"| node_mail
node_mail -.->|"delivers email"| node_emailservice

click node_webapp "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/App.jsx"
click node_authui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/context/AuthContext.jsx"
click node_catalogui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/Home.jsx"
click node_shopui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/CreateEditShop.jsx"
click node_cartui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/context/CartContext.jsx"
click node_checkoutui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/Checkout.jsx"
click node_ordersui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/MyOrders.jsx"
click node_ownerui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/OwnerDashboard.jsx"
click node_deliveryui "https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/DeliveryDashboard.jsx"
click node_api "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/index.js"
click node_auth "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/auth.controllers.js"
click node_catalog "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/item.controllers.js"
click node_cart "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/cart.controllers.js"
click node_orders "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/order.controllers.js"
click node_authroutes "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/auth.routes.js"
click node_itemroutes "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/item.routes.js"
click node_shoproutes "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/shop.routes.js"
click node_orderroutes "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/order.routes.js"
click node_dbconn "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/config/db.js"
click node_models "https://github.com/darshan0001-top/urban-food-cart/tree/main/backend/models"
click node_firebase "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/utils/firebase.js"
click node_mail "https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/utils/mail.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_webapp,node_authui,node_catalogui,node_shopui,node_cartui,node_checkoutui,node_ordersui,node_ownerui,node_deliveryui toneBlue
class node_api,node_auth,node_catalog,node_cart,node_orders,node_authroutes,node_itemroutes,node_shoproutes,node_orderroutes toneAmber
class node_dbconn,node_models,node_mongodb toneMint
class node_firebase,node_mail,node_emailservice toneRose
class node_customer,node_owner,node_courier toneIndigo
```

## Components

### Customer and role apps

- [Web application](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Accounts UI](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Shop and dish browsing](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Shop and menu management](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/CreateEditShop.jsx): `frontend/src/pages/CreateEditShop.jsx`
- [Persistent cart](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/context/CartContext.jsx): `frontend/src/context/CartContext.jsx`
- [Checkout](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Customer orders](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/MyOrders.jsx): `frontend/src/pages/MyOrders.jsx`
- [Owner order dashboard](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/OwnerDashboard.jsx): `frontend/src/pages/OwnerDashboard.jsx`
- [Delivery dashboard](https://github.com/darshan0001-top/urban-food-cart/blob/main/frontend/src/pages/DeliveryDashboard.jsx): `frontend/src/pages/DeliveryDashboard.jsx`

### Backend API

- [Express API](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/index.js): `backend/index.js`
- [Authentication and OTP](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/auth.controllers.js): `backend/controllers/auth.controllers.js`
- [Shop and item services](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/item.controllers.js): `backend/controllers/item.controllers.js`
- [Cart services](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/cart.controllers.js): `backend/controllers/cart.controllers.js`
- [Order lifecycle](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/controllers/order.controllers.js): `backend/controllers/order.controllers.js`
- [Auth routes](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/auth.routes.js): `backend/routes/auth.routes.js`
- [Item routes](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/item.routes.js): `backend/routes/item.routes.js`
- [Shop routes](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/shop.routes.js): `backend/routes/shop.routes.js`
- [Order routes](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/routes/order.routes.js): `backend/routes/order.routes.js`

### Domain persistence

- [Database connection](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/config/db.js): `backend/config/db.js`
- [Mongoose domain models](https://github.com/darshan0001-top/urban-food-cart/tree/main/backend/models): `backend/models`
- **MongoDB**

### External integrations

- [Firebase identity](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/utils/firebase.js): `backend/utils/firebase.js`
- [OTP email](https://github.com/darshan0001-top/urban-food-cart/blob/main/backend/utils/mail.js): `backend/utils/mail.js`
- **Email service**

### Other components

- **Customer**
- **Restaurant owner**
- **Delivery partner**

## Connections

- Customer → Web application: uses
- Restaurant owner → Web application: uses
- Delivery partner → Web application: uses
- Web application → Accounts UI: provides routes
- Web application → Shop and dish browsing: provides routes
- Web application → Shop and menu management: provides routes
- Web application → Persistent cart: provides routes
- Web application → Checkout: provides routes
- Web application → Customer orders: provides routes
- Web application → Owner order dashboard: provides routes
- Web application → Delivery dashboard: provides routes
- Accounts UI → Express API: sends requests
- Shop and dish browsing → Express API: requests catalog
- Shop and menu management → Express API: manages shop
- Persistent cart → Express API: updates cart
- Checkout → Express API: places order
- Customer orders → Express API: reads and cancels
- Owner order dashboard → Express API: updates statuses
- Delivery dashboard → Express API: accepts and updates
- Express API → Auth routes: mounts
- Express API → Item routes: mounts
- Express API → Shop routes: mounts
- Express API → Order routes: mounts
- Auth routes → Authentication and OTP: dispatches
- Item routes → Shop and item services: dispatches
- Shop routes → Shop and item services: dispatches shop actions
- Order routes → Order lifecycle: dispatches
- Order lifecycle → Cart services: loads cart
- Authentication and OTP → Mongoose domain models: reads and writes users
- Shop and item services → Mongoose domain models: reads and writes shops and items
- Cart services → Mongoose domain models: reads and writes cart and items
- Order lifecycle → Mongoose domain models: reads and writes orders
- Database connection → MongoDB: connects
- Mongoose domain models → MongoDB: persists domain data
- Authentication and OTP → Firebase identity: verifies Google tokens
- Firebase identity → MongoDB: none
- Authentication and OTP → OTP email: sends reset OTP
- OTP email → Email service: delivers email
