# saqibshah-dev/food-delivery-app architecture

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

- Interactive diagram: https://gitdiagram.com/saqibshah-dev/food-delivery-app
- Repository: https://github.com/saqibshah-dev/food-delivery-app

## Overview

Customers browse the catalog, authenticate, place orders, and initiate Stripe checkout; admins manage inventory, track orders, and view order analytics. The graph emphasizes the documented product stages and the backend's route-to-controller-to-service structure. Frontend evidence is limited to the admin dashboard and API helper; broader storefront behavior is documented but its implementation is not sampled.

Main entry points: [`backend/src/routes/index.ts`](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/index.ts) (API routes), [`backend/src/routes/food.routes.ts`](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/food.routes.ts) (Catalog routes), [`backend/src/controllers/payment.controller.ts`](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/payment.controller.ts) (Payment handling), [`backend/src/services/order.service.ts`](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/order.service.ts) (Order logic and analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_storefront["Storefront<br/>[App.tsx]"]
  node_dashboard["Admin dashboard<br/>[Dashboard.tsx]"]
  node_admin_api["Admin API client<br/>[admin.ts]"]
end

subgraph group_api["API and access"]
  node_express["API application<br/>[app.ts]"]
  node_routes["API routes<br/>[index.ts]"]
  node_auth_routes["Authentication routes<br/>[auth.routes.ts]"]
  node_auth_controller["Authentication handling<br/>[auth.controller.ts]"]
  node_auth_service["Authentication logic<br/>[auth.service.ts]"]
  node_auth_guard["JWT and role checks<br/>[auth.middleware.ts]"]
  node_user_model[("User accounts<br/>[User.model.ts]")]
end

subgraph group_catalog["Catalog"]
  node_food_routes["Catalog routes<br/>[food.routes.ts]"]
  node_food_controller["Catalog handling<br/>[food.controller.ts]"]
  node_food_service["Catalog logic<br/>[food.service.ts]"]
  node_food_model[("Food items<br/>[FoodItem.model.ts]")]
  node_image_upload["Image uploads"]
end

subgraph group_orders["Orders and analytics"]
  node_order_routes["Order routes<br/>[order.routes.ts]"]
  node_order_controller["Order handling"]
  node_order_service["Order logic and analytics<br/>[order.service.ts]"]
  node_order_model[("Orders<br/>[Order.model.ts]")]
end

subgraph group_payment["Payments"]
  node_payment_routes["Payment routes<br/>[payment.routes.ts]"]
  node_payment_controller["Payment handling"]
  node_payment_service["Checkout sessions<br/>[payment.service.ts]"]
  node_stripe["Stripe"]
end

node_customer(("Customer"))
node_admin(("Admin"))

node_customer -.->|"uses"| node_storefront
node_admin -.->|"manages"| node_dashboard
node_storefront -.->|"API requests"| node_express
node_dashboard -->|"uses"| node_admin_api
node_admin_api -.->|"API requests"| node_express
node_express -->|"mounts"| node_routes
node_routes -->|"registers"| node_auth_routes
node_routes -->|"registers"| node_food_routes
node_routes -->|"registers"| node_order_routes
node_routes -->|"registers"| node_payment_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"calls"| node_auth_service
node_auth_service -->|"reads/writes"| node_user_model
node_food_routes -->|"dispatches"| node_food_controller
node_food_routes -->|"protects admin routes"| node_auth_guard
node_food_routes -->|"uploads images"| node_image_upload
node_food_controller -->|"calls"| node_food_service
node_food_service -->|"reads/writes"| node_food_model
node_order_routes -->|"dispatches"| node_order_controller
node_order_routes -->|"protects routes"| node_auth_guard
node_order_controller -->|"calls"| node_order_service
node_order_service -->|"reads/writes"| node_order_model
node_order_service -->|"checks availability"| node_food_model
node_payment_routes -->|"dispatches"| node_payment_controller
node_payment_routes -->|"protects checkout"| node_auth_guard
node_payment_controller -->|"creates session"| node_payment_service
node_payment_service -.->|"creates checkout"| node_stripe
node_payment_controller -->|"matches paid order"| node_order_service
node_payment_controller -->|"accesses order"| node_order_model

click node_storefront "https://github.com/saqibshah-dev/food-delivery-app/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/saqibshah-dev/food-delivery-app/blob/main/frontend/src/pages/admin/Dashboard.tsx"
click node_admin_api "https://github.com/saqibshah-dev/food-delivery-app/blob/main/frontend/src/api/admin.ts"
click node_express "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/app.ts"
click node_routes "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/index.ts"
click node_auth_routes "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/auth.routes.ts"
click node_auth_controller "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/auth.controller.ts"
click node_auth_service "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/auth.service.ts"
click node_auth_guard "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/middleware/auth.middleware.ts"
click node_food_routes "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/food.routes.ts"
click node_food_controller "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/food.controller.ts"
click node_food_service "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/food.service.ts"
click node_food_model "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/models/FoodItem.model.ts"
click node_image_upload "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/middleware/upload.middleware.ts"
click node_order_routes "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/order.routes.ts"
click node_order_controller "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/order.controller.ts"
click node_order_service "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/order.service.ts"
click node_order_model "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/models/Order.model.ts"
click node_payment_routes "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/payment.routes.ts"
click node_payment_controller "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/payment.controller.ts"
click node_payment_service "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/payment.service.ts"
click node_user_model "https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/models/User.model.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_storefront,node_dashboard,node_admin_api toneBlue
class node_express,node_routes,node_auth_routes,node_auth_controller,node_auth_service,node_auth_guard,node_user_model toneAmber
class node_food_routes,node_food_controller,node_food_service,node_food_model,node_image_upload toneMint
class node_order_routes,node_order_controller,node_order_service,node_order_model toneRose
class node_payment_routes,node_payment_controller,node_payment_service,node_stripe,node_customer,node_admin toneIndigo
```

## Components

### Frontend

- [Storefront](https://github.com/saqibshah-dev/food-delivery-app/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Admin dashboard](https://github.com/saqibshah-dev/food-delivery-app/blob/main/frontend/src/pages/admin/Dashboard.tsx): `frontend/src/pages/admin/Dashboard.tsx`
- [Admin API client](https://github.com/saqibshah-dev/food-delivery-app/blob/main/frontend/src/api/admin.ts): `frontend/src/api/admin.ts`

### API and access

- [API application](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [API routes](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/index.ts): `backend/src/routes/index.ts`
- [Authentication routes](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/auth.routes.ts): `backend/src/routes/auth.routes.ts`
- [Authentication handling](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/auth.controller.ts): `backend/src/controllers/auth.controller.ts`
- [Authentication logic](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/auth.service.ts): `backend/src/services/auth.service.ts`
- [JWT and role checks](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/middleware/auth.middleware.ts): `backend/src/middleware/auth.middleware.ts`
- [User accounts](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/models/User.model.ts): `backend/src/models/User.model.ts`

### Catalog

- [Catalog routes](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/food.routes.ts): `backend/src/routes/food.routes.ts`
- [Catalog handling](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/food.controller.ts): `backend/src/controllers/food.controller.ts`
- [Catalog logic](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/food.service.ts): `backend/src/services/food.service.ts`
- [Food items](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/models/FoodItem.model.ts): `backend/src/models/FoodItem.model.ts`
- [Image uploads](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/middleware/upload.middleware.ts): `backend/src/middleware/upload.middleware.ts`

### Orders and analytics

- [Order routes](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/order.routes.ts): `backend/src/routes/order.routes.ts`
- [Order handling](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/order.controller.ts): `backend/src/controllers/order.controller.ts`
- [Order logic and analytics](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/order.service.ts): `backend/src/services/order.service.ts`
- [Orders](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/models/Order.model.ts): `backend/src/models/Order.model.ts`

### Payments

- [Payment routes](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/routes/payment.routes.ts): `backend/src/routes/payment.routes.ts`
- [Payment handling](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/controllers/payment.controller.ts): `backend/src/controllers/payment.controller.ts`
- [Checkout sessions](https://github.com/saqibshah-dev/food-delivery-app/blob/main/backend/src/services/payment.service.ts): `backend/src/services/payment.service.ts`
- **Stripe**

### Other components

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

## Connections

- Customer → Storefront: uses (evidence: `Readme.md`)
- Admin → Admin dashboard: manages (evidence: `Readme.md`)
- Storefront → API application: API requests (evidence: `Readme.md`)
- Admin dashboard → Admin API client: uses (evidence: `frontend/src/pages/admin/Dashboard.tsx`)
- Admin API client → API application: API requests (evidence: `Readme.md`)
- API application → API routes: mounts (evidence: `backend/src/app.ts`)
- API routes → Authentication routes: registers (evidence: `backend/src/routes/index.ts`)
- API routes → Catalog routes: registers (evidence: `backend/src/routes/index.ts`)
- API routes → Order routes: registers (evidence: `backend/src/routes/index.ts`)
- API routes → Payment routes: registers (evidence: `backend/src/routes/index.ts`)
- Authentication routes → Authentication handling: dispatches (evidence: `backend/src/routes/auth.routes.ts`)
- Authentication handling → Authentication logic: calls (evidence: `backend/src/controllers/auth.controller.ts`)
- Authentication logic → User accounts: reads/writes (evidence: `backend/src/services/auth.service.ts`)
- Catalog routes → Catalog handling: dispatches (evidence: `backend/src/routes/food.routes.ts`)
- Catalog routes → JWT and role checks: protects admin routes (evidence: `backend/src/routes/food.routes.ts`)
- Catalog routes → Image uploads: uploads images (evidence: `backend/src/routes/food.routes.ts`)
- Catalog handling → Catalog logic: calls (evidence: `backend/src/controllers/food.controller.ts`)
- Catalog logic → Food items: reads/writes (evidence: `backend/src/services/food.service.ts`)
- Order routes → Order handling: dispatches (evidence: `backend/src/routes/order.routes.ts`)
- Order routes → JWT and role checks: protects routes (evidence: `backend/src/routes/order.routes.ts`)
- Order handling → Order logic and analytics: calls (evidence: `backend/src/controllers/order.controller.ts`)
- Order logic and analytics → Orders: reads/writes (evidence: `backend/src/services/order.service.ts`)
- Order logic and analytics → Food items: checks availability (evidence: `backend/src/services/order.service.ts`)
- Payment routes → Payment handling: dispatches (evidence: `backend/src/routes/payment.routes.ts`)
- Payment routes → JWT and role checks: protects checkout (evidence: `backend/src/routes/payment.routes.ts`)
- Payment handling → Checkout sessions: creates session (evidence: `backend/src/controllers/payment.controller.ts`)
- Checkout sessions → Stripe: creates checkout (evidence: `Readme.md`)
- Payment handling → Order logic and analytics: matches paid order (evidence: `backend/src/controllers/payment.controller.ts`)
- Payment handling → Orders: accesses order (evidence: `backend/src/controllers/payment.controller.ts`)
