# sayyamjain2520-jpg/mandi-setu architecture

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

- Interactive diagram: https://gitdiagram.com/sayyamjain2520-jpg/mandi-setu
- Repository: https://github.com/sayyamjain2520-jpg/mandi-setu

## Overview

This is a role-based mandi procurement application, not the Vite template described by its README. Farmers discover centres, request slots, track tokens and view payment information; operators handle gate calls, inspection and procurement; administrators manage centres, commodities and operators. App.tsx routes authenticated users to these role workspaces, while services/api.ts provides application data operations backed by Supabase or local demo storage. The workflow edges shown are supported by excerpts or the SOURCE INDEX; unsampled page behavior and database schema are not inferred.

Main entry points: [`src/services/api.ts`](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/services/api.ts) (Procurement API), [`src/App.tsx`](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/App.tsx) (Role routing), [`src/modules/farmer/FarmerApp.tsx`](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/FarmerApp.tsx) (Farmer workspace), [`src/modules/operator/OperatorDashboard.tsx`](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/OperatorDashboard.tsx) (Operator dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shared services"]
  node_app["Role routing<br/>[App.tsx]"]
  node_login["Sign in<br/>[Login.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_api["Procurement API<br/>[api.ts]"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_localstore[("Demo local store<br/>[localStore.ts]")]
  node_notifications["Notifications"]
  node_translation["Language support"]
  node_ui["Shared UI controls"]
end

subgraph group_farmer["Farmer procurement"]
  node_farmerapp["Farmer workspace<br/>[FarmerApp.tsx]"]
  node_discovery["Centre discovery"]
  node_booking["Slot booking"]
  node_tokens["Token tracking<br/>[MyTokensView.tsx]"]
  node_payments["Payments view<br/>[FarmerPayments.tsx]"]
  node_qrpass["Token QR pass<br/>[TokenQRPass.tsx]"]
  node_route["Mandi route map<br/>[MandiRouteMap.tsx]"]
end

subgraph group_operations["Mandi operations"]
  node_operator["Operator dashboard"]
  node_gate["Gate scanning<br/>[GateScanner.tsx]"]
  node_verification["Gate verification"]
  node_inspection["Quality inspection"]
  node_procurement["Procurement entry"]
end

subgraph group_administration["Administration"]
  node_admin["Admin dashboard<br/>[AdminDashboard.tsx]"]
  node_centres["Centre management"]
  node_commodities["Commodity management"]
  node_operatoradmin["Operator management"]
  node_ledger["Bookings ledger"]
end

node_user(("Farmers and staff"))

node_user -->|"opens app"| node_app
node_app -.->|"routes to"| node_login
node_app -->|"routes by role"| node_farmerapp
node_app -->|"routes by role"| node_operator
node_app -->|"routes by role"| node_admin
node_login -->|"authenticates with"| node_auth
node_auth -->|"checks configuration"| node_supabase
node_farmerapp -->|"renders"| node_discovery
node_farmerapp -->|"renders"| node_booking
node_farmerapp -->|"renders"| node_tokens
node_farmerapp -->|"renders"| node_payments
node_farmerapp -->|"requests data"| node_api
node_tokens -->|"requests data"| node_api
node_tokens -->|"renders"| node_qrpass
node_tokens -->|"renders"| node_route
node_operator -->|"requests data"| node_api
node_operator -->|"uses scanner"| node_gate
node_operator -->|"renders"| node_verification
node_operator -->|"renders"| node_inspection
node_operator -->|"renders"| node_procurement
node_procurement -->|"saves entry"| node_api
node_admin -->|"requests data"| node_api
node_admin -->|"renders"| node_centres
node_admin -->|"renders"| node_commodities
node_admin -->|"renders"| node_operatoradmin
node_admin -->|"renders"| node_ledger
node_commodities -->|"uses controls"| node_ui
node_api -->|"queries cloud data"| node_supabase
node_api -->|"uses demo storage"| node_localstore
node_notifications -->|"loads and updates"| node_api
node_notifications -->|"reads user"| node_auth
node_app -.->|"provides notifications"| node_notifications

click node_app "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/App.tsx"
click node_login "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/auth/Login.tsx"
click node_auth "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/context/AuthContext.tsx"
click node_api "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/services/api.ts"
click node_supabase "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/config/supabase.ts"
click node_localstore "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/services/mock/localStore.ts"
click node_notifications "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/context/NotificationContext.tsx"
click node_translation "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/context/LanguageContext.tsx"
click node_farmerapp "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/FarmerApp.tsx"
click node_discovery "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/CentreDiscovery.tsx"
click node_booking "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/SlotBookingWizard.tsx"
click node_tokens "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/MyTokensView.tsx"
click node_payments "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/FarmerPayments.tsx"
click node_operator "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/OperatorDashboard.tsx"
click node_gate "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/components/qr/GateScanner.tsx"
click node_verification "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/components/GateVerificationModal.tsx"
click node_inspection "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/components/QCInspectionModal.tsx"
click node_procurement "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/components/ProcurementEntryModal.tsx"
click node_admin "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/AdminDashboard.tsx"
click node_centres "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/CentreManagementTab.tsx"
click node_commodities "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/CommodityManagerTab.tsx"
click node_operatoradmin "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/OperatorManagementTab.tsx"
click node_ledger "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/AllBookingsLedgerTab.tsx"
click node_ui "https://github.com/sayyamjain2520-jpg/mandi-setu/tree/main/src/components/ui"
click node_qrpass "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/components/qr/TokenQRPass.tsx"
click node_route "https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/components/maps/MandiRouteMap.tsx"

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_login,node_auth,node_api,node_supabase,node_localstore,node_notifications,node_translation,node_ui toneBlue
class node_farmerapp,node_discovery,node_booking,node_tokens,node_payments,node_qrpass,node_route toneAmber
class node_operator,node_gate,node_verification,node_inspection,node_procurement toneMint
class node_admin,node_centres,node_commodities,node_operatoradmin,node_ledger toneRose
class node_user toneIndigo
```

## Components

### Access and shared services

- [Role routing](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/App.tsx): `src/App.tsx`
- [Sign in](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/auth/Login.tsx): `src/modules/auth/Login.tsx`
- [Authentication](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Procurement API](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/services/api.ts): `src/services/api.ts`
- [Supabase client](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/config/supabase.ts): `src/config/supabase.ts`
- [Demo local store](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/services/mock/localStore.ts): `src/services/mock/localStore.ts`
- [Notifications](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/context/NotificationContext.tsx): `src/context/NotificationContext.tsx`
- [Language support](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/context/LanguageContext.tsx): `src/context/LanguageContext.tsx`
- [Shared UI controls](https://github.com/sayyamjain2520-jpg/mandi-setu/tree/main/src/components/ui): `src/components/ui`

### Farmer procurement

- [Farmer workspace](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/FarmerApp.tsx): `src/modules/farmer/FarmerApp.tsx`
- [Centre discovery](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/CentreDiscovery.tsx): `src/modules/farmer/pages/CentreDiscovery.tsx`
- [Slot booking](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/SlotBookingWizard.tsx): `src/modules/farmer/pages/SlotBookingWizard.tsx`
- [Token tracking](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/MyTokensView.tsx): `src/modules/farmer/pages/MyTokensView.tsx`
- [Payments view](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/farmer/pages/FarmerPayments.tsx): `src/modules/farmer/pages/FarmerPayments.tsx`
- [Token QR pass](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/components/qr/TokenQRPass.tsx): `src/components/qr/TokenQRPass.tsx`
- [Mandi route map](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/components/maps/MandiRouteMap.tsx): `src/components/maps/MandiRouteMap.tsx`

### Mandi operations

- [Operator dashboard](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/OperatorDashboard.tsx): `src/modules/operator/OperatorDashboard.tsx`
- [Gate scanning](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/components/qr/GateScanner.tsx): `src/components/qr/GateScanner.tsx`
- [Gate verification](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/components/GateVerificationModal.tsx): `src/modules/operator/components/GateVerificationModal.tsx`
- [Quality inspection](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/components/QCInspectionModal.tsx): `src/modules/operator/components/QCInspectionModal.tsx`
- [Procurement entry](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/operator/components/ProcurementEntryModal.tsx): `src/modules/operator/components/ProcurementEntryModal.tsx`

### Administration

- [Admin dashboard](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/AdminDashboard.tsx): `src/modules/admin/AdminDashboard.tsx`
- [Centre management](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/CentreManagementTab.tsx): `src/modules/admin/components/CentreManagementTab.tsx`
- [Commodity management](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/CommodityManagerTab.tsx): `src/modules/admin/components/CommodityManagerTab.tsx`
- [Operator management](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/OperatorManagementTab.tsx): `src/modules/admin/components/OperatorManagementTab.tsx`
- [Bookings ledger](https://github.com/sayyamjain2520-jpg/mandi-setu/blob/main/src/modules/admin/components/AllBookingsLedgerTab.tsx): `src/modules/admin/components/AllBookingsLedgerTab.tsx`

### Other components

- **Farmers and staff**

## Connections

- Farmers and staff → Role routing: opens app (evidence: `src/App.tsx`)
- Role routing → Sign in: routes to (evidence: `src/App.tsx`)
- Role routing → Farmer workspace: routes by role (evidence: `src/App.tsx`)
- Role routing → Operator dashboard: routes by role (evidence: `src/App.tsx`)
- Role routing → Admin dashboard: routes by role (evidence: `src/App.tsx`)
- Sign in → Authentication: authenticates with (evidence: `src/modules/auth/Login.tsx`)
- Authentication → Supabase client: checks configuration (evidence: `src/context/AuthContext.tsx`)
- Farmer workspace → Centre discovery: renders (evidence: `src/modules/farmer/FarmerApp.tsx`)
- Farmer workspace → Slot booking: renders (evidence: `src/modules/farmer/FarmerApp.tsx`)
- Farmer workspace → Token tracking: renders (evidence: `src/modules/farmer/FarmerApp.tsx`)
- Farmer workspace → Payments view: renders (evidence: `src/modules/farmer/FarmerApp.tsx`)
- Farmer workspace → Procurement API: requests data (evidence: `src/modules/farmer/FarmerApp.tsx`)
- Token tracking → Procurement API: requests data (evidence: `src/modules/farmer/pages/MyTokensView.tsx`)
- Token tracking → Token QR pass: renders (evidence: `src/modules/farmer/pages/MyTokensView.tsx`)
- Token tracking → Mandi route map: renders (evidence: `src/modules/farmer/pages/MyTokensView.tsx`)
- Operator dashboard → Procurement API: requests data (evidence: `src/modules/operator/OperatorDashboard.tsx`)
- Operator dashboard → Gate scanning: uses scanner (evidence: `src/modules/operator/OperatorDashboard.tsx`)
- Operator dashboard → Gate verification: renders (evidence: `src/modules/operator/OperatorDashboard.tsx`)
- Operator dashboard → Quality inspection: renders (evidence: `src/modules/operator/OperatorDashboard.tsx`)
- Operator dashboard → Procurement entry: renders (evidence: `src/modules/operator/OperatorDashboard.tsx`)
- Procurement entry → Procurement API: saves entry (evidence: `src/modules/operator/components/ProcurementEntryModal.tsx`)
- Admin dashboard → Procurement API: requests data (evidence: `src/modules/admin/AdminDashboard.tsx`)
- Admin dashboard → Centre management: renders (evidence: `src/modules/admin/AdminDashboard.tsx`)
- Admin dashboard → Commodity management: renders (evidence: `src/modules/admin/AdminDashboard.tsx`)
- Admin dashboard → Operator management: renders (evidence: `src/modules/admin/AdminDashboard.tsx`)
- Admin dashboard → Bookings ledger: renders (evidence: `src/modules/admin/AdminDashboard.tsx`)
- Commodity management → Shared UI controls: uses controls (evidence: `src/modules/admin/components/CommodityManagerTab.tsx`)
- Procurement API → Supabase client: queries cloud data (evidence: `src/services/api.ts`)
- Procurement API → Demo local store: uses demo storage (evidence: `src/services/api.ts`)
- Notifications → Procurement API: loads and updates (evidence: `src/context/NotificationContext.tsx`)
- Notifications → Authentication: reads user (evidence: `src/context/NotificationContext.tsx`)
- Role routing → Notifications: provides notifications (evidence: `src/App.tsx`)
