# shigosag/shigosag-pos architecture

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

- Interactive diagram: https://gitdiagram.com/shigosag/shigosag-pos
- Repository: https://github.com/shigosag/shigosag-pos

## Overview

Shigosag POS is a web-and-mobile point-of-sale system for inventory, checkout, transfers, and transaction reporting. The web workflow runs from staff authentication and protected screens through product browsing/cart checkout or transfer requests, then backend routes and domain services to persistent records; the UI also exposes history, analytics, balance, and customer operations. Socket.IO supports live updates, and the README describes Stripe-ready checkout. The excerpts show several controller/service and frontend/API links; broader feature links are documented, while unsampled integrations are left unconnected.

Main entry points: [`backend/src/lib/prisma.ts`](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/lib/prisma.ts) (Data access), [`frontend/src/layouts/MainLayout.tsx`](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/layouts/MainLayout.tsx) (POS workspace), [`backend/src/app.ts`](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/app.ts) (HTTP application), [`backend/src/controllers/posController.ts`](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/posController.ts) (Checkout and transactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_webapp["Web application<br/>[App.tsx]"]
  node_authpages["Sign in and register<br/>[Login.tsx]"]
  node_authstate["Authentication state<br/>[authStore.ts]"]
  node_workspace["POS workspace<br/>[MainLayout.tsx]"]
  node_salesui["Sales and checkout<br/>[Sales.tsx]"]
  node_productsui["Product management<br/>[Products.tsx]"]
  node_reportingui["Operations reporting<br/>[Dashboard.tsx]"]
  node_otherfeatures["Other POS screens"]
  node_mobile["Mobile app<br/>[App.tsx]"]
  node_httpclient["API client<br/>[api.ts]"]
  node_checkout["Checkout modal<br/>[CheckoutModal.tsx]"]
end

subgraph group_api["API and access"]
  node_backend["HTTP application<br/>[app.ts]"]
  node_authroutes["Authentication routes<br/>[authRoutes.ts]"]
  node_authlogic["Authentication and profiles<br/>[authController.ts]"]
  node_access["Request authentication<br/>[authMiddleware.ts]"]
  node_productroutes["Product routes<br/>[productRoutes.ts]"]
  node_posroutes["POS routes<br/>[posRoutes.ts]"]
  node_paymentroute["Payment route<br/>[payment.routes.ts]"]
end

subgraph group_commerce["POS operations"]
  node_productlogic["Product operations"]
  node_poslogic["Checkout and transactions<br/>[posController.ts]"]
  node_posservice["Transfer processing<br/>[posService.ts]"]
  node_saleservice["Retail sale processing<br/>[saleService.ts]"]
  node_productservice["Inventory service<br/>[productService.ts]"]
  node_ledger["Ledger service<br/>[ledgerService.ts]"]
end

subgraph group_platform["Persistence and realtime"]
  node_prisma["Data access<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
  node_socket["Realtime events<br/>[socket.ts]"]
end

node_staff(("POS staff"))
node_stripe["Stripe-ready payment"]

node_staff -->|"signs in"| node_authpages
node_authpages -->|"requests auth"| node_httpclient
node_authpages -->|"updates session"| node_authstate
node_authstate -->|"gates routes"| node_webapp
node_webapp -->|"renders protected"| node_workspace
node_workspace -.->|"hosts screen"| node_salesui
node_workspace -.->|"hosts screen"| node_productsui
node_workspace -.->|"hosts screen"| node_reportingui
node_webapp -->|"routes to"| node_otherfeatures
node_staff -.->|"uses POS"| node_mobile
node_salesui -->|"loads products"| node_httpclient
node_salesui -->|"opens checkout"| node_checkout
node_httpclient -->|"sends API requests"| node_backend
node_backend -->|"mounts"| node_authroutes
node_backend -->|"mounts"| node_productroutes
node_backend -->|"mounts"| node_posroutes
node_authroutes -->|"routes requests"| node_authlogic
node_authroutes -->|"protects endpoints"| node_access
node_productroutes -->|"routes requests"| node_productlogic
node_productroutes -->|"protects endpoints"| node_access
node_posroutes -->|"routes requests"| node_poslogic
node_posroutes -->|"protects endpoints"| node_access
node_authlogic -->|"reads and writes users"| node_prisma
node_productlogic -->|"delegates inventory"| node_productservice
node_productlogic -->|"emits product events"| node_socket
node_poslogic -->|"processes transfer"| node_posservice
node_poslogic -->|"processes sale"| node_saleservice
node_poslogic -->|"reads transactions"| node_prisma
node_productservice -->|"accesses records"| node_prisma
node_posservice -->|"accesses records"| node_prisma
node_saleservice -->|"accesses records"| node_prisma
node_ledger -->|"accesses records"| node_prisma
node_prisma -->|"persists data"| node_postgres
node_paymentroute -.->|"payment integration"| node_stripe
node_httpclient -.->|"subscribes to live feed"| node_socket
node_socket -.->|"broadcasts updates"| node_staff

click node_webapp "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/App.tsx"
click node_authpages "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Auth/Login.tsx"
click node_authstate "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/store/authStore.ts"
click node_workspace "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/layouts/MainLayout.tsx"
click node_salesui "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Sales.tsx"
click node_productsui "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Products.tsx"
click node_reportingui "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Dashboard.tsx"
click node_otherfeatures "https://github.com/shigosag/shigosag-pos/tree/main/frontend/src/pages"
click node_mobile "https://github.com/shigosag/shigosag-pos/blob/main/mobile/App.tsx"
click node_httpclient "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/api/api.ts"
click node_backend "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/app.ts"
click node_authroutes "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/authRoutes.ts"
click node_authlogic "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/authController.ts"
click node_access "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/middleware/authMiddleware.ts"
click node_productroutes "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/productRoutes.ts"
click node_productlogic "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/productController.ts"
click node_posroutes "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/posRoutes.ts"
click node_poslogic "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/posController.ts"
click node_posservice "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/posService.ts"
click node_saleservice "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/saleService.ts"
click node_productservice "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/productService.ts"
click node_ledger "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/ledgerService.ts"
click node_prisma "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/lib/prisma.ts"
click node_socket "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/lib/socket.ts"
click node_paymentroute "https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/payment.routes.ts"
click node_checkout "https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/CheckoutModal.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_webapp,node_authpages,node_authstate,node_workspace,node_salesui,node_productsui,node_reportingui,node_otherfeatures,node_mobile,node_httpclient,node_checkout toneBlue
class node_backend,node_authroutes,node_authlogic,node_access,node_productroutes,node_posroutes,node_paymentroute toneAmber
class node_productlogic,node_poslogic,node_posservice,node_saleservice,node_productservice,node_ledger toneMint
class node_prisma,node_postgres,node_socket toneRose
class node_staff,node_stripe toneIndigo
```

## Components

### Web experience

- [Web application](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Sign in and register](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Auth/Login.tsx): `frontend/src/pages/Auth/Login.tsx`
- [Authentication state](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/store/authStore.ts): `frontend/src/store/authStore.ts`
- [POS workspace](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/layouts/MainLayout.tsx): `frontend/src/layouts/MainLayout.tsx`
- [Sales and checkout](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Sales.tsx): `frontend/src/pages/Sales.tsx`
- [Product management](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Products.tsx): `frontend/src/pages/Products.tsx`
- [Operations reporting](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Other POS screens](https://github.com/shigosag/shigosag-pos/tree/main/frontend/src/pages): `frontend/src/pages`
- [Mobile app](https://github.com/shigosag/shigosag-pos/blob/main/mobile/App.tsx): `mobile/App.tsx`
- [API client](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/api/api.ts): `frontend/src/api/api.ts`
- [Checkout modal](https://github.com/shigosag/shigosag-pos/blob/main/frontend/src/pages/CheckoutModal.tsx): `frontend/src/pages/CheckoutModal.tsx`

### API and access

- [HTTP application](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Authentication routes](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/authRoutes.ts): `backend/src/routes/authRoutes.ts`
- [Authentication and profiles](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/authController.ts): `backend/src/controllers/authController.ts`
- [Request authentication](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/middleware/authMiddleware.ts): `backend/src/middleware/authMiddleware.ts`
- [Product routes](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/productRoutes.ts): `backend/src/routes/productRoutes.ts`
- [POS routes](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/posRoutes.ts): `backend/src/routes/posRoutes.ts`
- [Payment route](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/routes/payment.routes.ts): `backend/src/routes/payment.routes.ts`

### POS operations

- [Product operations](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/productController.ts): `backend/src/controllers/productController.ts`
- [Checkout and transactions](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/controllers/posController.ts): `backend/src/controllers/posController.ts`
- [Transfer processing](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/posService.ts): `backend/src/services/posService.ts`
- [Retail sale processing](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/saleService.ts): `backend/src/services/saleService.ts`
- [Inventory service](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/productService.ts): `backend/src/services/productService.ts`
- [Ledger service](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/services/ledgerService.ts): `backend/src/services/ledgerService.ts`

### Persistence and realtime

- [Data access](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/lib/prisma.ts): `backend/src/lib/prisma.ts`
- **PostgreSQL**
- [Realtime events](https://github.com/shigosag/shigosag-pos/blob/main/backend/src/lib/socket.ts): `backend/src/lib/socket.ts`

### Other components

- **POS staff**
- **Stripe-ready payment**

## Connections

- POS staff → Sign in and register: signs in
- Sign in and register → API client: requests auth (evidence: `frontend/src/pages/Auth/Login.tsx`)
- Sign in and register → Authentication state: updates session (evidence: `frontend/src/pages/Auth/Login.tsx`)
- Authentication state → Web application: gates routes (evidence: `frontend/src/App.tsx`)
- Web application → POS workspace: renders protected (evidence: `frontend/src/App.tsx`)
- POS workspace → Sales and checkout: hosts screen
- POS workspace → Product management: hosts screen
- POS workspace → Operations reporting: hosts screen
- Web application → Other POS screens: routes to (evidence: `frontend/src/App.tsx`)
- POS staff → Mobile app: uses POS (evidence: `README.md`)
- Sales and checkout → API client: loads products (evidence: `frontend/src/pages/Sales.tsx`)
- Sales and checkout → Checkout modal: opens checkout (evidence: `frontend/src/pages/Sales.tsx`)
- API client → HTTP application: sends API requests (evidence: `frontend/src/api/api.ts`)
- HTTP application → Authentication routes: mounts (evidence: `backend/src/app.ts`)
- HTTP application → Product routes: mounts (evidence: `backend/src/app.ts`)
- HTTP application → POS routes: mounts (evidence: `backend/src/app.ts`)
- Authentication routes → Authentication and profiles: routes requests (evidence: `backend/src/routes/authRoutes.ts`)
- Authentication routes → Request authentication: protects endpoints (evidence: `backend/src/routes/authRoutes.ts`)
- Product routes → Product operations: routes requests (evidence: `backend/src/routes/productRoutes.ts`)
- Product routes → Request authentication: protects endpoints (evidence: `backend/src/routes/productRoutes.ts`)
- POS routes → Checkout and transactions: routes requests (evidence: `backend/src/routes/posRoutes.ts`)
- POS routes → Request authentication: protects endpoints (evidence: `backend/src/routes/posRoutes.ts`)
- Authentication and profiles → Data access: reads and writes users (evidence: `backend/src/controllers/authController.ts`)
- Product operations → Inventory service: delegates inventory (evidence: `backend/src/controllers/productController.ts`)
- Product operations → Realtime events: emits product events (evidence: `backend/src/controllers/productController.ts`)
- Checkout and transactions → Transfer processing: processes transfer (evidence: `backend/src/controllers/posController.ts`)
- Checkout and transactions → Retail sale processing: processes sale (evidence: `backend/src/controllers/posController.ts`)
- Checkout and transactions → Data access: reads transactions (evidence: `backend/src/controllers/posController.ts`)
- Inventory service → Data access: accesses records (evidence: `backend/src/services/productService.ts`)
- Transfer processing → Data access: accesses records (evidence: `backend/src/services/posService.ts`)
- Retail sale processing → Data access: accesses records (evidence: `backend/src/services/saleService.ts`)
- Ledger service → Data access: accesses records (evidence: `backend/src/services/ledgerService.ts`)
- Data access → PostgreSQL: persists data (evidence: `README.md`)
- Payment route → Stripe-ready payment: payment integration (evidence: `README.md`)
- API client → Realtime events: subscribes to live feed (evidence: `README.md`)
- Realtime events → POS staff: broadcasts updates (evidence: `README.md`)
