# nirmaan-digital/bismilla architecture

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

- Interactive diagram: https://gitdiagram.com/nirmaan-digital/bismilla
- Repository: https://github.com/nirmaan-digital/bismilla

## Overview

Bismilla Chicken Center is a chicken-distribution order, delivery, and payment management application for administrators, retailers, and drivers. Retailers place orders and pay; administrators manage business operations, while drivers handle deliveries and collections. The main payment workflow runs from the retailer interface through the API to gateway checkout, then settles the transaction into order balances and ledgers. The README documents that flow and the product capabilities; some unsampled domain implementations are represented by their exact source directories, and links are included only where the supplied evidence supports them.

Main entry points: [`server/server.js`](https://github.com/nirmaan-digital/bismilla/blob/main/server/server.js) (HTTP API server), [`client/src/routes/AppRoutes.jsx`](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/routes/AppRoutes.jsx) (Role-based routes), [`server/controllers/paymentController.js`](https://github.com/nirmaan-digital/bismilla/blob/main/server/controllers/paymentController.js) (Payment controller), [`client/src/main.jsx`](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/main.jsx) (Client entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client application"]
  node_client_app["Client entry<br/>[main.jsx]"]
  node_routes["Role-based routes<br/>[AppRoutes.jsx]"]
  node_retailer_ui["Retailer ordering"]
  node_payment_ui["Retailer payments"]
  node_payment_result["Payment result<br/>[PaymentResult.jsx]"]
end

subgraph group_operations["Business operations"]
  node_admin_ops["Admin operations"]
  node_driver_ops["Driver operations"]
  node_order_api["Order handling<br/>[orderController.js]"]
  node_domain_api["Business APIs"]
end

subgraph group_payments["Payments"]
  node_payment_routes["Payment endpoints<br/>[payments.js]"]
  node_payment_controller["Payment controller"]
  node_payment_service["Settlement service<br/>[paymentService.js]"]
  node_gateway_select["Gateway selector<br/>[paymentGateway.js]"]
  node_stripe["Stripe"]
  node_razorpay["Razorpay"]
end

subgraph group_platform["API platform"]
  node_server["HTTP API server<br/>[server.js]"]
  node_auth["Authentication<br/>[auth.js]"]
end

subgraph group_persistence["Persistence and gateways"]
  node_mysql[("MySQL database<br/>[db.js]")]
end

node_retailer(("Retailer"))
node_admin(("Administrator"))
node_driver(("Driver"))

node_retailer -->|"uses"| node_client_app
node_admin -->|"uses"| node_client_app
node_driver -->|"uses"| node_client_app
node_client_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_retailer_ui
node_routes -->|"routes to"| node_payment_ui
node_routes -->|"routes to"| node_payment_result
node_routes -->|"routes to"| node_admin_ops
node_routes -->|"routes to"| node_driver_ops
node_retailer_ui -.->|"submits orders"| node_server
node_payment_ui -->|"starts checkout"| node_server
node_server -->|"mounts"| node_payment_routes
node_payment_routes -->|"dispatches"| node_payment_controller
node_payment_controller -->|"settles transaction"| node_payment_service
node_payment_controller -->|"requests checkout"| node_gateway_select
node_gateway_select -->|"selects provider"| node_stripe
node_gateway_select -->|"selects provider"| node_razorpay
node_stripe -->|"redirects and webhooks"| node_server
node_server -->|"handles webhook"| node_payment_controller
node_payment_result -->|"polls status"| node_server
node_payment_service -->|"updates balances and ledger"| node_mysql
node_order_api -->|"reads and writes orders"| node_mysql
node_order_api -->|"expires stale checkouts"| node_payment_service
node_server -->|"protects APIs"| node_auth
node_server -.->|"mounts domain routes"| node_domain_api
node_domain_api -.->|"uses database"| node_mysql

click node_client_app "https://github.com/nirmaan-digital/bismilla/blob/main/client/src/main.jsx"
click node_routes "https://github.com/nirmaan-digital/bismilla/blob/main/client/src/routes/AppRoutes.jsx"
click node_retailer_ui "https://github.com/nirmaan-digital/bismilla/blob/main/client/src/pages/retailer/RetailerPlaceOrder.jsx"
click node_payment_ui "https://github.com/nirmaan-digital/bismilla/blob/main/client/src/pages/retailer/RetailerPayments.jsx"
click node_payment_result "https://github.com/nirmaan-digital/bismilla/blob/main/client/src/pages/retailer/PaymentResult.jsx"
click node_admin_ops "https://github.com/nirmaan-digital/bismilla/tree/main/client/src/pages/admin"
click node_driver_ops "https://github.com/nirmaan-digital/bismilla/tree/main/client/src/pages/driver"
click node_order_api "https://github.com/nirmaan-digital/bismilla/blob/main/server/controllers/orderController.js"
click node_domain_api "https://github.com/nirmaan-digital/bismilla/tree/main/server/controllers"
click node_server "https://github.com/nirmaan-digital/bismilla/blob/main/server/server.js"
click node_auth "https://github.com/nirmaan-digital/bismilla/blob/main/server/middleware/auth.js"
click node_payment_routes "https://github.com/nirmaan-digital/bismilla/blob/main/server/routes/payments.js"
click node_payment_controller "https://github.com/nirmaan-digital/bismilla/blob/main/server/controllers/paymentController.js"
click node_payment_service "https://github.com/nirmaan-digital/bismilla/blob/main/server/services/paymentService.js"
click node_gateway_select "https://github.com/nirmaan-digital/bismilla/blob/main/server/services/paymentGateway.js"
click node_mysql "https://github.com/nirmaan-digital/bismilla/blob/main/server/config/db.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_client_app,node_routes,node_retailer_ui,node_payment_ui,node_payment_result toneBlue
class node_admin_ops,node_driver_ops,node_order_api,node_domain_api toneAmber
class node_payment_routes,node_payment_controller,node_payment_service,node_gateway_select,node_stripe,node_razorpay toneMint
class node_server,node_auth toneRose
class node_mysql,node_retailer,node_admin,node_driver toneIndigo
```

## Components

### Client application

- [Client entry](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/main.jsx): `client/src/main.jsx`
- [Role-based routes](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/routes/AppRoutes.jsx): `client/src/routes/AppRoutes.jsx`
- [Retailer ordering](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/pages/retailer/RetailerPlaceOrder.jsx): `client/src/pages/retailer/RetailerPlaceOrder.jsx`
- [Retailer payments](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/pages/retailer/RetailerPayments.jsx): `client/src/pages/retailer/RetailerPayments.jsx`
- [Payment result](https://github.com/nirmaan-digital/bismilla/blob/main/client/src/pages/retailer/PaymentResult.jsx): `client/src/pages/retailer/PaymentResult.jsx`

### Business operations

- [Admin operations](https://github.com/nirmaan-digital/bismilla/tree/main/client/src/pages/admin): `client/src/pages/admin`
- [Driver operations](https://github.com/nirmaan-digital/bismilla/tree/main/client/src/pages/driver): `client/src/pages/driver`
- [Order handling](https://github.com/nirmaan-digital/bismilla/blob/main/server/controllers/orderController.js): `server/controllers/orderController.js`
- [Business APIs](https://github.com/nirmaan-digital/bismilla/tree/main/server/controllers): `server/controllers`

### Payments

- [Payment endpoints](https://github.com/nirmaan-digital/bismilla/blob/main/server/routes/payments.js): `server/routes/payments.js`
- [Payment controller](https://github.com/nirmaan-digital/bismilla/blob/main/server/controllers/paymentController.js): `server/controllers/paymentController.js`
- [Settlement service](https://github.com/nirmaan-digital/bismilla/blob/main/server/services/paymentService.js): `server/services/paymentService.js`
- [Gateway selector](https://github.com/nirmaan-digital/bismilla/blob/main/server/services/paymentGateway.js): `server/services/paymentGateway.js`
- **Stripe**
- **Razorpay**

### API platform

- [HTTP API server](https://github.com/nirmaan-digital/bismilla/blob/main/server/server.js): `server/server.js`
- [Authentication](https://github.com/nirmaan-digital/bismilla/blob/main/server/middleware/auth.js): `server/middleware/auth.js`

### Persistence and gateways

- [MySQL database](https://github.com/nirmaan-digital/bismilla/blob/main/server/config/db.js): `server/config/db.js`

### Other components

- **Retailer**
- **Administrator**
- **Driver**

## Connections

- Retailer → Client entry: uses (evidence: `README.md`)
- Administrator → Client entry: uses (evidence: `README.md`)
- Driver → Client entry: uses (evidence: `README.md`)
- Client entry → Role-based routes: renders
- Role-based routes → Retailer ordering: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Retailer payments: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Payment result: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Admin operations: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Role-based routes → Driver operations: routes to (evidence: `client/src/routes/AppRoutes.jsx`)
- Retailer ordering → HTTP API server: submits orders
- Retailer payments → HTTP API server: starts checkout (evidence: `README.md`)
- HTTP API server → Payment endpoints: mounts (evidence: `server/server.js`)
- Payment endpoints → Payment controller: dispatches (evidence: `server/controllers/paymentController.js`)
- Payment controller → Settlement service: settles transaction (evidence: `server/controllers/paymentController.js`)
- Payment controller → Gateway selector: requests checkout (evidence: `server/controllers/paymentController.js`)
- Gateway selector → Stripe: selects provider (evidence: `server/services/paymentGateway.js`)
- Gateway selector → Razorpay: selects provider (evidence: `server/services/paymentGateway.js`)
- Stripe → HTTP API server: redirects and webhooks (evidence: `README.md`)
- HTTP API server → Payment controller: handles webhook (evidence: `README.md`)
- Payment result → HTTP API server: polls status (evidence: `README.md`)
- Settlement service → MySQL database: updates balances and ledger (evidence: `server/services/paymentService.js`)
- Order handling → MySQL database: reads and writes orders (evidence: `server/controllers/orderController.js`)
- Order handling → Settlement service: expires stale checkouts (evidence: `server/controllers/orderController.js`)
- HTTP API server → Authentication: protects APIs (evidence: `server/middleware/auth.js`)
- HTTP API server → Business APIs: mounts domain routes
- Business APIs → MySQL database: uses database (evidence: `server/controllers/orderController.js`)
