# rohitmunger1989/posnext-retail architecture

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

- Interactive diagram: https://gitdiagram.com/rohitmunger1989/posnext-retail
- Repository: https://github.com/rohitmunger1989/posnext-retail

## Overview

POS Next is an ERPNext point-of-sale application with a Vue client and Frappe server APIs. The primary workflow is cashier sign-in, item search and cart preparation, promotion and payment selection, invoice submission, and receipt printing; it also supports returns, shifts, offline sales, drafts, and customer display. The graph combines documented product capabilities with relationships visible in the supplied excerpts and source index. Several feature implementations were not sampled, so those connections are intentionally left out rather than inferred.

Main entry points: [`POS/src/pages/POSSale.vue`](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/pages/POSSale.vue) (Sales workspace), [`pos_next/api/invoices.py`](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/invoices.py) (Invoice processing), [`pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.py`](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.py) (Wallet transactions), [`POS/src/workers/offline.worker.js`](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/workers/offline.worker.js) (Offline worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["POS client"]
  node_app["App initialization<br/>[main.js]"]
  node_routing["Authentication routing<br/>[router.js]"]
  node_sale["Sales workspace<br/>[POSSale.vue]"]
  node_catalog["Item search<br/>[itemSearch.js]"]
  node_cart["Cart state<br/>[posCart.js]"]
  node_checkout["Payment and checkout<br/>[PaymentDialog.vue]"]
  node_drafts[("Draft invoices<br/>[draftManager.js]")]
  node_returns["Returns interface"]
  node_shift["Shift workflow<br/>[useShift.js]"]
  node_customer_display["Customer display"]
end

subgraph group_offline["Offline capability"]
  node_offline_client["Offline worker client<br/>[workerClient.js]"]
  node_offline_state["Offline state<br/>[offlineState.js]"]
  node_offline_worker["Offline worker<br/>[offline.worker.js]"]
end

subgraph group_server["POS server"]
  node_invoice_api["Invoice processing<br/>[invoices.py]"]
  node_returns_api["Return processing<br/>[retail_returns.py]"]
  node_credit_api["Credit sales<br/>[credit_sales.py]"]
  node_wallet_api["Wallet services<br/>[wallet.py]"]
end

subgraph group_domain["ERP domain"]
  node_coupon["Coupon rules<br/>[pos_coupon.py]"]
  node_pricing["Pricing rules<br/>[pricing_rule.py]"]
  node_wallet_tx["Wallet transactions"]
end

node_cashier(("Cashier"))
node_erpnext[("ERPNext accounting and stock")]

node_cashier -->|"opens POS"| node_app
node_app -->|"initializes router"| node_routing
node_routing -->|"routes to"| node_sale
node_cashier -->|"searches and sells"| node_sale
node_sale -.->|"searches items"| node_catalog
node_sale -.->|"updates cart"| node_cart
node_sale -->|"starts checkout"| node_checkout
node_sale -->|"saves drafts"| node_drafts
node_sale -->|"starts returns"| node_returns
node_sale -->|"manages shifts"| node_shift
node_cashier -.->|"opens display"| node_customer_display
node_offline_client -->|"reads state"| node_offline_state
node_offline_worker -.->|"updates state"| node_offline_state
node_offline_worker -.->|"queues invoices for sync"| node_invoice_api
node_checkout -.->|"submits invoice"| node_invoice_api
node_returns -.->|"requests return"| node_returns_api
node_invoice_api -->|"uses credit processing"| node_credit_api
node_invoice_api -->|"uses return helpers"| node_returns_api
node_invoice_api -->|"checks coupon rules"| node_coupon
node_invoice_api -->|"uses wallet transactions"| node_wallet_tx
node_wallet_tx -->|"gets wallet service"| node_wallet_api
node_wallet_tx -->|"posts ledger entries"| node_erpnext
node_pricing -->|"extends pricing rules"| node_erpnext

click node_app "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/main.js"
click node_routing "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/router.js"
click node_sale "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/pages/POSSale.vue"
click node_catalog "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/stores/itemSearch.js"
click node_cart "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/stores/posCart.js"
click node_checkout "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/components/sale/PaymentDialog.vue"
click node_drafts "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/utils/draftManager.js"
click node_returns "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/components/sale/ReturnInvoiceDialog.vue"
click node_shift "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/composables/useShift.js"
click node_customer_display "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/pages/CustomerDisplay.vue"
click node_offline_client "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/utils/offline/workerClient.js"
click node_offline_state "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/utils/offline/offlineState.js"
click node_offline_worker "https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/workers/offline.worker.js"
click node_invoice_api "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/invoices.py"
click node_returns_api "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/retail_returns.py"
click node_credit_api "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/credit_sales.py"
click node_wallet_api "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/wallet.py"
click node_coupon "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/pos_next/doctype/pos_coupon/pos_coupon.py"
click node_pricing "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/overrides/pricing_rule.py"
click node_wallet_tx "https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.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_app,node_routing,node_sale,node_catalog,node_cart,node_checkout,node_drafts,node_returns,node_shift,node_customer_display toneBlue
class node_offline_client,node_offline_state,node_offline_worker,node_erpnext toneAmber
class node_invoice_api,node_returns_api,node_credit_api,node_wallet_api toneMint
class node_coupon,node_pricing,node_wallet_tx toneRose
class node_cashier toneIndigo
```

## Components

### POS client

- [App initialization](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/main.js): `POS/src/main.js`
- [Authentication routing](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/router.js): `POS/src/router.js`
- [Sales workspace](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/pages/POSSale.vue): `POS/src/pages/POSSale.vue`
- [Item search](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/stores/itemSearch.js): `POS/src/stores/itemSearch.js`
- [Cart state](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/stores/posCart.js): `POS/src/stores/posCart.js`
- [Payment and checkout](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/components/sale/PaymentDialog.vue): `POS/src/components/sale/PaymentDialog.vue`
- [Draft invoices](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/utils/draftManager.js): `POS/src/utils/draftManager.js`
- [Returns interface](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/components/sale/ReturnInvoiceDialog.vue): `POS/src/components/sale/ReturnInvoiceDialog.vue`
- [Shift workflow](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/composables/useShift.js): `POS/src/composables/useShift.js`
- [Customer display](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/pages/CustomerDisplay.vue): `POS/src/pages/CustomerDisplay.vue`

### Offline capability

- [Offline worker client](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/utils/offline/workerClient.js): `POS/src/utils/offline/workerClient.js`
- [Offline state](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/utils/offline/offlineState.js): `POS/src/utils/offline/offlineState.js`
- [Offline worker](https://github.com/rohitmunger1989/posnext-retail/blob/main/POS/src/workers/offline.worker.js): `POS/src/workers/offline.worker.js`

### POS server

- [Invoice processing](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/invoices.py): `pos_next/api/invoices.py`
- [Return processing](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/retail_returns.py): `pos_next/api/retail_returns.py`
- [Credit sales](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/credit_sales.py): `pos_next/api/credit_sales.py`
- [Wallet services](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/api/wallet.py): `pos_next/api/wallet.py`

### ERP domain

- [Coupon rules](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/pos_next/doctype/pos_coupon/pos_coupon.py): `pos_next/pos_next/doctype/pos_coupon/pos_coupon.py`
- [Pricing rules](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/overrides/pricing_rule.py): `pos_next/overrides/pricing_rule.py`
- [Wallet transactions](https://github.com/rohitmunger1989/posnext-retail/blob/main/pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.py): `pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.py`

### Other components

- **Cashier**
- **ERPNext accounting and stock**

## Connections

- Cashier → App initialization: opens POS (evidence: `README.md`)
- App initialization → Authentication routing: initializes router (evidence: `POS/src/main.js`)
- Authentication routing → Sales workspace: routes to (evidence: `POS/src/router.js`)
- Cashier → Sales workspace: searches and sells (evidence: `README.md`)
- Sales workspace → Item search: searches items
- Sales workspace → Cart state: updates cart
- Sales workspace → Payment and checkout: starts checkout (evidence: `README.md`)
- Sales workspace → Draft invoices: saves drafts (evidence: `README.md`)
- Sales workspace → Returns interface: starts returns (evidence: `README.md`)
- Sales workspace → Shift workflow: manages shifts (evidence: `README.md`)
- Cashier → Customer display: opens display
- Offline worker client → Offline state: reads state (evidence: `POS/src/utils/offline/workerClient.js`)
- Offline worker → Offline state: updates state
- Offline worker → Invoice processing: queues invoices for sync
- Payment and checkout → Invoice processing: submits invoice
- Returns interface → Return processing: requests return
- Invoice processing → Credit sales: uses credit processing (evidence: `pos_next/api/invoices.py`)
- Invoice processing → Return processing: uses return helpers (evidence: `pos_next/api/invoices.py`)
- Invoice processing → Coupon rules: checks coupon rules (evidence: `pos_next/api/invoices.py`)
- Invoice processing → Wallet transactions: uses wallet transactions (evidence: `pos_next/api/invoices.py`)
- Wallet transactions → Wallet services: gets wallet service (evidence: `pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.py`)
- Wallet transactions → ERPNext accounting and stock: posts ledger entries (evidence: `pos_next/pos_next/doctype/wallet_transaction/wallet_transaction.py`)
- Pricing rules → ERPNext accounting and stock: extends pricing rules (evidence: `pos_next/overrides/pricing_rule.py`)
