# xxomelxx/web-based-capstone-project architecture

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

- Interactive diagram: https://gitdiagram.com/xxomelxx/web-based-capstone-project
- Repository: https://github.com/xxomelxx/web-based-capstone-project

## Overview

This is a Sari-Sari POS web application: staff use dashboard screens for checkout, inventory, shifts, credit, and reporting, with server API routes handling business data. The client also supports offline use through local caches and queued actions that synchronize with the server. The map preserves management and reporting branches visible in the tree. Evidence is limited to the README, source index references, and excerpts; connections among unsampled screens and routes are omitted unless documented there.

Main entry points: [`lib/client/api/inventory.ts`](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/inventory.ts) (Client API helpers), [`app/api`](https://github.com/xxomelxx/web-based-capstone-project/tree/main/app/api) (Business API routes), [`app/(dashboard)/pos/POSClient.tsx`](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/pos/POSClient.tsx) (Point of sale), [`lib/client/sync-engine.ts`](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/sync-engine.ts) (Sync engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["POS screens"]
  node_cashier["Point of sale<br/>[POSClient.tsx]"]
  node_dashboard["Dashboard"]
  node_products["Product management<br/>[ProductsClient.tsx]"]
  node_reports["Reports<br/>[ReportsClient.tsx]"]
  node_credit["Credit accounts<br/>[CreditClient.tsx]"]
  node_users["User management<br/>[UsersClient.tsx]"]
end

subgraph group_client["Client services"]
  node_clientapis["Client API helpers<br/>[inventory.ts]"]
  node_posapi["POS API helper<br/>[pos.ts]"]
  node_shiftapi["Shift API helper<br/>[shift.ts]"]
end

subgraph group_server["Server services"]
  node_api["Business API routes"]
  node_checkout["Checkout route<br/>[route.ts]"]
  node_reportroute["Reports routes"]
  node_database[("Application database<br/>[prisma.ts]")]
  node_auth["Authentication<br/>[auth.ts]"]
  node_realtime["Realtime broadcasting<br/>[realtime.ts]"]
end

subgraph group_offline["Offline system"]
  node_cachedb[("Offline data cache<br/>[offline.ts]")]
  node_queue["Pending action queue<br/>[offlineQueue.ts]"]
  node_sync["Sync engine<br/>[sync-engine.ts]"]
  node_syncstatus["Offline sync status<br/>[useOfflineSync.ts]"]
end

node_cashieractor(("Cashier"))

node_cashieractor -->|"uses"| node_cashier
node_cashier -->|"uses"| node_posapi
node_cashier -->|"uses"| node_clientapis
node_cashier -->|"fetches shifts"| node_shiftapi
node_dashboard -->|"loads data"| node_clientapis
node_dashboard -->|"renders charts"| node_reports
node_products -->|"uses inventory APIs"| node_clientapis
node_reports -->|"loads data"| node_clientapis
node_credit -->|"loads data"| node_clientapis
node_users -->|"loads data"| node_clientapis
node_clientapis -->|"reads and writes"| node_cachedb
node_clientapis -->|"requests data"| node_api
node_posapi -.->|"checkout request"| node_checkout
node_shiftapi -.->|"requests shifts"| node_api
node_reportroute -->|"queries"| node_database
node_api -->|"uses database"| node_database
node_api -->|"broadcasts updates"| node_realtime
node_api -->|"checks access"| node_auth
node_auth -->|"looks up users"| node_database
node_syncstatus -->|"counts actions"| node_queue
node_syncstatus -->|"starts sync"| node_queue
node_queue -->|"delegates sync"| node_sync
node_sync -->|"updates action status"| node_queue
node_sync -->|"merges pulled data"| node_cachedb
node_sync -->|"pushes and pulls"| node_api

click node_cashier "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/pos/POSClient.tsx"
click node_dashboard "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/dashboard/DashboardClient.tsx"
click node_products "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/products/ProductsClient.tsx"
click node_reports "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/reports/ReportsClient.tsx"
click node_credit "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/credit/CreditClient.tsx"
click node_users "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/users/UsersClient.tsx"
click node_clientapis "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/inventory.ts"
click node_posapi "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/pos.ts"
click node_shiftapi "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/shift.ts"
click node_api "https://github.com/xxomelxx/web-based-capstone-project/tree/main/app/api"
click node_checkout "https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/api/pos/checkout/route.ts"
click node_reportroute "https://github.com/xxomelxx/web-based-capstone-project/tree/main/app/api/reports"
click node_database "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/server/prisma.ts"
click node_auth "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/server/auth.ts"
click node_realtime "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/server/realtime.ts"
click node_cachedb "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/offline.ts"
click node_queue "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/offlineQueue.ts"
click node_sync "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/sync-engine.ts"
click node_syncstatus "https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/hooks/useOfflineSync.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_cashier,node_dashboard,node_products,node_reports,node_credit,node_users toneBlue
class node_clientapis,node_posapi,node_shiftapi toneAmber
class node_api,node_checkout,node_reportroute,node_database,node_auth,node_realtime toneMint
class node_cachedb,node_queue,node_sync,node_syncstatus toneRose
class node_cashieractor toneIndigo
```

## Components

### POS screens

- [Point of sale](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/pos/POSClient.tsx): `app/(dashboard)/pos/POSClient.tsx`
- [Dashboard](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/dashboard/DashboardClient.tsx): `app/(dashboard)/dashboard/DashboardClient.tsx`
- [Product management](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/products/ProductsClient.tsx): `app/(dashboard)/products/ProductsClient.tsx`
- [Reports](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/reports/ReportsClient.tsx): `app/(dashboard)/reports/ReportsClient.tsx`
- [Credit accounts](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/credit/CreditClient.tsx): `app/(dashboard)/credit/CreditClient.tsx`
- [User management](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/(dashboard)/users/UsersClient.tsx): `app/(dashboard)/users/UsersClient.tsx`

### Client services

- [Client API helpers](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/inventory.ts): `lib/client/api/inventory.ts`
- [POS API helper](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/pos.ts): `lib/client/api/pos.ts`
- [Shift API helper](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/api/shift.ts): `lib/client/api/shift.ts`

### Server services

- [Business API routes](https://github.com/xxomelxx/web-based-capstone-project/tree/main/app/api): `app/api`
- [Checkout route](https://github.com/xxomelxx/web-based-capstone-project/blob/main/app/api/pos/checkout/route.ts): `app/api/pos/checkout/route.ts`
- [Reports routes](https://github.com/xxomelxx/web-based-capstone-project/tree/main/app/api/reports): `app/api/reports`
- [Application database](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/server/prisma.ts): `lib/server/prisma.ts`
- [Authentication](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/server/auth.ts): `lib/server/auth.ts`
- [Realtime broadcasting](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/server/realtime.ts): `lib/server/realtime.ts`

### Offline system

- [Offline data cache](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/offline.ts): `lib/client/offline.ts`
- [Pending action queue](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/offlineQueue.ts): `lib/client/offlineQueue.ts`
- [Sync engine](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/sync-engine.ts): `lib/client/sync-engine.ts`
- [Offline sync status](https://github.com/xxomelxx/web-based-capstone-project/blob/main/lib/client/hooks/useOfflineSync.ts): `lib/client/hooks/useOfflineSync.ts`

### Other components

- **Cashier**

## Connections

- Cashier → Point of sale: uses
- Point of sale → POS API helper: uses (evidence: `app/(dashboard)/pos/POSClient.tsx`)
- Point of sale → Client API helpers: uses (evidence: `app/(dashboard)/pos/POSClient.tsx`)
- Point of sale → Shift API helper: fetches shifts (evidence: `app/(dashboard)/pos/POSClient.tsx`)
- Dashboard → Client API helpers: loads data (evidence: `app/(dashboard)/dashboard/DashboardClient.tsx`)
- Dashboard → Reports: renders charts (evidence: `app/(dashboard)/dashboard/DashboardClient.tsx`)
- Product management → Client API helpers: uses inventory APIs (evidence: `app/(dashboard)/products/ProductsClient.tsx`)
- Reports → Client API helpers: loads data (evidence: `app/(dashboard)/reports/ReportsClient.tsx`)
- Credit accounts → Client API helpers: loads data (evidence: `app/(dashboard)/credit/CreditClient.tsx`)
- User management → Client API helpers: loads data (evidence: `app/(dashboard)/users/UsersClient.tsx`)
- Client API helpers → Offline data cache: reads and writes (evidence: `lib/client/api/inventory.ts`)
- Client API helpers → Business API routes: requests data (evidence: `lib/client/api/inventory.ts`)
- POS API helper → Checkout route: checkout request
- Shift API helper → Business API routes: requests shifts
- Reports routes → Application database: queries (evidence: `app/api/reports/route.ts`)
- Business API routes → Application database: uses database (evidence: `app/api/products/route.ts`)
- Business API routes → Realtime broadcasting: broadcasts updates (evidence: `app/api/products/route.ts`)
- Business API routes → Authentication: checks access (evidence: `app/api/products/route.ts`)
- Authentication → Application database: looks up users (evidence: `lib/server/auth.ts`)
- Offline sync status → Pending action queue: counts actions (evidence: `lib/client/hooks/useOfflineSync.ts`)
- Offline sync status → Pending action queue: starts sync (evidence: `lib/client/hooks/useOfflineSync.ts`)
- Pending action queue → Sync engine: delegates sync (evidence: `lib/client/offlineQueue.ts`)
- Sync engine → Pending action queue: updates action status (evidence: `lib/client/sync-engine.ts`)
- Sync engine → Offline data cache: merges pulled data (evidence: `lib/client/sync-engine.ts`)
- Sync engine → Business API routes: pushes and pulls (evidence: `lib/client/sync-engine.ts`)
