# umeshkmahato/suvidhapay-web architecture

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

- Interactive diagram: https://gitdiagram.com/umeshkmahato/suvidhapay-web
- Repository: https://github.com/umeshkmahato/suvidhapay-web

## Overview

SuvidhaPay is a municipal revenue ERP for administrators, revenue officers, field agents, and citizens. The main workflow is role-based access to municipal entities and dues, payment collection or verification, authoritative receipts, and operational reconciliation or closing. The map includes governance, imports, disputes, and notifications documented in the README. Source excerpts establish selected calls; other documented capabilities are represented without guessed implementation links.

Main entry points: [`src/App.tsx`](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/App.tsx) (Role consoles), [`src/server/app.ts`](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/app.ts) (REST API), [`src/server/repositories/interfaces.ts`](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/interfaces.ts) (Repository interfaces), [`src/server/services/paymentsReceiptsService.ts`](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/paymentsReceiptsService.ts) (Payments and receipts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Role-based client"]
  node_app["Role consoles<br/>[App.tsx]"]
  node_admin["Admin workspace"]
  node_admin_finance["Dues and receipts UI"]
  node_governance["Governance and operations UI"]
  node_agent_citizen["Agent and citizen UI"]
  node_modals["Shared dialogs<br/>[SharedModals.tsx]"]
  node_api_client["API client<br/>[apiClient.ts]"]
  node_mock_data["Demo data<br/>[mockSuvidhaData.ts]"]
end

subgraph group_api["API and security"]
  node_http["REST API<br/>[app.ts]"]
  node_security["Auth middleware<br/>[authMiddleware.ts]"]
  node_validation["Request validation"]
  node_core["Financial and API utilities<br/>[core.ts]"]
end

subgraph group_domain["Municipal workflows"]
  node_auth["Authentication and users"]
  node_entities["Entities rates and dues"]
  node_payments["Payments and receipts"]
  node_operations["Closings and reconciliation"]
  node_adapters["External service adapters<br/>[mockAdapters.ts]"]
  node_records["Domain records<br/>[suvidha.ts]"]
end

subgraph group_persistence["Persistence"]
  node_interfaces["Repository interfaces<br/>[interfaces.ts]"]
  node_repositories["Domain repositories"]
  node_database["Database initialization<br/>[database.ts]"]
  node_store[("Loki data store<br/>[lokiDataStore.ts]")]
  node_seed["Seed data<br/>[seedData.ts]"]
  node_json_store[("JSON data store<br/>[jsonDataStore.ts]")]
end

node_users(("Municipal users"))
node_gateway["Payment gateway"]
node_government["Vahan and PM SVANidhi"]
node_bank["Municipal bank scroll"]

node_users -->|"use consoles"| node_app
node_app -->|"renders"| node_admin
node_app -->|"renders"| node_admin_finance
node_app -->|"renders"| node_governance
node_app -->|"renders"| node_agent_citizen
node_app -->|"uses"| node_modals
node_admin -->|"uses demo data"| node_mock_data
node_admin_finance -->|"uses demo data"| node_mock_data
node_governance -->|"uses demo data"| node_mock_data
node_agent_citizen -->|"uses demo data"| node_mock_data
node_app -->|"requests API"| node_api_client
node_modals -->|"requests API"| node_api_client
node_api_client -->|"sends HTTP requests"| node_http
node_http -->|"routes requests"| node_auth
node_http -->|"routes requests"| node_entities
node_http -->|"routes requests"| node_payments
node_http -->|"routes requests"| node_operations
node_http -->|"protects routes"| node_security
node_http -->|"validates requests"| node_validation
node_auth -->|"uses token utilities"| node_core
node_payments -->|"uses money utilities"| node_core
node_operations -->|"dispatches notifications"| node_adapters
node_payments -.->|"processes online checkout"| node_gateway
node_entities -.->|"checks registrations"| node_government
node_operations -.->|"matches bank scrolls"| node_bank
node_auth -->|"uses store contract"| node_interfaces
node_entities -->|"uses store contract"| node_interfaces
node_payments -->|"uses store contract"| node_interfaces
node_operations -->|"uses store contract"| node_interfaces
node_repositories -->|"implements contracts"| node_interfaces
node_database -->|"initializes"| node_store
node_database -->|"seeds collections"| node_seed
node_store -->|"implements store contract"| node_interfaces
node_json_store -->|"implements store contract"| node_interfaces
node_seed -->|"populates store"| node_interfaces
node_payments -->|"handles payment records"| node_records
node_operations -->|"handles closing records"| node_records

click node_app "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/App.tsx"
click node_admin "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AdminDashboardAndEntities.tsx"
click node_admin_finance "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AdminDuesPaymentsReceipts.tsx"
click node_governance "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AdminGovernanceAndOps.tsx"
click node_agent_citizen "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AgentAndCitizenShells.tsx"
click node_modals "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/SharedModals.tsx"
click node_api_client "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/services/apiClient.ts"
click node_http "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/app.ts"
click node_auth "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/authAndUsersService.ts"
click node_entities "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/entitiesRatesDuesService.ts"
click node_payments "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/paymentsReceiptsService.ts"
click node_operations "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/operationsAndReportsService.ts"
click node_adapters "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/adapters/mockAdapters.ts"
click node_records "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/types/suvidha.ts"
click node_security "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/middleware/authMiddleware.ts"
click node_validation "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/schemas/validationSchemas.ts"
click node_core "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/infra/core.ts"
click node_interfaces "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/interfaces.ts"
click node_repositories "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/domainRepositories.ts"
click node_database "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/db/database.ts"
click node_store "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/lokiDataStore.ts"
click node_seed "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/db/seedData.ts"
click node_json_store "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/jsonDataStore.ts"
click node_mock_data "https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/data/mockSuvidhaData.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_app,node_admin,node_admin_finance,node_governance,node_agent_citizen,node_modals,node_api_client,node_mock_data,node_users toneBlue
class node_http,node_security,node_validation,node_core toneAmber
class node_auth,node_entities,node_payments,node_operations,node_adapters,node_records toneMint
class node_interfaces,node_repositories,node_database,node_store,node_seed,node_json_store toneRose
class node_gateway,node_government,node_bank toneIndigo
```

## Components

### Role-based client

- [Role consoles](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/App.tsx): `src/App.tsx`
- [Admin workspace](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AdminDashboardAndEntities.tsx): `src/components/AdminDashboardAndEntities.tsx`
- [Dues and receipts UI](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AdminDuesPaymentsReceipts.tsx): `src/components/AdminDuesPaymentsReceipts.tsx`
- [Governance and operations UI](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AdminGovernanceAndOps.tsx): `src/components/AdminGovernanceAndOps.tsx`
- [Agent and citizen UI](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/AgentAndCitizenShells.tsx): `src/components/AgentAndCitizenShells.tsx`
- [Shared dialogs](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/components/SharedModals.tsx): `src/components/SharedModals.tsx`
- [API client](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/services/apiClient.ts): `src/services/apiClient.ts`
- [Demo data](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/data/mockSuvidhaData.ts): `src/data/mockSuvidhaData.ts`

### API and security

- [REST API](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/app.ts): `src/server/app.ts`
- [Auth middleware](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/middleware/authMiddleware.ts): `src/server/middleware/authMiddleware.ts`
- [Request validation](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/schemas/validationSchemas.ts): `src/server/schemas/validationSchemas.ts`
- [Financial and API utilities](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/infra/core.ts): `src/server/infra/core.ts`

### Municipal workflows

- [Authentication and users](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/authAndUsersService.ts): `src/server/services/authAndUsersService.ts`
- [Entities rates and dues](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/entitiesRatesDuesService.ts): `src/server/services/entitiesRatesDuesService.ts`
- [Payments and receipts](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/paymentsReceiptsService.ts): `src/server/services/paymentsReceiptsService.ts`
- [Closings and reconciliation](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/services/operationsAndReportsService.ts): `src/server/services/operationsAndReportsService.ts`
- [External service adapters](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/adapters/mockAdapters.ts): `src/server/adapters/mockAdapters.ts`
- [Domain records](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/types/suvidha.ts): `src/types/suvidha.ts`

### Persistence

- [Repository interfaces](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/interfaces.ts): `src/server/repositories/interfaces.ts`
- [Domain repositories](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/domainRepositories.ts): `src/server/repositories/domainRepositories.ts`
- [Database initialization](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/db/database.ts): `src/server/db/database.ts`
- [Loki data store](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/lokiDataStore.ts): `src/server/repositories/lokiDataStore.ts`
- [Seed data](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/db/seedData.ts): `src/server/db/seedData.ts`
- [JSON data store](https://github.com/umeshkmahato/suvidhapay-web/blob/main/src/server/repositories/jsonDataStore.ts): `src/server/repositories/jsonDataStore.ts`

### Other components

- **Municipal users**
- **Payment gateway**
- **Vahan and PM SVANidhi**
- **Municipal bank scroll**

## Connections

- Municipal users → Role consoles: use consoles (evidence: `README.md`)
- Role consoles → Admin workspace: renders (evidence: `src/App.tsx`)
- Role consoles → Dues and receipts UI: renders (evidence: `src/App.tsx`)
- Role consoles → Governance and operations UI: renders (evidence: `src/App.tsx`)
- Role consoles → Agent and citizen UI: renders (evidence: `src/App.tsx`)
- Role consoles → Shared dialogs: uses (evidence: `src/App.tsx`)
- Admin workspace → Demo data: uses demo data (evidence: `src/components/AdminDashboardAndEntities.tsx`)
- Dues and receipts UI → Demo data: uses demo data (evidence: `src/components/AdminDuesPaymentsReceipts.tsx`)
- Governance and operations UI → Demo data: uses demo data (evidence: `src/components/AdminGovernanceAndOps.tsx`)
- Agent and citizen UI → Demo data: uses demo data (evidence: `src/components/AgentAndCitizenShells.tsx`)
- Role consoles → API client: requests API (evidence: `src/App.tsx`)
- Shared dialogs → API client: requests API (evidence: `src/components/SharedModals.tsx`)
- API client → REST API: sends HTTP requests (evidence: `src/services/apiClient.ts`)
- REST API → Authentication and users: routes requests (evidence: `src/server/app.ts`)
- REST API → Entities rates and dues: routes requests (evidence: `src/server/app.ts`)
- REST API → Payments and receipts: routes requests (evidence: `src/server/app.ts`)
- REST API → Closings and reconciliation: routes requests (evidence: `src/server/app.ts`)
- REST API → Auth middleware: protects routes (evidence: `src/server/app.ts`)
- REST API → Request validation: validates requests (evidence: `src/server/app.ts`)
- Authentication and users → Financial and API utilities: uses token utilities (evidence: `src/server/services/authAndUsersService.ts`)
- Payments and receipts → Financial and API utilities: uses money utilities (evidence: `src/server/services/paymentsReceiptsService.ts`)
- Closings and reconciliation → External service adapters: dispatches notifications (evidence: `src/server/services/operationsAndReportsService.ts`)
- Payments and receipts → Payment gateway: processes online checkout (evidence: `README.md`)
- Entities rates and dues → Vahan and PM SVANidhi: checks registrations (evidence: `README.md`)
- Closings and reconciliation → Municipal bank scroll: matches bank scrolls (evidence: `README.md`)
- Authentication and users → Repository interfaces: uses store contract (evidence: `src/server/services/authAndUsersService.ts`)
- Entities rates and dues → Repository interfaces: uses store contract (evidence: `src/server/services/entitiesRatesDuesService.ts`)
- Payments and receipts → Repository interfaces: uses store contract (evidence: `src/server/services/paymentsReceiptsService.ts`)
- Closings and reconciliation → Repository interfaces: uses store contract (evidence: `src/server/services/operationsAndReportsService.ts`)
- Domain repositories → Repository interfaces: implements contracts (evidence: `src/server/repositories/domainRepositories.ts`)
- Database initialization → Loki data store: initializes (evidence: `src/server/db/database.ts`)
- Database initialization → Seed data: seeds collections (evidence: `src/server/db/database.ts`)
- Loki data store → Repository interfaces: implements store contract (evidence: `src/server/repositories/lokiDataStore.ts`)
- JSON data store → Repository interfaces: implements store contract (evidence: `src/server/repositories/jsonDataStore.ts`)
- Seed data → Repository interfaces: populates store (evidence: `src/server/db/seedData.ts`)
- Payments and receipts → Domain records: handles payment records (evidence: `src/server/services/paymentsReceiptsService.ts`)
- Closings and reconciliation → Domain records: handles closing records (evidence: `src/server/services/operationsAndReportsService.ts`)
