# agrajput2006-ui/krushi-kendra-webapplicaion architecture

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

- Interactive diagram: https://gitdiagram.com/agrajput2006-ui/krushi-kendra-webapplicaion
- Repository: https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion

## Overview

Khushi Kendra Business Manager is an offline-first retail operations app for agricultural-input shops. Shop staff authenticate, create sales bills, manage stock and purchases, receive customer payments, and produce invoices, receipts, statements, and reports. AppContext coordinates domain state and persistence; feature pages invoke it, while calculations and exports support domain workflows. The README documents major capabilities and flows; sampled source confirms routing, bill-state ownership, and storage dependencies. Some page-to-feature behavior is documented rather than verified from page excerpts.

Main entry points: [`src/context/AppContext.tsx`](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/context/AppContext.tsx) (Domain State and Actions), [`src/App.tsx`](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/App.tsx) (App Navigation), [`src/pages/NewBillPage.tsx`](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/NewBillPage.tsx) (Create Sale Bill), [`src/pages/LandingPage.tsx`](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/LandingPage.tsx) (Shop Landing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access and Navigation"]
  node_landing["Shop Landing<br/>[LandingPage.tsx]"]
  node_auth["Sign-in<br/>[AuthPage.tsx]"]
  node_shell["App Navigation<br/>[App.tsx]"]
end

subgraph group_sales["Sales and Records"]
  node_billing["Create Sale Bill<br/>[NewBillPage.tsx]"]
  node_invoice["Invoice and Print<br/>[InvoiceModal.tsx]"]
  node_find["Find and Extract"]
  node_payments["Receive Payments<br/>[PaymentsPage.tsx]"]
  node_receipt["Payment Receipts<br/>[ReceiptModal.tsx]"]
  node_accounts["Customer and Supplier Ledgers<br/>[AccountsPage.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
end

subgraph group_operations["Shop Operations"]
  node_purchases["Purchases<br/>[PurchasesPage.tsx]"]
  node_scan["AI Bill Scan<br/>[ScanBillPage.tsx]"]
  node_items["Item Catalog<br/>[ItemsPage.tsx]"]
  node_stock["Stock and Expiry<br/>[StockPage.tsx]"]
  node_reports["Reports<br/>[ReportsPage.tsx]"]
  node_settings["Settings and Backup<br/>[SettingsPage.tsx]"]
end

subgraph group_core["Application Core"]
  node_context["Domain State and Actions<br/>[AppContext.tsx]"]
  node_storage[("Browser Persistence<br/>[storage.ts]")]
  node_seed["Sample Data<br/>[seed.ts]"]
  node_calculations["Business Calculations<br/>[calculations.ts]"]
  node_exports["PDF and Data Exports<br/>[exports.ts]"]
  node_translations["English Hindi Marathi<br/>[translations.ts]"]
end

node_owner(("Shop Owner / Staff"))

node_owner -->|"opens"| node_landing
node_owner -->|"signs in"| node_auth
node_auth -->|"authenticates"| node_context
node_landing -->|"reads app state"| node_context
node_shell -->|"provides state"| node_context
node_shell -->|"routes to"| node_landing
node_shell -->|"routes to"| node_auth
node_shell -->|"routes to"| node_billing
node_owner -->|"uses"| node_shell
node_billing -->|"saves bill"| node_context
node_context -->|"opens invoice"| node_invoice
node_owner -->|"creates sale"| node_billing
node_owner -->|"searches records"| node_find
node_find -->|"exports statements"| node_exports
node_owner -->|"records payment"| node_payments
node_payments -->|"saves payment"| node_context
node_context -->|"generates receipt"| node_receipt
node_owner -->|"manages ledgers"| node_accounts
node_accounts -->|"reads and updates"| node_context
node_owner -->|"views activity"| node_dashboard
node_dashboard -->|"reads state"| node_context
node_owner -->|"records purchases"| node_purchases
node_purchases -->|"saves purchases"| node_context
node_owner -->|"scans supplier bill"| node_scan
node_scan -->|"confirms purchase"| node_context
node_owner -->|"manages items"| node_items
node_items -->|"updates catalog"| node_context
node_owner -->|"checks stock"| node_stock
node_stock -->|"reads and adjusts"| node_context
node_owner -->|"views reports"| node_reports
node_reports -->|"reads records"| node_context
node_owner -->|"configures shop"| node_settings
node_settings -->|"updates settings"| node_context
node_context -->|"persists state"| node_storage
node_context -->|"loads sample data"| node_seed
node_context -->|"computes domain values"| node_calculations
node_billing -->|"calculates bill number"| node_calculations
node_invoice -->|"downloads invoice"| node_exports
node_receipt -->|"downloads receipt"| node_exports
node_context -->|"selects language"| node_translations

click node_landing "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/LandingPage.tsx"
click node_auth "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/AuthPage.tsx"
click node_shell "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/App.tsx"
click node_billing "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/NewBillPage.tsx"
click node_invoice "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/components/InvoiceModal.tsx"
click node_find "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/FindExtractPage.tsx"
click node_payments "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/PaymentsPage.tsx"
click node_receipt "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/components/ReceiptModal.tsx"
click node_accounts "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/AccountsPage.tsx"
click node_dashboard "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/DashboardPage.tsx"
click node_purchases "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/PurchasesPage.tsx"
click node_scan "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/ScanBillPage.tsx"
click node_items "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/ItemsPage.tsx"
click node_stock "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/StockPage.tsx"
click node_reports "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/ReportsPage.tsx"
click node_settings "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/SettingsPage.tsx"
click node_context "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/context/AppContext.tsx"
click node_storage "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/db/storage.ts"
click node_seed "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/db/seed.ts"
click node_calculations "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/utils/calculations.ts"
click node_exports "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/utils/exports.ts"
click node_translations "https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/i18n/translations.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_landing,node_auth,node_shell toneBlue
class node_billing,node_invoice,node_find,node_payments,node_receipt,node_accounts,node_dashboard toneAmber
class node_purchases,node_scan,node_items,node_stock,node_reports,node_settings toneMint
class node_context,node_storage,node_seed,node_calculations,node_exports,node_translations toneRose
class node_owner toneIndigo
```

## Components

### Access and Navigation

- [Shop Landing](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/LandingPage.tsx): `src/pages/LandingPage.tsx`
- [Sign-in](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/AuthPage.tsx): `src/pages/AuthPage.tsx`
- [App Navigation](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/App.tsx): `src/App.tsx`

### Sales and Records

- [Create Sale Bill](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/NewBillPage.tsx): `src/pages/NewBillPage.tsx`
- [Invoice and Print](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/components/InvoiceModal.tsx): `src/components/InvoiceModal.tsx`
- [Find and Extract](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/FindExtractPage.tsx): `src/pages/FindExtractPage.tsx`
- [Receive Payments](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/PaymentsPage.tsx): `src/pages/PaymentsPage.tsx`
- [Payment Receipts](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/components/ReceiptModal.tsx): `src/components/ReceiptModal.tsx`
- [Customer and Supplier Ledgers](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/AccountsPage.tsx): `src/pages/AccountsPage.tsx`
- [Dashboard](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`

### Shop Operations

- [Purchases](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/PurchasesPage.tsx): `src/pages/PurchasesPage.tsx`
- [AI Bill Scan](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/ScanBillPage.tsx): `src/pages/ScanBillPage.tsx`
- [Item Catalog](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/ItemsPage.tsx): `src/pages/ItemsPage.tsx`
- [Stock and Expiry](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/StockPage.tsx): `src/pages/StockPage.tsx`
- [Reports](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/ReportsPage.tsx): `src/pages/ReportsPage.tsx`
- [Settings and Backup](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/pages/SettingsPage.tsx): `src/pages/SettingsPage.tsx`

### Application Core

- [Domain State and Actions](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Browser Persistence](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/db/storage.ts): `src/db/storage.ts`
- [Sample Data](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/db/seed.ts): `src/db/seed.ts`
- [Business Calculations](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/utils/calculations.ts): `src/utils/calculations.ts`
- [PDF and Data Exports](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/utils/exports.ts): `src/utils/exports.ts`
- [English Hindi Marathi](https://github.com/agrajput2006-ui/krushi-kendra-webapplicaion/blob/main/src/i18n/translations.ts): `src/i18n/translations.ts`

### Other components

- **Shop Owner / Staff**

## Connections

- Shop Owner / Staff → Shop Landing: opens (evidence: `README.md`)
- Shop Owner / Staff → Sign-in: signs in (evidence: `README.md`)
- Sign-in → Domain State and Actions: authenticates (evidence: `src/pages/AuthPage.tsx`)
- Shop Landing → Domain State and Actions: reads app state (evidence: `src/pages/LandingPage.tsx`)
- App Navigation → Domain State and Actions: provides state (evidence: `src/App.tsx`)
- App Navigation → Shop Landing: routes to (evidence: `src/App.tsx`)
- App Navigation → Sign-in: routes to (evidence: `src/App.tsx`)
- App Navigation → Create Sale Bill: routes to (evidence: `src/App.tsx`)
- Shop Owner / Staff → App Navigation: uses (evidence: `README.md`)
- Create Sale Bill → Domain State and Actions: saves bill (evidence: `src/pages/NewBillPage.tsx`)
- Domain State and Actions → Invoice and Print: opens invoice (evidence: `README.md`)
- Shop Owner / Staff → Create Sale Bill: creates sale (evidence: `README.md`)
- Shop Owner / Staff → Find and Extract: searches records (evidence: `README.md`)
- Find and Extract → PDF and Data Exports: exports statements (evidence: `README.md`)
- Shop Owner / Staff → Receive Payments: records payment (evidence: `README.md`)
- Receive Payments → Domain State and Actions: saves payment (evidence: `src/pages/PaymentsPage.tsx`)
- Domain State and Actions → Payment Receipts: generates receipt (evidence: `README.md`)
- Shop Owner / Staff → Customer and Supplier Ledgers: manages ledgers (evidence: `README.md`)
- Customer and Supplier Ledgers → Domain State and Actions: reads and updates (evidence: `src/pages/AccountsPage.tsx`)
- Shop Owner / Staff → Dashboard: views activity (evidence: `README.md`)
- Dashboard → Domain State and Actions: reads state (evidence: `src/pages/DashboardPage.tsx`)
- Shop Owner / Staff → Purchases: records purchases (evidence: `README.md`)
- Purchases → Domain State and Actions: saves purchases (evidence: `src/pages/PurchasesPage.tsx`)
- Shop Owner / Staff → AI Bill Scan: scans supplier bill (evidence: `README.md`)
- AI Bill Scan → Domain State and Actions: confirms purchase (evidence: `src/pages/ScanBillPage.tsx`)
- Shop Owner / Staff → Item Catalog: manages items (evidence: `README.md`)
- Item Catalog → Domain State and Actions: updates catalog (evidence: `src/pages/ItemsPage.tsx`)
- Shop Owner / Staff → Stock and Expiry: checks stock (evidence: `README.md`)
- Stock and Expiry → Domain State and Actions: reads and adjusts (evidence: `src/pages/StockPage.tsx`)
- Shop Owner / Staff → Reports: views reports (evidence: `README.md`)
- Reports → Domain State and Actions: reads records (evidence: `src/pages/ReportsPage.tsx`)
- Shop Owner / Staff → Settings and Backup: configures shop (evidence: `README.md`)
- Settings and Backup → Domain State and Actions: updates settings (evidence: `src/pages/SettingsPage.tsx`)
- Domain State and Actions → Browser Persistence: persists state (evidence: `src/context/AppContext.tsx`)
- Domain State and Actions → Sample Data: loads sample data (evidence: `src/context/AppContext.tsx`)
- Domain State and Actions → Business Calculations: computes domain values (evidence: `src/context/AppContext.tsx`)
- Create Sale Bill → Business Calculations: calculates bill number (evidence: `src/pages/NewBillPage.tsx`)
- Invoice and Print → PDF and Data Exports: downloads invoice (evidence: `src/components/InvoiceModal.tsx`)
- Payment Receipts → PDF and Data Exports: downloads receipt (evidence: `src/components/ReceiptModal.tsx`)
- Domain State and Actions → English Hindi Marathi: selects language (evidence: `src/context/AppContext.tsx`)
