# krishna199766-arch/essa-master-final architecture

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

- Interactive diagram: https://gitdiagram.com/krishna199766-arch/essa-master-final
- Repository: https://github.com/krishna199766-arch/essa-master-final

## Overview

Essa is a textile-warehouse system centered on turning supplier invoices into validated purchase receipts and inventory. Its main workflow is invoice upload, supplier-aware extraction and confirmation, GRN posting, then stock and cost updates. The desktop also supports transport registers, stock movement, returns, supplier payments, pricing, and reports; the warehouse phone app handles consignment receipt and bundle breakdown. The graph combines README-documented capabilities with sampled API, extraction, storage, and model structure; unsampled feature internals are represented at their existing router-directory paths.

Main entry points: [`backend/app/routers/documents.py`](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/documents.py) (Document intake), [`backend/app/main.py`](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/main.py) (API application), [`backend/app/database.py`](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/database.py) (Warehouse database), [`backend/app/routers/purchases.py`](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/purchases.py) (Purchases & GRN)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Document intake"]
  node_documents["Document intake<br/>[documents.py]"]
  node_extraction["Extraction engine<br/>[engine.py]"]
  node_profiles[("Supplier profiles<br/>[models.py]")]
end

subgraph group_warehouse["Warehouse operations"]
  node_lr["LR register<br/>[lr.py]"]
  node_grn["Purchases &amp; GRN<br/>[purchases.py]"]
  node_bundles["Bundle breakdown<br/>[bundles.py]"]
  node_inventory["Inventory &amp; costing<br/>[inventory.py]"]
  node_outward["Stock outward / inward<br/>[outward.py]"]
end

subgraph group_accounts["Purchasing &amp; accounts"]
  node_returns["Returns &amp; shortages<br/>[returns.py]"]
  node_payments["Supplier payments<br/>[payments.py]"]
  node_pricing["Price changer<br/>[pricing.py]"]
  node_reports["Reports &amp; questions<br/>[reports.py]"]
end

subgraph group_interfaces["User interfaces"]
  node_desktop["Desktop app<br/>[App.jsx]"]
  node_mobile["Warehouse phone app<br/>[App.js]"]
end

subgraph group_platform["Shared platform"]
  node_api["API application<br/>[main.py]"]
  node_storage["Document storage<br/>[storage.py]"]
  node_masters["Suppliers &amp; masters<br/>[suppliers.py]"]
  node_database[("Warehouse database<br/>[database.py]")]
  node_auth["Authentication &amp; permissions<br/>[auth.py]"]
end

node_staff(("Warehouse staff"))

node_staff -->|"uses"| node_desktop
node_staff -->|"uses"| node_mobile
node_desktop -->|"operates"| node_api
node_mobile -->|"connects to"| node_api
node_api -->|"routes requests"| node_documents
node_documents -->|"runs extraction"| node_extraction
node_extraction -->|"learns supplier format"| node_profiles
node_documents -->|"stores uploads"| node_storage
node_documents -->|"uses supplier data"| node_masters
node_documents -->|"confirmed invoice to GRN"| node_grn
node_staff -->|"records consignments"| node_lr
node_staff -->|"details received sizes"| node_bundles
node_grn -->|"posts stock"| node_inventory
node_bundles -->|"creates variant stock"| node_inventory
node_staff -->|"dispatches and receives stock"| node_outward
node_staff -->|"claims returns or shortages"| node_returns
node_staff -->|"settles supplier bills"| node_payments
node_staff -->|"revises selling prices"| node_pricing
node_staff -->|"requests reports"| node_reports
node_api -->|"serves sign-in"| node_auth
node_auth -->|"checks user records"| node_database
node_api -->|"uses sessions"| node_database
node_grn -.->|"records receipt"| node_database
node_inventory -.->|"records stock ledger"| node_database

click node_desktop "https://github.com/krishna199766-arch/essa-master-final/blob/main/frontend/src/App.jsx"
click node_mobile "https://github.com/krishna199766-arch/essa-master-final/blob/main/mobile-app/App.js"
click node_api "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/main.py"
click node_documents "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/documents.py"
click node_extraction "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/extraction/engine.py"
click node_profiles "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/models.py"
click node_storage "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/services/storage.py"
click node_lr "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/lr.py"
click node_grn "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/purchases.py"
click node_bundles "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/bundles.py"
click node_inventory "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/inventory.py"
click node_outward "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/outward.py"
click node_returns "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/returns.py"
click node_payments "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/payments.py"
click node_pricing "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/pricing.py"
click node_reports "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/reports.py"
click node_masters "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/suppliers.py"
click node_database "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/database.py"
click node_auth "https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/auth.py"

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_documents,node_extraction,node_profiles toneBlue
class node_lr,node_grn,node_bundles,node_inventory,node_outward toneAmber
class node_returns,node_payments,node_pricing,node_reports toneMint
class node_desktop,node_mobile toneRose
class node_api,node_storage,node_masters,node_database,node_auth,node_staff toneIndigo
```

## Components

### Document intake

- [Document intake](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/documents.py): `backend/app/routers/documents.py`
- [Extraction engine](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/extraction/engine.py): `backend/app/extraction/engine.py`
- [Supplier profiles](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/models.py): `backend/app/models.py`

### Warehouse operations

- [LR register](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/lr.py): `backend/app/routers/lr.py`
- [Purchases & GRN](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/purchases.py): `backend/app/routers/purchases.py`
- [Bundle breakdown](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/bundles.py): `backend/app/routers/bundles.py`
- [Inventory & costing](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/inventory.py): `backend/app/routers/inventory.py`
- [Stock outward / inward](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/outward.py): `backend/app/routers/outward.py`

### Purchasing & accounts

- [Returns & shortages](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/returns.py): `backend/app/routers/returns.py`
- [Supplier payments](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/payments.py): `backend/app/routers/payments.py`
- [Price changer](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/pricing.py): `backend/app/routers/pricing.py`
- [Reports & questions](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/reports.py): `backend/app/routers/reports.py`

### User interfaces

- [Desktop app](https://github.com/krishna199766-arch/essa-master-final/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Warehouse phone app](https://github.com/krishna199766-arch/essa-master-final/blob/main/mobile-app/App.js): `mobile-app/App.js`

### Shared platform

- [API application](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/main.py): `backend/app/main.py`
- [Document storage](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/services/storage.py): `backend/app/services/storage.py`
- [Suppliers & masters](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/suppliers.py): `backend/app/routers/suppliers.py`
- [Warehouse database](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/database.py): `backend/app/database.py`
- [Authentication & permissions](https://github.com/krishna199766-arch/essa-master-final/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`

### Other components

- **Warehouse staff**

## Connections

- Warehouse staff → Desktop app: uses
- Warehouse staff → Warehouse phone app: uses
- Desktop app → API application: operates
- Warehouse phone app → API application: connects to
- API application → Document intake: routes requests (evidence: `backend/app/main.py`)
- Document intake → Extraction engine: runs extraction (evidence: `backend/app/routers/documents.py`)
- Extraction engine → Supplier profiles: learns supplier format (evidence: `backend/app/extraction/engine.py`)
- Document intake → Document storage: stores uploads (evidence: `backend/app/routers/documents.py`)
- Document intake → Suppliers & masters: uses supplier data (evidence: `backend/app/routers/documents.py`)
- Document intake → Purchases & GRN: confirmed invoice to GRN
- Warehouse staff → LR register: records consignments
- Warehouse staff → Bundle breakdown: details received sizes
- Purchases & GRN → Inventory & costing: posts stock
- Bundle breakdown → Inventory & costing: creates variant stock (evidence: `backend/app/routers/inventory.py`)
- Warehouse staff → Stock outward / inward: dispatches and receives stock
- Warehouse staff → Returns & shortages: claims returns or shortages
- Warehouse staff → Supplier payments: settles supplier bills
- Warehouse staff → Price changer: revises selling prices
- Warehouse staff → Reports & questions: requests reports
- API application → Authentication & permissions: serves sign-in (evidence: `backend/app/main.py`)
- Authentication & permissions → Warehouse database: checks user records (evidence: `backend/app/routers/auth.py`)
- API application → Warehouse database: uses sessions (evidence: `backend/app/main.py`)
- Purchases & GRN → Warehouse database: records receipt
- Inventory & costing → Warehouse database: records stock ledger (evidence: `backend/app/routers/inventory.py`)
