# kavampallyharishkumar-art/smallshop-pos architecture

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

- Interactive diagram: https://gitdiagram.com/kavampallyharishkumar-art/smallshop-pos
- Repository: https://github.com/kavampallyharishkumar-art/smallshop-pos

## Overview

Small Shop POS is a browser-based point-of-sale and shop-management application. A cashier signs in, selects products and optionally a customer at the register, submits a sale, and receives a receipt; administrators also manage catalog, staff, and stock, while users review sales and reports. The client API wrapper connects these screens to the Express API, whose routed controllers validate and authorize requests and persist operational data in SQLite. The tree and excerpts support the sale, catalog, authentication, and reporting domains; README is empty, so unsampled page details and route wiring are represented conservatively.

Main entry points: [`client/src/api/client.js`](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/api/client.js) (API Client), [`server/src/db/connection.js`](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/db/connection.js) (SQLite Store), [`server/src/controllers/sale.controller.js`](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/sale.controller.js) (Sale Processing), [`server/src/middleware/auth.js`](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/auth.js) (Access Control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["POS Client"]
  node_app["App Shell<br/>[App.jsx]"]
  node_authstate["Session State<br/>[AuthContext.jsx]"]
  node_login["Sign In<br/>[LoginPage.jsx]"]
  node_register["POS Register<br/>[POSRegister.jsx]"]
  node_receipt["Receipt View<br/>[ReceiptModal.jsx]"]
  node_catalogui["Catalog Screens<br/>[ProductsPage.jsx]"]
  node_categoriesui["Category Screen<br/>[CategoriesPage.jsx]"]
  node_customersui["Customer Screen<br/>[CustomersPage.jsx]"]
  node_salesui["Sales Screen<br/>[SalesPage.jsx]"]
  node_reportsui["Reports Screen<br/>[ReportsPage.jsx]"]
  node_usersui["Staff Screen<br/>[UsersPage.jsx]"]
end

subgraph group_api["API Boundary"]
  node_apiclient["API Client<br/>[client.js]"]
  node_http["HTTP API<br/>[app.js]"]
  node_authroutes["Auth Routes<br/>[auth.routes.js]"]
  node_productroutes["Product Routes<br/>[product.routes.js]"]
  node_customerroutes["Customer Routes<br/>[customer.routes.js]"]
  node_categoryroutes["Category Routes<br/>[category.routes.js]"]
  node_salesroutes["Sales Routes<br/>[sale.routes.js]"]
  node_reportroutes["Report Routes<br/>[report.routes.js]"]
end

subgraph group_operations["Shop Operations"]
  node_auth["Authentication<br/>[auth.controller.js]"]
  node_products["Product &amp; Stock"]
  node_categories["Categories"]
  node_customers["Customers"]
  node_sales["Sale Processing<br/>[sale.controller.js]"]
  node_reports["Sales Reporting"]
end

subgraph group_platform["Server Platform"]
  node_database[("SQLite Store<br/>[connection.js]")]
  node_validation["Request Validation<br/>[validate.js]"]
  node_authorization["Access Control<br/>[auth.js]"]
  node_errorhandling["Error Responses<br/>[errorHandler.js]"]
  node_pagination["Pagination<br/>[paginate.js]"]
  node_money["Money Rules<br/>[money.js]"]
  node_invoice["Invoice Counter<br/>[invoice.js]"]
end

node_cashier(("Cashier / Admin"))

node_cashier -->|"uses"| node_app
node_app -.->|"provides session"| node_authstate
node_authstate -->|"requests identity"| node_apiclient
node_login -.->|"signs in"| node_authstate
node_register -->|"submits sale"| node_apiclient
node_register -->|"renders receipt"| node_receipt
node_catalogui -->|"manages products"| node_apiclient
node_categoriesui -.->|"manages categories"| node_apiclient
node_customersui -.->|"manages customers"| node_apiclient
node_salesui -.->|"reviews sales"| node_apiclient
node_reportsui -->|"requests reports"| node_apiclient
node_usersui -.->|"manages staff"| node_apiclient
node_apiclient -->|"sends HTTP"| node_http
node_http -->|"mounts routes"| node_authroutes
node_authroutes -->|"dispatches"| node_auth
node_productroutes -->|"dispatches"| node_products
node_customerroutes -->|"dispatches"| node_customers
node_categoryroutes -->|"dispatches"| node_categories
node_salesroutes -->|"dispatches"| node_sales
node_reportroutes -.->|"dispatches"| node_reports
node_authroutes -->|"guards requests"| node_authorization
node_productroutes -->|"validates input"| node_validation
node_productroutes -->|"guards requests"| node_authorization
node_customerroutes -->|"validates input"| node_validation
node_customerroutes -->|"guards requests"| node_authorization
node_categoryroutes -->|"validates input"| node_validation
node_categoryroutes -->|"guards requests"| node_authorization
node_salesroutes -->|"guards requests"| node_authorization
node_auth -->|"reads and writes"| node_database
node_products -->|"reads and writes"| node_database
node_customers -->|"reads and writes"| node_database
node_categories -->|"reads and writes"| node_database
node_sales -->|"records transactions"| node_database
node_reports -->|"queries reports"| node_database
node_products -->|"paginates listings"| node_pagination
node_customers -->|"paginates listings"| node_pagination
node_sales -->|"paginates listings"| node_pagination
node_sales -->|"computes totals"| node_money
node_sales -->|"allocates number"| node_invoice
node_http -->|"handles errors"| node_errorhandling

click node_app "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/App.jsx"
click node_authstate "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/context/AuthContext.jsx"
click node_login "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/LoginPage.jsx"
click node_register "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/POSRegister.jsx"
click node_receipt "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/components/ReceiptModal.jsx"
click node_catalogui "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/ProductsPage.jsx"
click node_categoriesui "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/CategoriesPage.jsx"
click node_customersui "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/CustomersPage.jsx"
click node_salesui "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/SalesPage.jsx"
click node_reportsui "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/ReportsPage.jsx"
click node_usersui "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/UsersPage.jsx"
click node_apiclient "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/api/client.js"
click node_http "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/app.js"
click node_authroutes "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/auth.routes.js"
click node_productroutes "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/product.routes.js"
click node_customerroutes "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/customer.routes.js"
click node_categoryroutes "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/category.routes.js"
click node_salesroutes "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/sale.routes.js"
click node_reportroutes "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/report.routes.js"
click node_auth "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/auth.controller.js"
click node_products "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/product.controller.js"
click node_categories "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/category.controller.js"
click node_customers "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/customer.controller.js"
click node_sales "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/sale.controller.js"
click node_reports "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/report.controller.js"
click node_database "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/db/connection.js"
click node_validation "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/validate.js"
click node_authorization "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/auth.js"
click node_errorhandling "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/errorHandler.js"
click node_pagination "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/utils/paginate.js"
click node_money "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/utils/money.js"
click node_invoice "https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/utils/invoice.js"

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_authstate,node_login,node_register,node_receipt,node_catalogui,node_categoriesui,node_customersui,node_salesui,node_reportsui,node_usersui toneBlue
class node_apiclient,node_http,node_authroutes,node_productroutes,node_customerroutes,node_categoryroutes,node_salesroutes,node_reportroutes toneAmber
class node_auth,node_products,node_categories,node_customers,node_sales,node_reports toneMint
class node_database,node_validation,node_authorization,node_errorhandling,node_pagination,node_money,node_invoice toneRose
class node_cashier toneIndigo
```

## Components

### POS Client

- [App Shell](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session State](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Sign In](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/LoginPage.jsx): `client/src/pages/LoginPage.jsx`
- [POS Register](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/POSRegister.jsx): `client/src/pages/POSRegister.jsx`
- [Receipt View](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/components/ReceiptModal.jsx): `client/src/components/ReceiptModal.jsx`
- [Catalog Screens](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/ProductsPage.jsx): `client/src/pages/ProductsPage.jsx`
- [Category Screen](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/CategoriesPage.jsx): `client/src/pages/CategoriesPage.jsx`
- [Customer Screen](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/CustomersPage.jsx): `client/src/pages/CustomersPage.jsx`
- [Sales Screen](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/SalesPage.jsx): `client/src/pages/SalesPage.jsx`
- [Reports Screen](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/ReportsPage.jsx): `client/src/pages/ReportsPage.jsx`
- [Staff Screen](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/pages/UsersPage.jsx): `client/src/pages/UsersPage.jsx`

### API Boundary

- [API Client](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/client/src/api/client.js): `client/src/api/client.js`
- [HTTP API](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/app.js): `server/src/app.js`
- [Auth Routes](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/auth.routes.js): `server/src/routes/auth.routes.js`
- [Product Routes](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/product.routes.js): `server/src/routes/product.routes.js`
- [Customer Routes](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/customer.routes.js): `server/src/routes/customer.routes.js`
- [Category Routes](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/category.routes.js): `server/src/routes/category.routes.js`
- [Sales Routes](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/sale.routes.js): `server/src/routes/sale.routes.js`
- [Report Routes](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/routes/report.routes.js): `server/src/routes/report.routes.js`

### Shop Operations

- [Authentication](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/auth.controller.js): `server/src/controllers/auth.controller.js`
- [Product & Stock](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/product.controller.js): `server/src/controllers/product.controller.js`
- [Categories](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/category.controller.js): `server/src/controllers/category.controller.js`
- [Customers](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/customer.controller.js): `server/src/controllers/customer.controller.js`
- [Sale Processing](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/sale.controller.js): `server/src/controllers/sale.controller.js`
- [Sales Reporting](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/controllers/report.controller.js): `server/src/controllers/report.controller.js`

### Server Platform

- [SQLite Store](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/db/connection.js): `server/src/db/connection.js`
- [Request Validation](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/validate.js): `server/src/middleware/validate.js`
- [Access Control](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Error Responses](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/middleware/errorHandler.js): `server/src/middleware/errorHandler.js`
- [Pagination](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/utils/paginate.js): `server/src/utils/paginate.js`
- [Money Rules](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/utils/money.js): `server/src/utils/money.js`
- [Invoice Counter](https://github.com/kavampallyharishkumar-art/smallshop-pos/blob/main/server/src/utils/invoice.js): `server/src/utils/invoice.js`

### Other components

- **Cashier / Admin**

## Connections

- Cashier / Admin → App Shell: uses
- App Shell → Session State: provides session
- Session State → API Client: requests identity (evidence: `client/src/context/AuthContext.jsx`)
- Sign In → Session State: signs in
- POS Register → API Client: submits sale (evidence: `client/src/pages/POSRegister.jsx`)
- POS Register → Receipt View: renders receipt (evidence: `client/src/pages/POSRegister.jsx`)
- Catalog Screens → API Client: manages products (evidence: `client/src/pages/ProductsPage.jsx`)
- Category Screen → API Client: manages categories
- Customer Screen → API Client: manages customers
- Sales Screen → API Client: reviews sales
- Reports Screen → API Client: requests reports (evidence: `client/src/pages/ReportsPage.jsx`)
- Staff Screen → API Client: manages staff
- API Client → HTTP API: sends HTTP (evidence: `client/src/api/client.js`)
- HTTP API → Auth Routes: mounts routes (evidence: `server/src/app.js`)
- Auth Routes → Authentication: dispatches (evidence: `server/src/routes/auth.routes.js`)
- Product Routes → Product & Stock: dispatches (evidence: `server/src/routes/product.routes.js`)
- Customer Routes → Customers: dispatches (evidence: `server/src/routes/customer.routes.js`)
- Category Routes → Categories: dispatches (evidence: `server/src/routes/category.routes.js`)
- Sales Routes → Sale Processing: dispatches (evidence: `server/src/routes/sale.routes.js`)
- Report Routes → Sales Reporting: dispatches
- Auth Routes → Access Control: guards requests (evidence: `server/src/routes/auth.routes.js`)
- Product Routes → Request Validation: validates input (evidence: `server/src/routes/product.routes.js`)
- Product Routes → Access Control: guards requests (evidence: `server/src/routes/product.routes.js`)
- Customer Routes → Request Validation: validates input (evidence: `server/src/routes/customer.routes.js`)
- Customer Routes → Access Control: guards requests (evidence: `server/src/routes/customer.routes.js`)
- Category Routes → Request Validation: validates input (evidence: `server/src/routes/category.routes.js`)
- Category Routes → Access Control: guards requests (evidence: `server/src/routes/category.routes.js`)
- Sales Routes → Access Control: guards requests (evidence: `server/src/routes/sale.routes.js`)
- Authentication → SQLite Store: reads and writes (evidence: `server/src/controllers/auth.controller.js`)
- Product & Stock → SQLite Store: reads and writes (evidence: `server/src/controllers/product.controller.js`)
- Customers → SQLite Store: reads and writes (evidence: `server/src/controllers/customer.controller.js`)
- Categories → SQLite Store: reads and writes (evidence: `server/src/controllers/category.controller.js`)
- Sale Processing → SQLite Store: records transactions (evidence: `server/src/controllers/sale.controller.js`)
- Sales Reporting → SQLite Store: queries reports (evidence: `server/src/controllers/report.controller.js`)
- Product & Stock → Pagination: paginates listings (evidence: `server/src/controllers/product.controller.js`)
- Customers → Pagination: paginates listings (evidence: `server/src/controllers/customer.controller.js`)
- Sale Processing → Pagination: paginates listings (evidence: `server/src/controllers/sale.controller.js`)
- Sale Processing → Money Rules: computes totals (evidence: `server/src/controllers/sale.controller.js`)
- Sale Processing → Invoice Counter: allocates number (evidence: `server/src/controllers/sale.controller.js`)
- HTTP API → Error Responses: handles errors (evidence: `server/src/app.js`)
