# aryansingh257/inven3 architecture

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

- Interactive diagram: https://gitdiagram.com/aryansingh257/inven3
- Repository: https://github.com/aryansingh257/inven3

## Overview

Inven3 is an offline inventory and point-of-sale app for small shops. A shopkeeper manages products, categories, and expiry-dated batches on the dashboard, then builds a bill and confirms a sale; billing deducts stock using FEFO and records sales locally. Stock adjustments and expiry/low-stock alerts support ongoing inventory work, while history and settings provide review and configuration. Routing, storage hooks, and batch utilities are shown as internal layers. Page wiring beyond the sampled excerpts is included only where routes or README capabilities establish it.

Main entry points: [`src/pages/Index.tsx`](https://github.com/aryansingh257/inven3/blob/main/src/pages/Index.tsx) (Product dashboard), [`src/App.tsx`](https://github.com/aryansingh257/inven3/blob/main/src/App.tsx) (App router), [`src/hooks/useSettings.ts`](https://github.com/aryansingh257/inven3/blob/main/src/hooks/useSettings.ts) (Settings hook), [`src/hooks/useLocalStorage.ts`](https://github.com/aryansingh257/inven3/blob/main/src/hooks/useLocalStorage.ts) (Storage hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App navigation"]
  node_app["App router<br/>[App.tsx]"]
  node_settings_page["Settings page<br/>[Settings.tsx]"]
end

subgraph group_inventory["Inventory management"]
  node_dashboard["Product dashboard<br/>[Index.tsx]"]
  node_product_forms["Product forms<br/>[AddProductForm.tsx]"]
  node_category_form["Category form"]
  node_stock_card["Stock card"]
  node_batch_management["Batch management"]
  node_stock_adjustment["Stock adjustment"]
  node_expiry_alerts["Expiry alerts"]
  node_batch_logic["Batch calculations<br/>[batchHelpers.ts]"]
  node_product_logic["Product filtering<br/>[productHelpers.ts]"]
  node_product_types["Product and batch data<br/>[product.ts]"]
end

subgraph group_sales["Billing and history"]
  node_billing["POS billing<br/>[Billing.tsx]"]
  node_history["Sales history<br/>[SalesHistory.tsx]"]
  node_sale_types["Sale records<br/>[sale.ts]"]
end

subgraph group_state["Local state"]
  node_settings_hook["Settings hook<br/>[useSettings.ts]"]
  node_storage_hook["Storage hook<br/>[useLocalStorage.ts]"]
  node_local_storage[("Browser storage")]
end

node_shopkeeper(("Shopkeeper"))

node_shopkeeper -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_billing
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_settings_page
node_dashboard -->|"opens"| node_product_forms
node_dashboard -->|"opens"| node_category_form
node_dashboard -->|"syncs batches"| node_batch_logic
node_dashboard -->|"sorts products"| node_product_logic
node_dashboard -->|"reads settings"| node_settings_hook
node_dashboard -->|"persists inventory"| node_storage_hook
node_billing -->|"reads settings"| node_settings_hook
node_billing -->|"deducts FEFO"| node_batch_logic
node_billing -->|"stores sales"| node_storage_hook
node_stock_card -->|"shows batches"| node_batch_management
node_stock_card -->|"opens adjustment"| node_stock_adjustment
node_stock_card -->|"syncs batches"| node_batch_logic
node_stock_card -->|"checks thresholds"| node_settings_hook
node_settings_page -->|"updates settings"| node_settings_hook
node_settings_hook -->|"persists settings"| node_storage_hook
node_storage_hook -->|"reads and writes"| node_local_storage
node_history -.->|"reviews records"| node_storage_hook
node_expiry_alerts -.->|"alerts dashboard"| node_dashboard

click node_app "https://github.com/aryansingh257/inven3/blob/main/src/App.tsx"
click node_dashboard "https://github.com/aryansingh257/inven3/blob/main/src/pages/Index.tsx"
click node_billing "https://github.com/aryansingh257/inven3/blob/main/src/pages/Billing.tsx"
click node_history "https://github.com/aryansingh257/inven3/blob/main/src/pages/SalesHistory.tsx"
click node_settings_page "https://github.com/aryansingh257/inven3/blob/main/src/pages/Settings.tsx"
click node_product_forms "https://github.com/aryansingh257/inven3/blob/main/src/components/AddProductForm.tsx"
click node_category_form "https://github.com/aryansingh257/inven3/blob/main/src/components/AddCategoryForm.tsx"
click node_stock_card "https://github.com/aryansingh257/inven3/blob/main/src/components/StockProductCard.tsx"
click node_batch_management "https://github.com/aryansingh257/inven3/blob/main/src/components/BatchManagement.tsx"
click node_stock_adjustment "https://github.com/aryansingh257/inven3/blob/main/src/components/StockAdjustmentDialog.tsx"
click node_expiry_alerts "https://github.com/aryansingh257/inven3/blob/main/src/components/ExpiringProductsDialog.tsx"
click node_batch_logic "https://github.com/aryansingh257/inven3/blob/main/src/utils/batchHelpers.ts"
click node_product_logic "https://github.com/aryansingh257/inven3/blob/main/src/utils/productHelpers.ts"
click node_settings_hook "https://github.com/aryansingh257/inven3/blob/main/src/hooks/useSettings.ts"
click node_storage_hook "https://github.com/aryansingh257/inven3/blob/main/src/hooks/useLocalStorage.ts"
click node_sale_types "https://github.com/aryansingh257/inven3/blob/main/src/types/sale.ts"
click node_product_types "https://github.com/aryansingh257/inven3/blob/main/src/types/product.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_settings_page toneBlue
class node_dashboard,node_product_forms,node_category_form,node_stock_card,node_batch_management,node_stock_adjustment,node_expiry_alerts,node_batch_logic,node_product_logic,node_product_types toneAmber
class node_billing,node_history,node_sale_types toneMint
class node_settings_hook,node_storage_hook,node_local_storage toneRose
class node_shopkeeper toneIndigo
```

## Components

### App navigation

- [App router](https://github.com/aryansingh257/inven3/blob/main/src/App.tsx): `src/App.tsx`
- [Settings page](https://github.com/aryansingh257/inven3/blob/main/src/pages/Settings.tsx): `src/pages/Settings.tsx`

### Inventory management

- [Product dashboard](https://github.com/aryansingh257/inven3/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Product forms](https://github.com/aryansingh257/inven3/blob/main/src/components/AddProductForm.tsx): `src/components/AddProductForm.tsx`
- [Category form](https://github.com/aryansingh257/inven3/blob/main/src/components/AddCategoryForm.tsx): `src/components/AddCategoryForm.tsx`
- [Stock card](https://github.com/aryansingh257/inven3/blob/main/src/components/StockProductCard.tsx): `src/components/StockProductCard.tsx`
- [Batch management](https://github.com/aryansingh257/inven3/blob/main/src/components/BatchManagement.tsx): `src/components/BatchManagement.tsx`
- [Stock adjustment](https://github.com/aryansingh257/inven3/blob/main/src/components/StockAdjustmentDialog.tsx): `src/components/StockAdjustmentDialog.tsx`
- [Expiry alerts](https://github.com/aryansingh257/inven3/blob/main/src/components/ExpiringProductsDialog.tsx): `src/components/ExpiringProductsDialog.tsx`
- [Batch calculations](https://github.com/aryansingh257/inven3/blob/main/src/utils/batchHelpers.ts): `src/utils/batchHelpers.ts`
- [Product filtering](https://github.com/aryansingh257/inven3/blob/main/src/utils/productHelpers.ts): `src/utils/productHelpers.ts`
- [Product and batch data](https://github.com/aryansingh257/inven3/blob/main/src/types/product.ts): `src/types/product.ts`

### Billing and history

- [POS billing](https://github.com/aryansingh257/inven3/blob/main/src/pages/Billing.tsx): `src/pages/Billing.tsx`
- [Sales history](https://github.com/aryansingh257/inven3/blob/main/src/pages/SalesHistory.tsx): `src/pages/SalesHistory.tsx`
- [Sale records](https://github.com/aryansingh257/inven3/blob/main/src/types/sale.ts): `src/types/sale.ts`

### Local state

- [Settings hook](https://github.com/aryansingh257/inven3/blob/main/src/hooks/useSettings.ts): `src/hooks/useSettings.ts`
- [Storage hook](https://github.com/aryansingh257/inven3/blob/main/src/hooks/useLocalStorage.ts): `src/hooks/useLocalStorage.ts`
- **Browser storage**

### Other components

- **Shopkeeper**

## Connections

- Shopkeeper → App router: uses
- App router → Product dashboard: routes to
- App router → POS billing: routes to
- App router → Sales history: routes to
- App router → Settings page: routes to
- Product dashboard → Product forms: opens
- Product dashboard → Category form: opens
- Product dashboard → Batch calculations: syncs batches
- Product dashboard → Product filtering: sorts products
- Product dashboard → Settings hook: reads settings
- Product dashboard → Storage hook: persists inventory
- POS billing → Settings hook: reads settings
- POS billing → Batch calculations: deducts FEFO
- POS billing → Storage hook: stores sales
- Stock card → Batch management: shows batches
- Stock card → Stock adjustment: opens adjustment
- Stock card → Batch calculations: syncs batches
- Stock card → Settings hook: checks thresholds
- Settings page → Settings hook: updates settings
- Settings hook → Storage hook: persists settings
- Storage hook → Browser storage: reads and writes
- Sales history → Storage hook: reviews records
- Expiry alerts → Product dashboard: alerts dashboard
