# vedanttathe/jalsaathi architecture

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

- Interactive diagram: https://gitdiagram.com/vedanttathe/jalsaathi
- Repository: https://github.com/vedanttathe/jalsaathi

## Overview

JalSaathi is an area-based water-can delivery platform connecting customers, providers, delivery personnel, and administrators. Its main workflow spans account access and provider discovery, ordering and payment, provider acceptance and delivery assignment, delivery confirmation, and order visibility for customers and administrators. The graph shows the React client, modular Express backend, and key domain areas. The README documents the end-to-end roles and flow; source excerpts and the index support selected internal calls. Some frontend-to-backend wiring and unsampled module internals are not verified here.

Main entry points: [`frontend/src/App.jsx`](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/App.jsx) (React app), [`backend/src/server.js`](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/server.js) (API server), [`backend/src/modules/order/service.js`](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/order/service.js) (Order management), [`backend/src/modules/admin/service.js`](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/admin/service.js) (Admin oversight)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web_app["React app<br/>[App.jsx]"]
  node_auth_context["Session and auth<br/>[AuthContext.jsx]"]
  node_customer_ui["Customer dashboard"]
  node_provider_ui["Provider dashboard"]
  node_delivery_ui["Delivery dashboard"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_api_client["API client<br/>[api.js]"]
end

subgraph group_backend["Backend platform"]
  node_http_server["API server<br/>[server.js]"]
  node_auth_service["Authentication<br/>[service.js]"]
  node_user_service["User and addresses<br/>[service.js]"]
  node_admin_service["Admin oversight<br/>[service.js]"]
  node_mongo[("MongoDB")]
end

subgraph group_operations["Orders and delivery"]
  node_provider_service["Provider operations<br/>[service.js]"]
  node_order_service["Order management<br/>[service.js]"]
  node_delivery_service["Delivery operations<br/>[service.js]"]
end

subgraph group_finance["Payments and settlement"]
  node_payment_service["Payment processing<br/>[paymentService.js]"]
  node_razorpay["Razorpay"]
  node_settlement_service["Provider settlements"]
end

node_customer(("Customer"))
node_provider_actor(("Provider"))
node_delivery_actor(("Delivery person"))
node_admin_actor(("Administrator"))

node_customer -->|"uses"| node_web_app
node_provider_actor -->|"uses"| node_web_app
node_delivery_actor -->|"uses"| node_web_app
node_admin_actor -->|"uses"| node_web_app
node_web_app -->|"reads session"| node_auth_context
node_web_app -->|"routes by role"| node_customer_ui
node_web_app -->|"routes by role"| node_provider_ui
node_web_app -->|"routes by role"| node_delivery_ui
node_web_app -->|"routes admin"| node_admin_ui
node_auth_context -->|"calls auth API"| node_api_client
node_customer_ui -->|"requests data"| node_api_client
node_api_client -.->|"sends API requests"| node_http_server
node_http_server -->|"mounts auth routes"| node_auth_service
node_http_server -->|"mounts order routes"| node_order_service
node_http_server -->|"mounts provider routes"| node_provider_service
node_http_server -->|"mounts delivery routes"| node_delivery_service
node_http_server -->|"mounts admin routes"| node_admin_service
node_http_server -->|"mounts payment routes"| node_payment_service
node_customer -->|"places order"| node_order_service
node_order_service -->|"initiates payment"| node_razorpay
node_customer -->|"pays"| node_payment_service
node_provider_actor -->|"accepts and assigns"| node_provider_service
node_provider_service -.->|"assigns delivery"| node_delivery_service
node_delivery_actor -->|"confirms delivery"| node_delivery_service
node_customer -->|"manages account"| node_user_service
node_admin_actor -->|"monitors platform"| node_admin_service
node_admin_service -->|"queries orders"| node_order_service
node_admin_actor -->|"manages settlements"| node_settlement_service
node_auth_service -.->|"reads and writes users"| node_mongo
node_user_service -.->|"reads and writes"| node_mongo
node_order_service -->|"reads and writes orders"| node_mongo
node_provider_service -.->|"reads and writes"| node_mongo
node_delivery_service -.->|"reads and writes"| node_mongo
node_admin_service -.->|"reads and writes"| node_mongo
node_payment_service -.->|"processes payments"| node_razorpay
node_settlement_service -.->|"stores settlements"| node_mongo

click node_web_app "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/App.jsx"
click node_auth_context "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/contexts/AuthContext.jsx"
click node_customer_ui "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/CustomerDashboard.jsx"
click node_provider_ui "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/ProviderDashboard.jsx"
click node_delivery_ui "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/DeliveryDashboard.jsx"
click node_admin_ui "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/AdminDashboard.jsx"
click node_api_client "https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/services/api.js"
click node_http_server "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/server.js"
click node_auth_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/auth/service.js"
click node_user_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/user/service.js"
click node_provider_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/provider/service.js"
click node_order_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/order/service.js"
click node_delivery_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/delivery/service.js"
click node_admin_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/admin/service.js"
click node_payment_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/services/paymentService.js"
click node_settlement_service "https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/services/settlementService.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_web_app,node_auth_context,node_customer_ui,node_provider_ui,node_delivery_ui,node_admin_ui,node_api_client toneBlue
class node_http_server,node_auth_service,node_user_service,node_admin_service,node_mongo toneAmber
class node_provider_service,node_order_service,node_delivery_service toneMint
class node_payment_service,node_razorpay,node_settlement_service toneRose
class node_customer,node_provider_actor,node_delivery_actor,node_admin_actor toneIndigo
```

## Components

### Web client

- [React app](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session and auth](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/contexts/AuthContext.jsx): `frontend/src/contexts/AuthContext.jsx`
- [Customer dashboard](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/CustomerDashboard.jsx): `frontend/src/pages/dashboards/CustomerDashboard.jsx`
- [Provider dashboard](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/ProviderDashboard.jsx): `frontend/src/pages/dashboards/ProviderDashboard.jsx`
- [Delivery dashboard](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/DeliveryDashboard.jsx): `frontend/src/pages/dashboards/DeliveryDashboard.jsx`
- [Admin dashboard](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/pages/dashboards/AdminDashboard.jsx): `frontend/src/pages/dashboards/AdminDashboard.jsx`
- [API client](https://github.com/vedanttathe/jalsaathi/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Backend platform

- [API server](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/server.js): `backend/src/server.js`
- [Authentication](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/auth/service.js): `backend/src/modules/auth/service.js`
- [User and addresses](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/user/service.js): `backend/src/modules/user/service.js`
- [Admin oversight](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/admin/service.js): `backend/src/modules/admin/service.js`
- **MongoDB**

### Orders and delivery

- [Provider operations](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/provider/service.js): `backend/src/modules/provider/service.js`
- [Order management](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/order/service.js): `backend/src/modules/order/service.js`
- [Delivery operations](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/modules/delivery/service.js): `backend/src/modules/delivery/service.js`

### Payments and settlement

- [Payment processing](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/services/paymentService.js): `backend/src/services/paymentService.js`
- **Razorpay**
- [Provider settlements](https://github.com/vedanttathe/jalsaathi/blob/main/backend/src/services/settlementService.js): `backend/src/services/settlementService.js`

### Other components

- **Customer**
- **Provider**
- **Delivery person**
- **Administrator**

## Connections

- Customer → React app: uses (evidence: `README.md`)
- Provider → React app: uses (evidence: `README.md`)
- Delivery person → React app: uses (evidence: `README.md`)
- Administrator → React app: uses (evidence: `README.md`)
- React app → Session and auth: reads session (evidence: `frontend/src/App.jsx`)
- React app → Customer dashboard: routes by role (evidence: `frontend/src/App.jsx`)
- React app → Provider dashboard: routes by role (evidence: `frontend/src/App.jsx`)
- React app → Delivery dashboard: routes by role (evidence: `frontend/src/App.jsx`)
- React app → Admin dashboard: routes admin (evidence: `frontend/src/App.jsx`)
- Session and auth → API client: calls auth API (evidence: `frontend/src/contexts/AuthContext.jsx`)
- Customer dashboard → API client: requests data (evidence: `frontend/src/pages/dashboards/CustomerDashboard.jsx`)
- API client → API server: sends API requests
- API server → Authentication: mounts auth routes (evidence: `backend/src/server.js`)
- API server → Order management: mounts order routes (evidence: `backend/src/server.js`)
- API server → Provider operations: mounts provider routes (evidence: `backend/src/server.js`)
- API server → Delivery operations: mounts delivery routes (evidence: `backend/src/server.js`)
- API server → Admin oversight: mounts admin routes (evidence: `backend/src/server.js`)
- API server → Payment processing: mounts payment routes (evidence: `backend/src/server.js`)
- Customer → Order management: places order (evidence: `README.md`)
- Order management → Razorpay: initiates payment (evidence: `backend/src/modules/order/service.js`)
- Customer → Payment processing: pays (evidence: `README.md`)
- Provider → Provider operations: accepts and assigns (evidence: `README.md`)
- Provider operations → Delivery operations: assigns delivery
- Delivery person → Delivery operations: confirms delivery (evidence: `README.md`)
- Customer → User and addresses: manages account (evidence: `README.md`)
- Administrator → Admin oversight: monitors platform (evidence: `README.md`)
- Admin oversight → Order management: queries orders (evidence: `backend/src/modules/admin/controller.js`)
- Administrator → Provider settlements: manages settlements
- Authentication → MongoDB: reads and writes users
- User and addresses → MongoDB: reads and writes
- Order management → MongoDB: reads and writes orders (evidence: `backend/src/modules/order/service.js`)
- Provider operations → MongoDB: reads and writes
- Delivery operations → MongoDB: reads and writes
- Admin oversight → MongoDB: reads and writes
- Payment processing → Razorpay: processes payments
- Provider settlements → MongoDB: stores settlements
