# houda-farrag/pos-system architecture

> Architecture diagram of the GitHub repository houda-farrag/pos-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/houda-farrag/pos-system
- Repository: https://github.com/houda-farrag/pos-system

## Overview

ReactPOS is a desktop point-of-sale and inventory application built with a React interface inside Electron, with SQLite-backed operations. The main workflow is a user signing in, navigating permission-gated sales and management screens, and using the API bridge to request application data or actions. The interface also includes purchasing, receiving, supplier payments, reporting, audit, and user administration. The excerpts show the application routing, invoice listing logic, Electron startup, and selected IPC handlers; connections from other screens into the API are not drawn where call evidence was not shown.

Main entry points: [`src/App.tsx`](https://github.com/houda-farrag/pos-system/blob/main/src/App.tsx) (App routing), [`src/api.ts`](https://github.com/houda-farrag/pos-system/blob/main/src/api.ts) (Frontend API), [`electron/main.cjs`](https://github.com/houda-farrag/pos-system/blob/main/electron/main.cjs) (Electron IPC handlers), [`electron/sqlite.cjs`](https://github.com/houda-farrag/pos-system/blob/main/electron/sqlite.cjs) (SQLite operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_app["App routing<br/>[App.tsx]"]
  node_layout["Application layout<br/>[Layout.tsx]"]
  node_modal["Global modal<br/>[GlobalModal.tsx]"]
  node_login["Sign in<br/>[LoginPage.tsx]"]
end

subgraph group_sales["Sales and inventory"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_pos["Point of sale<br/>[PosPage.tsx]"]
  node_products["Products<br/>[ProductsPage.tsx]"]
  node_invoices["Invoices<br/>[InvoicesPage.tsx]"]
  node_invoice_logic["Invoice logic<br/>[invoiceLogic.ts]"]
  node_invoice_details["Invoice details<br/>[InvoiceDetails.tsx]"]
end

subgraph group_purchases["Purchasing"]
  node_suppliers["Suppliers<br/>[SuppliersPage.tsx]"]
  node_purchase_orders["Purchase orders"]
  node_receiving["Goods receiving"]
  node_supplier_payments["Supplier payments"]
end

subgraph group_platform["Application services"]
  node_api["Frontend API<br/>[api.ts]"]
  node_preload["Electron preload bridge<br/>[preload.cjs]"]
  node_main["Electron IPC handlers<br/>[main.cjs]"]
  node_sqlite[("SQLite operations<br/>[sqlite.cjs]")]
  node_users["User administration"]
  node_audit["Audit log<br/>[AuditLogPage.tsx]"]
end

node_operator(("Store operator"))

node_operator -->|"uses"| node_app
node_app -->|"shows signed out"| node_login
node_app -->|"renders"| node_layout
node_app -->|"renders"| node_modal
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_pos
node_app -->|"routes to"| node_products
node_app -->|"routes to"| node_invoices
node_app -->|"routes to"| node_suppliers
node_app -->|"routes to"| node_purchase_orders
node_app -->|"routes to"| node_receiving
node_app -->|"routes to"| node_supplier_payments
node_app -->|"routes to"| node_users
node_app -->|"routes to"| node_audit
node_invoices -->|"uses"| node_invoice_logic
node_invoice_logic -->|"requests invoices"| node_api
node_invoice_details -->|"loads details"| node_api
node_app -->|"restores session"| node_api
node_api -->|"calls bridge"| node_preload
node_main -->|"configures"| node_preload
node_main -->|"dispatches handlers"| node_sqlite
node_main -->|"initializes"| node_sqlite
node_sqlite -->|"uses password utilities"| node_users

click node_app "https://github.com/houda-farrag/pos-system/blob/main/src/App.tsx"
click node_layout "https://github.com/houda-farrag/pos-system/blob/main/src/components/Layout.tsx"
click node_modal "https://github.com/houda-farrag/pos-system/blob/main/src/components/GlobalModal.tsx"
click node_login "https://github.com/houda-farrag/pos-system/blob/main/src/pages/LoginPage.tsx"
click node_dashboard "https://github.com/houda-farrag/pos-system/blob/main/src/pages/DashboardPage.tsx"
click node_pos "https://github.com/houda-farrag/pos-system/blob/main/src/pages/PosPage.tsx"
click node_products "https://github.com/houda-farrag/pos-system/blob/main/src/pages/ProductsPage.tsx"
click node_invoices "https://github.com/houda-farrag/pos-system/blob/main/src/pages/InvoicesPage.tsx"
click node_invoice_logic "https://github.com/houda-farrag/pos-system/blob/main/src/services/invoiceLogic.ts"
click node_invoice_details "https://github.com/houda-farrag/pos-system/blob/main/src/components/InvoiceDetails.tsx"
click node_suppliers "https://github.com/houda-farrag/pos-system/blob/main/src/pages/SuppliersPage.tsx"
click node_purchase_orders "https://github.com/houda-farrag/pos-system/blob/main/src/pages/PurchaseOrdersPage.tsx"
click node_receiving "https://github.com/houda-farrag/pos-system/blob/main/src/pages/GoodsReceivingPage.tsx"
click node_supplier_payments "https://github.com/houda-farrag/pos-system/blob/main/src/pages/SupplierPaymentsPage.tsx"
click node_api "https://github.com/houda-farrag/pos-system/blob/main/src/api.ts"
click node_preload "https://github.com/houda-farrag/pos-system/blob/main/electron/preload.cjs"
click node_main "https://github.com/houda-farrag/pos-system/blob/main/electron/main.cjs"
click node_sqlite "https://github.com/houda-farrag/pos-system/blob/main/electron/sqlite.cjs"
click node_users "https://github.com/houda-farrag/pos-system/blob/main/src/pages/UserManagementPage.tsx"
click node_audit "https://github.com/houda-farrag/pos-system/blob/main/src/pages/AuditLogPage.tsx"

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_layout,node_modal,node_login toneBlue
class node_dashboard,node_pos,node_products,node_invoices,node_invoice_logic,node_invoice_details toneAmber
class node_suppliers,node_purchase_orders,node_receiving,node_supplier_payments toneMint
class node_api,node_preload,node_main,node_sqlite,node_users,node_audit toneRose
class node_operator toneIndigo
```

## Components

### Desktop interface

- [App routing](https://github.com/houda-farrag/pos-system/blob/main/src/App.tsx): `src/App.tsx`
- [Application layout](https://github.com/houda-farrag/pos-system/blob/main/src/components/Layout.tsx): `src/components/Layout.tsx`
- [Global modal](https://github.com/houda-farrag/pos-system/blob/main/src/components/GlobalModal.tsx): `src/components/GlobalModal.tsx`
- [Sign in](https://github.com/houda-farrag/pos-system/blob/main/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`

### Sales and inventory

- [Dashboard](https://github.com/houda-farrag/pos-system/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Point of sale](https://github.com/houda-farrag/pos-system/blob/main/src/pages/PosPage.tsx): `src/pages/PosPage.tsx`
- [Products](https://github.com/houda-farrag/pos-system/blob/main/src/pages/ProductsPage.tsx): `src/pages/ProductsPage.tsx`
- [Invoices](https://github.com/houda-farrag/pos-system/blob/main/src/pages/InvoicesPage.tsx): `src/pages/InvoicesPage.tsx`
- [Invoice logic](https://github.com/houda-farrag/pos-system/blob/main/src/services/invoiceLogic.ts): `src/services/invoiceLogic.ts`
- [Invoice details](https://github.com/houda-farrag/pos-system/blob/main/src/components/InvoiceDetails.tsx): `src/components/InvoiceDetails.tsx`

### Purchasing

- [Suppliers](https://github.com/houda-farrag/pos-system/blob/main/src/pages/SuppliersPage.tsx): `src/pages/SuppliersPage.tsx`
- [Purchase orders](https://github.com/houda-farrag/pos-system/blob/main/src/pages/PurchaseOrdersPage.tsx): `src/pages/PurchaseOrdersPage.tsx`
- [Goods receiving](https://github.com/houda-farrag/pos-system/blob/main/src/pages/GoodsReceivingPage.tsx): `src/pages/GoodsReceivingPage.tsx`
- [Supplier payments](https://github.com/houda-farrag/pos-system/blob/main/src/pages/SupplierPaymentsPage.tsx): `src/pages/SupplierPaymentsPage.tsx`

### Application services

- [Frontend API](https://github.com/houda-farrag/pos-system/blob/main/src/api.ts): `src/api.ts`
- [Electron preload bridge](https://github.com/houda-farrag/pos-system/blob/main/electron/preload.cjs): `electron/preload.cjs`
- [Electron IPC handlers](https://github.com/houda-farrag/pos-system/blob/main/electron/main.cjs): `electron/main.cjs`
- [SQLite operations](https://github.com/houda-farrag/pos-system/blob/main/electron/sqlite.cjs): `electron/sqlite.cjs`
- [User administration](https://github.com/houda-farrag/pos-system/blob/main/src/pages/UserManagementPage.tsx): `src/pages/UserManagementPage.tsx`
- [Audit log](https://github.com/houda-farrag/pos-system/blob/main/src/pages/AuditLogPage.tsx): `src/pages/AuditLogPage.tsx`

### Other components

- **Store operator**

## Connections

- Store operator → App routing: uses (evidence: `src/App.tsx`)
- App routing → Sign in: shows signed out (evidence: `src/App.tsx`)
- App routing → Application layout: renders (evidence: `src/App.tsx`)
- App routing → Global modal: renders (evidence: `src/App.tsx`)
- App routing → Dashboard: routes to (evidence: `src/App.tsx`)
- App routing → Point of sale: routes to (evidence: `src/App.tsx`)
- App routing → Products: routes to (evidence: `src/App.tsx`)
- App routing → Invoices: routes to (evidence: `src/App.tsx`)
- App routing → Suppliers: routes to (evidence: `src/App.tsx`)
- App routing → Purchase orders: routes to (evidence: `src/App.tsx`)
- App routing → Goods receiving: routes to (evidence: `src/App.tsx`)
- App routing → Supplier payments: routes to (evidence: `src/App.tsx`)
- App routing → User administration: routes to (evidence: `src/App.tsx`)
- App routing → Audit log: routes to (evidence: `src/App.tsx`)
- Invoices → Invoice logic: uses (evidence: `src/pages/InvoicesPage.tsx`)
- Invoice logic → Frontend API: requests invoices (evidence: `src/services/invoiceLogic.ts`)
- Invoice details → Frontend API: loads details (evidence: `src/components/InvoiceDetails.tsx`)
- App routing → Frontend API: restores session (evidence: `src/App.tsx`)
- Frontend API → Electron preload bridge: calls bridge (evidence: `src/api.ts`)
- Electron IPC handlers → Electron preload bridge: configures (evidence: `electron/main.cjs`)
- Electron IPC handlers → SQLite operations: dispatches handlers (evidence: `electron/main.cjs`)
- Electron IPC handlers → SQLite operations: initializes (evidence: `electron/main.cjs`)
- SQLite operations → User administration: uses password utilities (evidence: `electron/sqlite.cjs`)
