# mkmathepe/shishapos architecture

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

- Interactive diagram: https://gitdiagram.com/mkmathepe/shishapos
- Repository: https://github.com/mkmathepe/shishapos

## Overview

The Chill Pipe POS is a browser-based point-of-sale and lounge-management application. Staff sign in, record pipe and refill sales, and track delivery; managers and admins also manage stock, expenses, shift reviews, and business performance, with admin-only settings and staff permissions. The React app is the principal workflow orchestrator, while database helpers and domain models provide a useful internal layer. The graph combines README-documented capabilities with shown imports and calls; several feature details and their internal connections are unsampled, so those relationships are omitted.

Main entry points: [`src/App.jsx`](https://github.com/mkmathepe/shishapos/blob/main/src/App.jsx) (POS application), [`src/db.js`](https://github.com/mkmathepe/shishapos/blob/main/src/db.js) (POS data access), [`src/StockTaking.jsx`](https://github.com/mkmathepe/shishapos/blob/main/src/StockTaking.jsx) (Stock management), [`src/supabase.js`](https://github.com/mkmathepe/shishapos/blob/main/src/supabase.js) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["App runtime"]
  node_app["POS application<br/>[App.jsx]"]
  node_auth["Authentication<br/>[auth.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_supabase_store[("Supabase data service")]
  node_user_management["Staff and permissions<br/>[index.ts]"]
end

subgraph group_sales["Sales operations"]
  node_sales_ui["Order entry and delivery<br/>[App.jsx]"]
  node_sale_write["Sale persistence<br/>[salePersistence.js]"]
  node_db["POS data access<br/>[db.js]"]
  node_offline_orders["Offline order queue<br/>[offlineOrders.js]"]
  node_selling_cache["Selling data cache<br/>[sellingCache.js]"]
end

subgraph group_inventory["Inventory operations"]
  node_stock_ui["Stock management<br/>[StockTaking.jsx]"]
  node_stock_model["Stock count model"]
  node_stock_photo["Stock item photos<br/>[StockItemPhoto.jsx]"]
end

subgraph group_finance["Finance and review"]
  node_expenses_ui["Expense management<br/>[ExpensesList.jsx]"]
  node_receipt_picker["Receipt selection<br/>[ReceiptPicker.jsx]"]
  node_shift_ui["Shift review<br/>[ShiftReview.jsx]"]
  node_shift_model["Shift review calculations"]
  node_shift_db["Shift review data access<br/>[shiftReviewDb.js]"]
end

subgraph group_insights["Management insights"]
  node_management_ui["Management overview"]
  node_sales_performance["Sales performance"]
  node_overview_model["Performance calculations<br/>[overviewModel.js]"]
  node_monthly_weeks["Monthly reporting<br/>[MonthlyWeeks.jsx]"]
  node_profit_growth["Profit growth<br/>[ProfitGrowth.jsx]"]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_app
node_app -->|"signs in"| node_auth
node_app -->|"orchestrates"| node_sales_ui
node_app -->|"renders"| node_stock_ui
node_app -->|"renders"| node_expenses_ui
node_app -->|"syncs queued sales"| node_offline_orders
node_app -->|"caches selling data"| node_selling_cache
node_app -->|"fetches stock"| node_db
node_sales_ui -.->|"records orders"| node_db
node_db -->|"builds sale payload"| node_sale_write
node_db -->|"writes and reads"| node_supabase_client
node_supabase_client -->|"connects to"| node_supabase_store
node_db -->|"caches stock"| node_selling_cache
node_offline_orders -.->|"syncs when online"| node_supabase_store
node_stock_ui -->|"builds count data"| node_stock_model
node_stock_ui -->|"renders photos"| node_stock_photo
node_stock_ui -->|"records stocktakes"| node_supabase_client
node_expenses_ui -.->|"collects receipts"| node_receipt_picker
node_app -->|"renders"| node_receipt_picker
node_shift_ui -->|"calculates review"| node_shift_model
node_shift_ui -->|"loads and saves"| node_shift_db
node_shift_db -->|"reads and writes"| node_supabase_client
node_management_ui -->|"presents performance"| node_sales_performance
node_management_ui -->|"shows monthly periods"| node_monthly_weeks
node_sales_performance -->|"calculates metrics"| node_overview_model
node_sales_performance -->|"shows growth"| node_profit_growth
node_monthly_weeks -->|"uses period data"| node_overview_model
node_management_ui -->|"loads management data"| node_db
node_app -.->|"manages staff"| node_user_management

click node_app "https://github.com/mkmathepe/shishapos/blob/main/src/App.jsx"
click node_auth "https://github.com/mkmathepe/shishapos/blob/main/src/auth.js"
click node_supabase_client "https://github.com/mkmathepe/shishapos/blob/main/src/supabase.js"
click node_sales_ui "https://github.com/mkmathepe/shishapos/blob/main/src/App.jsx"
click node_sale_write "https://github.com/mkmathepe/shishapos/blob/main/src/salePersistence.js"
click node_db "https://github.com/mkmathepe/shishapos/blob/main/src/db.js"
click node_offline_orders "https://github.com/mkmathepe/shishapos/blob/main/src/offlineOrders.js"
click node_selling_cache "https://github.com/mkmathepe/shishapos/blob/main/src/sellingCache.js"
click node_stock_ui "https://github.com/mkmathepe/shishapos/blob/main/src/StockTaking.jsx"
click node_stock_model "https://github.com/mkmathepe/shishapos/blob/main/src/stockTakingModel.js"
click node_stock_photo "https://github.com/mkmathepe/shishapos/blob/main/src/StockItemPhoto.jsx"
click node_expenses_ui "https://github.com/mkmathepe/shishapos/blob/main/src/ExpensesList.jsx"
click node_receipt_picker "https://github.com/mkmathepe/shishapos/blob/main/src/ReceiptPicker.jsx"
click node_shift_ui "https://github.com/mkmathepe/shishapos/blob/main/src/ShiftReview.jsx"
click node_shift_model "https://github.com/mkmathepe/shishapos/blob/main/src/shiftReviewModel.js"
click node_shift_db "https://github.com/mkmathepe/shishapos/blob/main/src/shiftReviewDb.js"
click node_management_ui "https://github.com/mkmathepe/shishapos/blob/main/src/ManagementOverview.jsx"
click node_sales_performance "https://github.com/mkmathepe/shishapos/blob/main/src/SalesPerformance.jsx"
click node_overview_model "https://github.com/mkmathepe/shishapos/blob/main/src/overviewModel.js"
click node_monthly_weeks "https://github.com/mkmathepe/shishapos/blob/main/src/MonthlyWeeks.jsx"
click node_profit_growth "https://github.com/mkmathepe/shishapos/blob/main/src/ProfitGrowth.jsx"
click node_user_management "https://github.com/mkmathepe/shishapos/blob/main/supabase/functions/manage-pos-user/index.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_auth,node_supabase_client,node_supabase_store,node_user_management,node_staff toneBlue
class node_sales_ui,node_sale_write,node_db,node_offline_orders,node_selling_cache toneAmber
class node_stock_ui,node_stock_model,node_stock_photo toneMint
class node_expenses_ui,node_receipt_picker,node_shift_ui,node_shift_model,node_shift_db toneRose
class node_management_ui,node_sales_performance,node_overview_model,node_monthly_weeks,node_profit_growth toneIndigo
```

## Components

### App runtime

- [POS application](https://github.com/mkmathepe/shishapos/blob/main/src/App.jsx): `src/App.jsx`
- [Authentication](https://github.com/mkmathepe/shishapos/blob/main/src/auth.js): `src/auth.js`
- [Supabase client](https://github.com/mkmathepe/shishapos/blob/main/src/supabase.js): `src/supabase.js`
- **Supabase data service**
- [Staff and permissions](https://github.com/mkmathepe/shishapos/blob/main/supabase/functions/manage-pos-user/index.ts): `supabase/functions/manage-pos-user/index.ts`

### Sales operations

- [Order entry and delivery](https://github.com/mkmathepe/shishapos/blob/main/src/App.jsx): `src/App.jsx`
- [Sale persistence](https://github.com/mkmathepe/shishapos/blob/main/src/salePersistence.js): `src/salePersistence.js`
- [POS data access](https://github.com/mkmathepe/shishapos/blob/main/src/db.js): `src/db.js`
- [Offline order queue](https://github.com/mkmathepe/shishapos/blob/main/src/offlineOrders.js): `src/offlineOrders.js`
- [Selling data cache](https://github.com/mkmathepe/shishapos/blob/main/src/sellingCache.js): `src/sellingCache.js`

### Inventory operations

- [Stock management](https://github.com/mkmathepe/shishapos/blob/main/src/StockTaking.jsx): `src/StockTaking.jsx`
- [Stock count model](https://github.com/mkmathepe/shishapos/blob/main/src/stockTakingModel.js): `src/stockTakingModel.js`
- [Stock item photos](https://github.com/mkmathepe/shishapos/blob/main/src/StockItemPhoto.jsx): `src/StockItemPhoto.jsx`

### Finance and review

- [Expense management](https://github.com/mkmathepe/shishapos/blob/main/src/ExpensesList.jsx): `src/ExpensesList.jsx`
- [Receipt selection](https://github.com/mkmathepe/shishapos/blob/main/src/ReceiptPicker.jsx): `src/ReceiptPicker.jsx`
- [Shift review](https://github.com/mkmathepe/shishapos/blob/main/src/ShiftReview.jsx): `src/ShiftReview.jsx`
- [Shift review calculations](https://github.com/mkmathepe/shishapos/blob/main/src/shiftReviewModel.js): `src/shiftReviewModel.js`
- [Shift review data access](https://github.com/mkmathepe/shishapos/blob/main/src/shiftReviewDb.js): `src/shiftReviewDb.js`

### Management insights

- [Management overview](https://github.com/mkmathepe/shishapos/blob/main/src/ManagementOverview.jsx): `src/ManagementOverview.jsx`
- [Sales performance](https://github.com/mkmathepe/shishapos/blob/main/src/SalesPerformance.jsx): `src/SalesPerformance.jsx`
- [Performance calculations](https://github.com/mkmathepe/shishapos/blob/main/src/overviewModel.js): `src/overviewModel.js`
- [Monthly reporting](https://github.com/mkmathepe/shishapos/blob/main/src/MonthlyWeeks.jsx): `src/MonthlyWeeks.jsx`
- [Profit growth](https://github.com/mkmathepe/shishapos/blob/main/src/ProfitGrowth.jsx): `src/ProfitGrowth.jsx`

### Other components

- **Staff user**

## Connections

- Staff user → POS application: uses (evidence: `README.md`)
- POS application → Authentication: signs in (evidence: `src/App.jsx`)
- POS application → Order entry and delivery: orchestrates (evidence: `README.md`)
- POS application → Stock management: renders (evidence: `src/App.jsx`)
- POS application → Expense management: renders (evidence: `src/App.jsx`)
- POS application → Offline order queue: syncs queued sales (evidence: `src/App.jsx`)
- POS application → Selling data cache: caches selling data (evidence: `src/App.jsx`)
- POS application → POS data access: fetches stock (evidence: `src/App.jsx`)
- Order entry and delivery → POS data access: records orders (evidence: `src/App.jsx`)
- POS data access → Sale persistence: builds sale payload (evidence: `src/db.js`)
- POS data access → Supabase client: writes and reads (evidence: `src/db.js`)
- Supabase client → Supabase data service: connects to (evidence: `src/supabase.js`)
- POS data access → Selling data cache: caches stock (evidence: `src/db.js`)
- Offline order queue → Supabase data service: syncs when online
- Stock management → Stock count model: builds count data (evidence: `src/StockTaking.jsx`)
- Stock management → Stock item photos: renders photos (evidence: `src/StockTaking.jsx`)
- Stock management → Supabase client: records stocktakes (evidence: `src/StockTaking.jsx`)
- Expense management → Receipt selection: collects receipts
- POS application → Receipt selection: renders (evidence: `src/App.jsx`)
- Shift review → Shift review calculations: calculates review (evidence: `src/ShiftReview.jsx`)
- Shift review → Shift review data access: loads and saves (evidence: `src/ShiftReview.jsx`)
- Shift review data access → Supabase client: reads and writes (evidence: `src/shiftReviewDb.js`)
- Management overview → Sales performance: presents performance (evidence: `src/ManagementOverview.jsx`)
- Management overview → Monthly reporting: shows monthly periods (evidence: `src/ManagementOverview.jsx`)
- Sales performance → Performance calculations: calculates metrics (evidence: `src/SalesPerformance.jsx`)
- Sales performance → Profit growth: shows growth (evidence: `src/SalesPerformance.jsx`)
- Monthly reporting → Performance calculations: uses period data (evidence: `src/MonthlyWeeks.jsx`)
- Management overview → POS data access: loads management data (evidence: `src/ManagementOverview.jsx`)
- POS application → Staff and permissions: manages staff
