# satyadhoni005/foodflow architecture

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

- Interactive diagram: https://gitdiagram.com/satyadhoni005/foodflow
- Repository: https://github.com/satyadhoni005/foodflow

## Overview

FoodFlow is a multi-role food-delivery application: customers discover restaurants and menus, build a cart, check out, and track orders; restaurant owners manage menus and preparation; riders claim and update deliveries; administrators review restaurant listings. The frontend’s routed screens and hooks call an Express API, whose controllers and services implement domain operations over MongoDB models. The README documents live order updates, maps, sandbox payments, and Google SSO. Some feature modules were not excerpted, so their documented capabilities are included without speculative internal call chains.

Main entry points: [`frontend/src/services/api.js`](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/services/api.js) (HTTP client), [`backend/src/app.js`](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/app.js) (Express API), [`frontend/src/hooks/useOrders.js`](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/hooks/useOrders.js) (Order operations), [`frontend/src/pages/Checkout.jsx`](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Checkout.jsx) (Checkout screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer application"]
  node_app["React application<br/>[App.jsx]"]
  node_screens["Role-based screens"]
  node_routes["Screen routing<br/>[AppRoutes.jsx]"]
  node_api["HTTP client<br/>[api.js]"]
  node_cartstate["Cart state<br/>[cartSlice.js]"]
  node_orderhooks["Order operations<br/>[useOrders.js]"]
end

subgraph group_catalog["Restaurant marketplace"]
  node_restaurantbrowse["Restaurant discovery<br/>[Restaurants.jsx]"]
  node_restaurantdetail["Restaurant and menu"]
  node_owner["Owner dashboard"]
  node_admin["Restaurant moderation<br/>[Admin.jsx]"]
  node_restaurantapi["Restaurant services"]
  node_foodapi["Food menu handlers<br/>[foodController.js]"]
  node_catalogdata[("Restaurant and food data<br/>[Restaurant.js]")]
end

subgraph group_fulfillment["Order fulfillment"]
  node_checkout["Checkout screen<br/>[Checkout.jsx]"]
  node_rider["Rider dashboard<br/>[Delivery.jsx]"]
  node_orderscreen["Order tracking<br/>[Orders.jsx]"]
  node_ordercontroller["Order workflows<br/>[orderController.js]"]
  node_orderservice["Order business logic<br/>[orderService.js]"]
  node_orderdata[("Order records<br/>[Order.js]")]
  node_deliverydata[("Delivery records<br/>[Delivery.js]")]
end

subgraph group_identity["Identity and access"]
  node_identityui["Login and profile<br/>[Login.jsx]"]
  node_authservice["Authentication service<br/>[authService.js]"]
  node_googleauth["Google SSO"]
  node_userdata[("User accounts<br/>[User.js]")]
  node_authguard["JWT authentication<br/>[authMiddleware.js]"]
  node_rolecheck["Role authorization<br/>[roleMiddleware.js]"]
end

subgraph group_platform["Backend platform"]
  node_server["Express API<br/>[app.js]"]
  node_orderrouter["Order endpoints<br/>[orderRoutes.js]"]
  node_payment["Sandbox payments"]
  node_realtime["WebSocket updates<br/>[server.js]"]
  node_maps["Maps and geocoding<br/>[Checkout.jsx]"]
end

node_customer(("FoodFlow users"))

node_customer -->|"uses"| node_app
node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_screens
node_screens -.->|"requests data"| node_api
node_restaurantbrowse -.->|"loads listings"| node_api
node_restaurantdetail -.->|"loads menu"| node_api
node_owner -->|"uses"| node_orderhooks
node_owner -.->|"manages listings"| node_api
node_admin -.->|"reviews listings"| node_api
node_api -.->|"calls API"| node_server
node_server -->|"mounts"| node_orderrouter
node_server -->|"mounts payments"| node_payment
node_server -->|"mounts restaurants"| node_restaurantapi
node_server -->|"mounts foods"| node_foodapi
node_restaurantapi -->|"uses models"| node_catalogdata
node_foodapi -.->|"menu data"| node_catalogdata
node_checkout -->|"reads cart"| node_cartstate
node_checkout -->|"places order"| node_orderhooks
node_orderhooks -->|"sends requests"| node_api
node_orderhooks -->|"syncs cart"| node_cartstate
node_orderrouter -->|"authenticates"| node_authguard
node_orderrouter -->|"checks roles"| node_rolecheck
node_orderrouter -->|"dispatches"| node_ordercontroller
node_ordercontroller -->|"calls"| node_orderservice
node_orderservice -->|"reads and writes"| node_orderdata
node_orderservice -->|"uses delivery data"| node_deliverydata
node_ordercontroller -.->|"broadcasts updates"| node_realtime
node_ordercontroller -.->|"updates tracking"| node_orderscreen
node_rider -.->|"uses"| node_orderhooks
node_identityui -.->|"authenticates"| node_authservice
node_authservice -->|"reads and writes"| node_userdata
node_googleauth -->|"creates sessions"| node_userdata
node_authguard -->|"loads account"| node_userdata
node_checkout -.->|"uses sandbox payment"| node_payment
node_checkout -->|"selects delivery point"| node_maps

click node_app "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/App.jsx"
click node_screens "https://github.com/satyadhoni005/foodflow/tree/main/frontend/src/pages"
click node_routes "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/routes/AppRoutes.jsx"
click node_api "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/services/api.js"
click node_cartstate "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/store/cartSlice.js"
click node_orderhooks "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/hooks/useOrders.js"
click node_restaurantbrowse "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Restaurants.jsx"
click node_restaurantdetail "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/RestaurantDetails.jsx"
click node_owner "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/RestaurantOwner.jsx"
click node_admin "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Admin.jsx"
click node_restaurantapi "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/services/restaurantService.js"
click node_foodapi "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/foodController.js"
click node_catalogdata "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/Restaurant.js"
click node_checkout "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Checkout.jsx"
click node_rider "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Delivery.jsx"
click node_orderscreen "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Orders.jsx"
click node_ordercontroller "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/orderController.js"
click node_orderservice "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/services/orderService.js"
click node_orderdata "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/Order.js"
click node_deliverydata "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/Delivery.js"
click node_identityui "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Login.jsx"
click node_authservice "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/services/authService.js"
click node_googleauth "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/googleAuthController.js"
click node_userdata "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/User.js"
click node_authguard "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/middleware/authMiddleware.js"
click node_rolecheck "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/middleware/roleMiddleware.js"
click node_server "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/app.js"
click node_orderrouter "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/routes/orderRoutes.js"
click node_payment "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/paymentController.js"
click node_realtime "https://github.com/satyadhoni005/foodflow/blob/main/backend/src/server.js"
click node_maps "https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Checkout.jsx"

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_screens,node_routes,node_api,node_cartstate,node_orderhooks,node_customer toneBlue
class node_restaurantbrowse,node_restaurantdetail,node_owner,node_admin,node_restaurantapi,node_foodapi,node_catalogdata toneAmber
class node_checkout,node_rider,node_orderscreen,node_ordercontroller,node_orderservice,node_orderdata,node_deliverydata toneMint
class node_identityui,node_authservice,node_googleauth,node_userdata,node_authguard,node_rolecheck toneRose
class node_server,node_orderrouter,node_payment,node_realtime,node_maps toneIndigo
```

## Components

### Customer application

- [React application](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Role-based screens](https://github.com/satyadhoni005/foodflow/tree/main/frontend/src/pages): `frontend/src/pages`
- [Screen routing](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/routes/AppRoutes.jsx): `frontend/src/routes/AppRoutes.jsx`
- [HTTP client](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`
- [Cart state](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/store/cartSlice.js): `frontend/src/store/cartSlice.js`
- [Order operations](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/hooks/useOrders.js): `frontend/src/hooks/useOrders.js`

### Restaurant marketplace

- [Restaurant discovery](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Restaurants.jsx): `frontend/src/pages/Restaurants.jsx`
- [Restaurant and menu](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/RestaurantDetails.jsx): `frontend/src/pages/RestaurantDetails.jsx`
- [Owner dashboard](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/RestaurantOwner.jsx): `frontend/src/pages/RestaurantOwner.jsx`
- [Restaurant moderation](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Admin.jsx): `frontend/src/pages/Admin.jsx`
- [Restaurant services](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/services/restaurantService.js): `backend/src/services/restaurantService.js`
- [Food menu handlers](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/foodController.js): `backend/src/controllers/foodController.js`
- [Restaurant and food data](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/Restaurant.js): `backend/src/models/Restaurant.js`

### Order fulfillment

- [Checkout screen](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`
- [Rider dashboard](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Delivery.jsx): `frontend/src/pages/Delivery.jsx`
- [Order tracking](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Orders.jsx): `frontend/src/pages/Orders.jsx`
- [Order workflows](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/orderController.js): `backend/src/controllers/orderController.js`
- [Order business logic](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/services/orderService.js): `backend/src/services/orderService.js`
- [Order records](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/Order.js): `backend/src/models/Order.js`
- [Delivery records](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/Delivery.js): `backend/src/models/Delivery.js`

### Identity and access

- [Login and profile](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Authentication service](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/services/authService.js): `backend/src/services/authService.js`
- [Google SSO](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/googleAuthController.js): `backend/src/controllers/googleAuthController.js`
- [User accounts](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/models/User.js): `backend/src/models/User.js`
- [JWT authentication](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`
- [Role authorization](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/middleware/roleMiddleware.js): `backend/src/middleware/roleMiddleware.js`

### Backend platform

- [Express API](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/app.js): `backend/src/app.js`
- [Order endpoints](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/routes/orderRoutes.js): `backend/src/routes/orderRoutes.js`
- [Sandbox payments](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/controllers/paymentController.js): `backend/src/controllers/paymentController.js`
- [WebSocket updates](https://github.com/satyadhoni005/foodflow/blob/main/backend/src/server.js): `backend/src/server.js`
- [Maps and geocoding](https://github.com/satyadhoni005/foodflow/blob/main/frontend/src/pages/Checkout.jsx): `frontend/src/pages/Checkout.jsx`

### Other components

- **FoodFlow users**

## Connections

- FoodFlow users → React application: uses (evidence: `README.md`)
- React application → Screen routing: renders (evidence: `frontend/src/App.jsx`)
- Screen routing → Role-based screens: routes to (evidence: `frontend/src/routes/AppRoutes.jsx`)
- Role-based screens → HTTP client: requests data (evidence: `frontend/src/pages/Checkout.jsx`)
- Restaurant discovery → HTTP client: loads listings
- Restaurant and menu → HTTP client: loads menu
- Owner dashboard → Order operations: uses (evidence: `frontend/src/pages/RestaurantOwner.jsx`)
- Owner dashboard → HTTP client: manages listings
- Restaurant moderation → HTTP client: reviews listings
- HTTP client → Express API: calls API (evidence: `README.md`)
- Express API → Order endpoints: mounts (evidence: `backend/src/app.js`)
- Express API → Sandbox payments: mounts payments (evidence: `backend/src/app.js`)
- Express API → Restaurant services: mounts restaurants (evidence: `backend/src/app.js`)
- Express API → Food menu handlers: mounts foods (evidence: `backend/src/app.js`)
- Restaurant services → Restaurant and food data: uses models (evidence: `backend/src/services/restaurantService.js`)
- Food menu handlers → Restaurant and food data: menu data
- Checkout screen → Cart state: reads cart (evidence: `frontend/src/pages/Checkout.jsx`)
- Checkout screen → Order operations: places order (evidence: `frontend/src/pages/Checkout.jsx`)
- Order operations → HTTP client: sends requests (evidence: `frontend/src/hooks/useOrders.js`)
- Order operations → Cart state: syncs cart (evidence: `frontend/src/hooks/useOrders.js`)
- Order endpoints → JWT authentication: authenticates (evidence: `backend/src/routes/orderRoutes.js`)
- Order endpoints → Role authorization: checks roles (evidence: `backend/src/routes/orderRoutes.js`)
- Order endpoints → Order workflows: dispatches (evidence: `backend/src/routes/orderRoutes.js`)
- Order workflows → Order business logic: calls (evidence: `backend/src/controllers/orderController.js`)
- Order business logic → Order records: reads and writes (evidence: `backend/src/services/orderService.js`)
- Order business logic → Delivery records: uses delivery data (evidence: `backend/src/services/orderService.js`)
- Order workflows → WebSocket updates: broadcasts updates
- Order workflows → Order tracking: updates tracking (evidence: `README.md`)
- Rider dashboard → Order operations: uses
- Login and profile → Authentication service: authenticates
- Authentication service → User accounts: reads and writes (evidence: `backend/src/services/authService.js`)
- Google SSO → User accounts: creates sessions (evidence: `backend/src/controllers/googleAuthController.js`)
- JWT authentication → User accounts: loads account (evidence: `backend/src/middleware/authMiddleware.js`)
- Checkout screen → Sandbox payments: uses sandbox payment (evidence: `README.md`)
- Checkout screen → Maps and geocoding: selects delivery point (evidence: `README.md`)
