# letsgomonman/pos-capstone-project architecture

> Architecture diagram of the GitHub repository letsgomonman/pos-capstone-project, 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/letsgomonman/pos-capstone-project
- Repository: https://github.com/letsgomonman/pos-capstone-project

## Overview

This is a browser-based, multi-tenant point-of-sale and store-management app. The main cashier workflow is to load branch products, build a cart, check out, and retain transactions locally when offline, with online checkout also writing to Supabase. Separate dashboard screens cover inventory, analytics, staff, transactions, transfers, branches, and workspaces. The excerpts show several direct calls; for other dashboard pages, connections are based on SOURCE INDEX references. Some runtime details remain uncertain because several modules were not excerpted.

Main entry points: [`src/lib/supabase.ts`](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/supabase.ts) (Supabase client), [`src/app/pos/page.tsx`](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/pos/page.tsx) (POS screen), [`src/components/pos/Cart.tsx`](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/Cart.tsx) (Cart and checkout UI), [`src/components/pos/ProductGrid.tsx`](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/ProductGrid.tsx) (Product catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and setup"]
  node_login["Login<br/>[page.tsx]"]
  node_register["Registration<br/>[page.tsx]"]
  node_session["Session state<br/>[useSession.ts]"]
  node_seed["Demo data seed<br/>[route.ts]"]
end

subgraph group_pos["Point of sale"]
  node_pospage["POS screen<br/>[page.tsx]"]
  node_catalog["Product catalog<br/>[ProductGrid.tsx]"]
  node_cart["Cart state<br/>[useCartStore.ts]"]
  node_cartpanel["Cart and checkout UI<br/>[Cart.tsx]"]
  node_checkout["Checkout processing<br/>[checkout.ts]"]
  node_receipt["PDF receipt<br/>[pdf-generator.ts]"]
  node_whatsapp["WhatsApp receipt<br/>[whatsapp.ts]"]
end

subgraph group_offline["Offline and sync"]
  node_network["Network status<br/>[NetworkStatus.tsx]"]
  node_sync["Transaction sync<br/>[sync.ts]"]
  node_localdb[("Browser database<br/>[dexie.ts]")]
end

subgraph group_management["Store management"]
  node_supabase["Supabase client<br/>[supabase.ts]"]
  node_analytics["Analytics<br/>[page.tsx]"]
  node_inventory["Inventory<br/>[page.tsx]"]
  node_team["Team<br/>[page.tsx]"]
  node_transactions["Transactions<br/>[page.tsx]"]
  node_transfers["Stock transfers<br/>[page.tsx]"]
  node_branches["Branches<br/>[page.tsx]"]
  node_workspaces["Workspaces<br/>[page.tsx]"]
end

node_cashier(("Cashier"))
node_supaservice[("Supabase backend")]

node_cashier -->|"signs in"| node_login
node_cashier -->|"registers"| node_register
node_login -->|"authenticates"| node_supabase
node_register -->|"creates account"| node_supabase
node_login -->|"sets session"| node_session
node_session -->|"loads auth and user"| node_supabase
node_seed -->|"seeds store data"| node_supabase
node_cashier -->|"opens POS"| node_pospage
node_pospage -->|"initializes session"| node_session
node_pospage -->|"renders"| node_catalog
node_pospage -->|"renders"| node_cartpanel
node_pospage -->|"renders"| node_network
node_pospage -->|"loads store details"| node_supabase
node_catalog -->|"loads products"| node_supabase
node_catalog -->|"caches products"| node_localdb
node_catalog -->|"adds product"| node_cart
node_cartpanel -->|"reads and updates"| node_cart
node_cartpanel -->|"submits sale"| node_checkout
node_checkout -->|"stores transaction"| node_localdb
node_checkout -->|"writes online sale"| node_supabase
node_cartpanel -->|"generates receipt"| node_receipt
node_cartpanel -->|"sends receipt"| node_whatsapp
node_network -->|"triggers sync"| node_sync
node_sync -->|"reads pending sales"| node_localdb
node_sync -->|"uploads sales"| node_supabase
node_supabase -->|"connects to"| node_supaservice
node_analytics -->|"queries metrics"| node_supabase
node_inventory -->|"manages stock"| node_supabase
node_team -->|"manages users"| node_supabase
node_transactions -->|"queries sales"| node_supabase
node_transfers -->|"manages transfers"| node_supabase
node_branches -->|"manages branches"| node_supabase
node_workspaces -->|"manages workspaces"| node_supabase

click node_login "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(auth)/login/page.tsx"
click node_register "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(auth)/register/page.tsx"
click node_session "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/hooks/useSession.ts"
click node_seed "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/api/v1/seed/route.ts"
click node_pospage "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/pos/page.tsx"
click node_catalog "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/ProductGrid.tsx"
click node_cart "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/hooks/useCartStore.ts"
click node_cartpanel "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/Cart.tsx"
click node_checkout "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/checkout.ts"
click node_receipt "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/pdf-generator.ts"
click node_whatsapp "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/whatsapp.ts"
click node_network "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/NetworkStatus.tsx"
click node_sync "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/sync.ts"
click node_localdb "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/dexie.ts"
click node_supabase "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/supabase.ts"
click node_analytics "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/analytics/page.tsx"
click node_inventory "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/inventory/page.tsx"
click node_team "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/team/page.tsx"
click node_transactions "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/transactions/page.tsx"
click node_transfers "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/transfers/page.tsx"
click node_branches "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/branches/page.tsx"
click node_workspaces "https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/workspaces/page.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_login,node_register,node_session,node_seed toneBlue
class node_pospage,node_catalog,node_cart,node_cartpanel,node_checkout,node_receipt,node_whatsapp,node_supaservice toneAmber
class node_network,node_sync,node_localdb toneMint
class node_supabase,node_analytics,node_inventory,node_team,node_transactions,node_transfers,node_branches,node_workspaces toneRose
class node_cashier toneIndigo
```

## Components

### Access and setup

- [Login](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Registration](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(auth)/register/page.tsx): `src/app/(auth)/register/page.tsx`
- [Session state](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/hooks/useSession.ts): `src/hooks/useSession.ts`
- [Demo data seed](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/api/v1/seed/route.ts): `src/app/api/v1/seed/route.ts`

### Point of sale

- [POS screen](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/pos/page.tsx): `src/app/pos/page.tsx`
- [Product catalog](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/ProductGrid.tsx): `src/components/pos/ProductGrid.tsx`
- [Cart state](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/hooks/useCartStore.ts): `src/hooks/useCartStore.ts`
- [Cart and checkout UI](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/Cart.tsx): `src/components/pos/Cart.tsx`
- [Checkout processing](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/checkout.ts): `src/lib/checkout.ts`
- [PDF receipt](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/pdf-generator.ts): `src/lib/pdf-generator.ts`
- [WhatsApp receipt](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/whatsapp.ts): `src/lib/whatsapp.ts`

### Offline and sync

- [Network status](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/components/pos/NetworkStatus.tsx): `src/components/pos/NetworkStatus.tsx`
- [Transaction sync](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/sync.ts): `src/lib/sync.ts`
- [Browser database](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/dexie.ts): `src/lib/dexie.ts`

### Store management

- [Supabase client](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- [Analytics](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/analytics/page.tsx): `src/app/(dashboard)/analytics/page.tsx`
- [Inventory](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/inventory/page.tsx): `src/app/(dashboard)/inventory/page.tsx`
- [Team](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/team/page.tsx): `src/app/(dashboard)/team/page.tsx`
- [Transactions](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/transactions/page.tsx): `src/app/(dashboard)/transactions/page.tsx`
- [Stock transfers](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/transfers/page.tsx): `src/app/(dashboard)/transfers/page.tsx`
- [Branches](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/branches/page.tsx): `src/app/(dashboard)/branches/page.tsx`
- [Workspaces](https://github.com/letsgomonman/pos-capstone-project/blob/main/src/app/(dashboard)/workspaces/page.tsx): `src/app/(dashboard)/workspaces/page.tsx`

### Other components

- **Cashier**
- **Supabase backend**

## Connections

- Cashier → Login: signs in (evidence: `src/app/(auth)/login/page.tsx`)
- Cashier → Registration: registers (evidence: `src/app/(auth)/register/page.tsx`)
- Login → Supabase client: authenticates (evidence: `src/app/(auth)/login/page.tsx`)
- Registration → Supabase client: creates account (evidence: `src/app/(auth)/register/page.tsx`)
- Login → Session state: sets session (evidence: `src/app/(auth)/login/page.tsx`)
- Session state → Supabase client: loads auth and user (evidence: `src/hooks/useSession.ts`)
- Demo data seed → Supabase client: seeds store data (evidence: `src/app/api/v1/seed/route.ts`)
- Cashier → POS screen: opens POS (evidence: `src/app/pos/page.tsx`)
- POS screen → Session state: initializes session (evidence: `src/app/pos/page.tsx`)
- POS screen → Product catalog: renders (evidence: `src/app/pos/page.tsx`)
- POS screen → Cart and checkout UI: renders (evidence: `src/app/pos/page.tsx`)
- POS screen → Network status: renders (evidence: `src/app/pos/page.tsx`)
- POS screen → Supabase client: loads store details (evidence: `src/app/pos/page.tsx`)
- Product catalog → Supabase client: loads products (evidence: `src/components/pos/ProductGrid.tsx`)
- Product catalog → Browser database: caches products (evidence: `src/components/pos/ProductGrid.tsx`)
- Product catalog → Cart state: adds product (evidence: `src/components/pos/ProductGrid.tsx`)
- Cart and checkout UI → Cart state: reads and updates (evidence: `src/components/pos/Cart.tsx`)
- Cart and checkout UI → Checkout processing: submits sale (evidence: `src/components/pos/Cart.tsx`)
- Checkout processing → Browser database: stores transaction (evidence: `src/lib/checkout.ts`)
- Checkout processing → Supabase client: writes online sale (evidence: `src/lib/checkout.ts`)
- Cart and checkout UI → PDF receipt: generates receipt (evidence: `src/components/pos/Cart.tsx`)
- Cart and checkout UI → WhatsApp receipt: sends receipt (evidence: `src/components/pos/Cart.tsx`)
- Network status → Transaction sync: triggers sync (evidence: `src/components/pos/NetworkStatus.tsx`)
- Transaction sync → Browser database: reads pending sales (evidence: `src/lib/sync.ts`)
- Transaction sync → Supabase client: uploads sales (evidence: `src/lib/sync.ts`)
- Supabase client → Supabase backend: connects to (evidence: `src/lib/supabase.ts`)
- Analytics → Supabase client: queries metrics (evidence: `src/app/(dashboard)/analytics/page.tsx`)
- Inventory → Supabase client: manages stock (evidence: `src/app/(dashboard)/inventory/page.tsx`)
- Team → Supabase client: manages users (evidence: `src/app/(dashboard)/team/page.tsx`)
- Transactions → Supabase client: queries sales (evidence: `src/app/(dashboard)/transactions/page.tsx`)
- Stock transfers → Supabase client: manages transfers (evidence: `src/app/(dashboard)/transfers/page.tsx`)
- Branches → Supabase client: manages branches (evidence: `src/app/(dashboard)/branches/page.tsx`)
- Workspaces → Supabase client: manages workspaces (evidence: `src/app/(dashboard)/workspaces/page.tsx`)
