# vedsatpute07/smart-farmer-procurement architecture

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

- Interactive diagram: https://gitdiagram.com/vedsatpute07/smart-farmer-procurement
- Repository: https://github.com/vedsatpute07/smart-farmer-procurement

## Overview

Smart Farmer Procurement Platform supports farmer registration and OTP login, centre discovery and slot booking, then tokenized queue tracking through procurement and payment-status monitoring; staff and admins manage centre operations and records. The React app presents role-based workflows over an Express API backed by MongoDB. Booking and queue services coordinate transactional state and notifications. The graph reflects documented capabilities, but some controllers and frontend pages were not sampled, so uncertain internal calls are omitted.

Main entry points: [`backend/src/models/index.js`](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/models/index.js) (Domain models), [`backend/src/routes/index.js`](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/routes/index.js) (API routing), [`frontend/src/App.jsx`](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/App.jsx) (Role-based web app), [`backend/src/services/notificationService.js`](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/notificationService.js) (Notification delivery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_webapp["Role-based web app<br/>[App.jsx]"]
  node_authcontext["Session context<br/>[AuthContext.jsx]"]
  node_farmerpages["Farmer workflows"]
  node_staffpages["Staff operations UI<br/>[StaffDashboard.jsx]"]
  node_adminpages["Admin management UI<br/>[AdminDashboard.jsx]"]
  node_maps["Centre maps<br/>[CentreMap.jsx]"]
  node_frontendapi["API client<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_express["HTTP application<br/>[app.js]"]
  node_routes["API routing<br/>[index.js]"]
  node_authcontroller["Auth controller<br/>[authController.js]"]
  node_otp["OTP verification<br/>[otpService.js]"]
end

subgraph group_operations["Procurement operations"]
  node_bookingcontroller["Booking endpoints"]
  node_bookingservice["Booking and tokens<br/>[bookingService.js]"]
  node_centres["Centre discovery"]
  node_slots["Slot management<br/>[slotController.js]"]
  node_queuecontroller["Queue endpoints<br/>[queueController.js]"]
  node_queueservice["Queue and status<br/>[queueService.js]"]
  node_records["Procurement and payments"]
  node_notifications["Notification delivery"]
end

subgraph group_data["State and integrations"]
  node_models["Domain models<br/>[index.js]"]
  node_mongodb[("MongoDB")]
  node_sms["Twilio SMS"]
  node_googlemaps["Google Maps"]
  node_razorpay["Razorpay test checkout"]
end

node_farmer(("Farmer"))
node_staff(("Staff"))
node_admin(("Administrator"))

node_farmer -->|"uses"| node_webapp
node_staff -->|"uses"| node_webapp
node_admin -->|"uses"| node_webapp
node_webapp -->|"reads session"| node_authcontext
node_webapp -->|"routes to"| node_farmerpages
node_webapp -->|"routes to"| node_staffpages
node_webapp -->|"routes to"| node_adminpages
node_farmerpages -->|"requests data"| node_frontendapi
node_staffpages -->|"requests data"| node_frontendapi
node_adminpages -->|"requests data"| node_frontendapi
node_farmerpages -->|"shows locations"| node_maps
node_maps -.->|"renders maps"| node_googlemaps
node_frontendapi -->|"sends API requests"| node_express
node_express -->|"dispatches"| node_routes
node_routes -->|"dispatches"| node_authcontroller
node_routes -->|"dispatches"| node_bookingcontroller
node_routes -->|"dispatches"| node_centres
node_routes -->|"dispatches"| node_slots
node_routes -->|"dispatches"| node_queuecontroller
node_routes -->|"dispatches"| node_records
node_authcontroller -->|"issues and consumes"| node_otp
node_bookingcontroller -->|"delegates bookings"| node_bookingservice
node_queuecontroller -->|"delegates queue work"| node_queueservice
node_records -->|"changes queue state"| node_queueservice
node_bookingservice -->|"creates and delivers"| node_notifications
node_queueservice -->|"creates notifications"| node_notifications
node_otp -->|"creates and delivers"| node_notifications
node_otp -.->|"sends OTP"| node_sms
node_notifications -.->|"delivers SMS"| node_sms
node_records -.->|"sandbox checkout"| node_razorpay
node_authcontroller -->|"reads and writes"| node_models
node_otp -->|"reads and writes"| node_models
node_bookingservice -->|"reads and writes"| node_models
node_queueservice -->|"reads and writes"| node_models
node_centres -->|"reads and writes"| node_models
node_slots -->|"reads and writes"| node_models
node_records -->|"reads and writes"| node_models
node_notifications -->|"stores delivery state"| node_models
node_models -->|"persists records"| node_mongodb

click node_webapp "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/App.jsx"
click node_authcontext "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/context/AuthContext.jsx"
click node_farmerpages "https://github.com/vedsatpute07/smart-farmer-procurement/tree/main/frontend/src/pages"
click node_staffpages "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/pages/StaffDashboard.jsx"
click node_adminpages "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/pages/AdminDashboard.jsx"
click node_maps "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/components/CentreMap.jsx"
click node_frontendapi "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/services/api.js"
click node_express "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/app.js"
click node_routes "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/routes/index.js"
click node_authcontroller "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/authController.js"
click node_otp "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/otpService.js"
click node_bookingcontroller "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/bookingController.js"
click node_bookingservice "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/bookingService.js"
click node_centres "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/centreController.js"
click node_slots "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/slotController.js"
click node_queuecontroller "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/queueController.js"
click node_queueservice "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/queueService.js"
click node_records "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/recordController.js"
click node_notifications "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/notificationService.js"
click node_models "https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/models/index.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_authcontext,node_farmerpages,node_staffpages,node_adminpages,node_maps,node_frontendapi toneBlue
class node_express,node_routes,node_authcontroller,node_otp toneAmber
class node_bookingcontroller,node_bookingservice,node_centres,node_slots,node_queuecontroller,node_queueservice,node_records,node_notifications toneMint
class node_models,node_mongodb,node_sms,node_googlemaps,node_razorpay toneRose
class node_farmer,node_staff,node_admin toneIndigo
```

## Components

### Web application

- [Role-based web app](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Session context](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Farmer workflows](https://github.com/vedsatpute07/smart-farmer-procurement/tree/main/frontend/src/pages): `frontend/src/pages`
- [Staff operations UI](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/pages/StaffDashboard.jsx): `frontend/src/pages/StaffDashboard.jsx`
- [Admin management UI](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/pages/AdminDashboard.jsx): `frontend/src/pages/AdminDashboard.jsx`
- [Centre maps](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/components/CentreMap.jsx): `frontend/src/components/CentreMap.jsx`
- [API client](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and identity

- [HTTP application](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/app.js): `backend/src/app.js`
- [API routing](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/routes/index.js): `backend/src/routes/index.js`
- [Auth controller](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [OTP verification](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/otpService.js): `backend/src/services/otpService.js`

### Procurement operations

- [Booking endpoints](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/bookingController.js): `backend/src/controllers/bookingController.js`
- [Booking and tokens](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/bookingService.js): `backend/src/services/bookingService.js`
- [Centre discovery](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/centreController.js): `backend/src/controllers/centreController.js`
- [Slot management](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/slotController.js): `backend/src/controllers/slotController.js`
- [Queue endpoints](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/queueController.js): `backend/src/controllers/queueController.js`
- [Queue and status](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/queueService.js): `backend/src/services/queueService.js`
- [Procurement and payments](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/controllers/recordController.js): `backend/src/controllers/recordController.js`
- [Notification delivery](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/services/notificationService.js): `backend/src/services/notificationService.js`

### State and integrations

- [Domain models](https://github.com/vedsatpute07/smart-farmer-procurement/blob/main/backend/src/models/index.js): `backend/src/models/index.js`
- **MongoDB**
- **Twilio SMS**
- **Google Maps**
- **Razorpay test checkout**

### Other components

- **Farmer**
- **Staff**
- **Administrator**

## Connections

- Farmer → Role-based web app: uses
- Staff → Role-based web app: uses
- Administrator → Role-based web app: uses
- Role-based web app → Session context: reads session
- Role-based web app → Farmer workflows: routes to
- Role-based web app → Staff operations UI: routes to
- Role-based web app → Admin management UI: routes to
- Farmer workflows → API client: requests data
- Staff operations UI → API client: requests data
- Admin management UI → API client: requests data
- Farmer workflows → Centre maps: shows locations
- Centre maps → Google Maps: renders maps
- API client → HTTP application: sends API requests
- HTTP application → API routing: dispatches
- API routing → Auth controller: dispatches
- API routing → Booking endpoints: dispatches
- API routing → Centre discovery: dispatches
- API routing → Slot management: dispatches
- API routing → Queue endpoints: dispatches
- API routing → Procurement and payments: dispatches
- Auth controller → OTP verification: issues and consumes
- Booking endpoints → Booking and tokens: delegates bookings
- Queue endpoints → Queue and status: delegates queue work
- Procurement and payments → Queue and status: changes queue state
- Booking and tokens → Notification delivery: creates and delivers
- Queue and status → Notification delivery: creates notifications
- OTP verification → Notification delivery: creates and delivers
- OTP verification → Twilio SMS: sends OTP
- Notification delivery → Twilio SMS: delivers SMS
- Procurement and payments → Razorpay test checkout: sandbox checkout
- Auth controller → Domain models: reads and writes
- OTP verification → Domain models: reads and writes
- Booking and tokens → Domain models: reads and writes
- Queue and status → Domain models: reads and writes
- Centre discovery → Domain models: reads and writes
- Slot management → Domain models: reads and writes
- Procurement and payments → Domain models: reads and writes
- Notification delivery → Domain models: stores delivery state
- Domain models → MongoDB: persists records
