# prowider5565/vpos architecture

> Architecture diagram of the GitHub repository prowider5565/vpos, 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/prowider5565/vpos
- Repository: https://github.com/prowider5565/vpos

## Overview

This repository implements a point-of-sale and shop-management application: staff use a desktop-oriented frontend to manage sales, order history, cash-desk transactions, products, users, and statistics; a FastAPI backend exposes the domain operations and persists them through SQLAlchemy. The principal workflow is taking a sale and recording an order, then reviewing its history and financial impact. The source index supports several backend and frontend connections; other UI-to-hook and frontend-to-API links are shown as unverified where excerpts do not establish the calls. The mobile tree contains platform shells but no sampled product runtime.

Main entry points: [`frontend/src/app/App.tsx`](https://github.com/prowider5565/vpos/blob/main/frontend/src/app/App.tsx) (App shell), [`backend/main.py`](https://github.com/prowider5565/vpos/blob/main/backend/main.py) (FastAPI application), [`backend/cash_desk/router.py`](https://github.com/prowider5565/vpos/blob/main/backend/cash_desk/router.py) (Cash-desk routes), [`backend/users/handlers.py`](https://github.com/prowider5565/vpos/blob/main/backend/users/handlers.py) (User operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Staff application"]
  node_frontend_app["App shell<br/>[App.tsx]"]
  node_auth_gate["Authentication gate<br/>[AuthGate.tsx]"]
  node_pos_ui["Point of sale<br/>[PosPage.tsx]"]
  node_pos_logic["Sale workflow<br/>[usePosPage.ts]"]
  node_history_ui["Order history"]
  node_history_logic["History workflow"]
  node_cash_ui["Cash desk<br/>[CashDeskPage.tsx]"]
  node_cash_logic["Cash desk workflow<br/>[useCashDeskPage.ts]"]
  node_statistics_ui["Statistics<br/>[StatisticsPage.tsx]"]
  node_users_ui["User management<br/>[UsersPage.tsx]"]
  node_settings_ui["Settings<br/>[SettingsPage.tsx]"]
end

subgraph group_commerce["Sales and catalog"]
  node_orders_api["Order routes<br/>[router.py]"]
  node_orders_domain["Order operations<br/>[handlers.py]"]
  node_order_store["Orders and tables<br/>[models.py]"]
  node_products_api["Product routes<br/>[router.py]"]
  node_products_domain["Product operations<br/>[handlers.py]"]
  node_product_store["Products and categories<br/>[models.py]"]
end

subgraph group_finance["Financial records"]
  node_cash_api["Cash-desk routes<br/>[router.py]"]
  node_cash_store["Cash-desk records<br/>[models.py]"]
end

subgraph group_identity["Identity and operations"]
  node_backend_api["FastAPI application<br/>[main.py]"]
  node_users_api["User operations<br/>[handlers.py]"]
  node_user_store["User records<br/>[models.py]"]
  node_auth_helpers["Authentication helpers<br/>[helpers.py]"]
  node_cheque_api["Cheque printing<br/>[handlers.py]"]
end

subgraph group_persistence["Backend persistence"]
  node_database[("Database sessions<br/>[database.py]")]
end

node_staff(("Staff user"))

node_staff -->|"opens app"| node_auth_gate
node_auth_gate -.->|"admits session"| node_frontend_app
node_frontend_app -->|"shows sales"| node_pos_ui
node_frontend_app -->|"shows history"| node_history_ui
node_frontend_app -->|"shows cash desk"| node_cash_ui
node_frontend_app -->|"shows statistics"| node_statistics_ui
node_frontend_app -->|"shows users"| node_users_ui
node_frontend_app -->|"shows settings"| node_settings_ui
node_pos_ui -.->|"uses workflow"| node_pos_logic
node_history_ui -.->|"uses workflow"| node_history_logic
node_cash_ui -.->|"uses workflow"| node_cash_logic
node_pos_logic -.->|"requests sales"| node_orders_api
node_history_logic -.->|"requests history"| node_orders_api
node_cash_logic -.->|"requests records"| node_cash_api
node_users_ui -.->|"requests users"| node_users_api
node_statistics_ui -.->|"requests analytics"| node_orders_api
node_backend_api -->|"mounts routes"| node_orders_api
node_backend_api -->|"mounts routes"| node_products_api
node_backend_api -->|"mounts routes"| node_users_api
node_backend_api -->|"mounts routes"| node_cash_api
node_backend_api -->|"mounts on Windows"| node_cheque_api
node_orders_api -->|"dispatches operations"| node_orders_domain
node_orders_domain -->|"queries and writes"| node_order_store
node_orders_domain -->|"reads products"| node_product_store
node_products_api -->|"dispatches operations"| node_products_domain
node_products_domain -->|"queries and writes"| node_product_store
node_cash_api -->|"queries and writes"| node_cash_store
node_cash_api -->|"reads paid orders"| node_order_store
node_users_api -->|"authenticates and hashes"| node_auth_helpers
node_users_api -->|"queries and writes"| node_user_store
node_orders_domain -.->|"uses session"| node_database
node_products_domain -.->|"uses session"| node_database
node_cash_api -->|"gets session"| node_database
node_users_api -->|"gets session"| node_database
node_cheque_api -->|"included conditionally"| node_backend_api

click node_frontend_app "https://github.com/prowider5565/vpos/blob/main/frontend/src/app/App.tsx"
click node_auth_gate "https://github.com/prowider5565/vpos/blob/main/frontend/src/app/AuthGate.tsx"
click node_pos_ui "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/pos/pages/PosPage.tsx"
click node_pos_logic "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/pos/hooks/usePosPage.ts"
click node_history_ui "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/orderHistory/pages/OrderHistoryPage.tsx"
click node_history_logic "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/orderHistory/hooks/useOrderHistoryPage.ts"
click node_cash_ui "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/cashDesk/pages/CashDeskPage.tsx"
click node_cash_logic "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/cashDesk/hooks/useCashDeskPage.ts"
click node_statistics_ui "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/statistics/pages/StatisticsPage.tsx"
click node_users_ui "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/users/pages/UsersPage.tsx"
click node_settings_ui "https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/settings/pages/SettingsPage.tsx"
click node_backend_api "https://github.com/prowider5565/vpos/blob/main/backend/main.py"
click node_orders_api "https://github.com/prowider5565/vpos/blob/main/backend/orders/router.py"
click node_orders_domain "https://github.com/prowider5565/vpos/blob/main/backend/orders/handlers.py"
click node_order_store "https://github.com/prowider5565/vpos/blob/main/backend/orders/models.py"
click node_products_api "https://github.com/prowider5565/vpos/blob/main/backend/products/router.py"
click node_products_domain "https://github.com/prowider5565/vpos/blob/main/backend/products/handlers.py"
click node_product_store "https://github.com/prowider5565/vpos/blob/main/backend/products/models.py"
click node_cash_api "https://github.com/prowider5565/vpos/blob/main/backend/cash_desk/router.py"
click node_cash_store "https://github.com/prowider5565/vpos/blob/main/backend/cash_desk/models.py"
click node_users_api "https://github.com/prowider5565/vpos/blob/main/backend/users/handlers.py"
click node_user_store "https://github.com/prowider5565/vpos/blob/main/backend/users/models.py"
click node_auth_helpers "https://github.com/prowider5565/vpos/blob/main/backend/users/helpers.py"
click node_cheque_api "https://github.com/prowider5565/vpos/blob/main/backend/cheque/handlers.py"
click node_database "https://github.com/prowider5565/vpos/blob/main/backend/config/database.py"

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_frontend_app,node_auth_gate,node_pos_ui,node_pos_logic,node_history_ui,node_history_logic,node_cash_ui,node_cash_logic,node_statistics_ui,node_users_ui,node_settings_ui,node_staff toneBlue
class node_orders_api,node_orders_domain,node_order_store,node_products_api,node_products_domain,node_product_store toneAmber
class node_cash_api,node_cash_store toneMint
class node_backend_api,node_users_api,node_user_store,node_auth_helpers,node_cheque_api toneRose
class node_database toneIndigo
```

## Components

### Staff application

- [App shell](https://github.com/prowider5565/vpos/blob/main/frontend/src/app/App.tsx): `frontend/src/app/App.tsx`
- [Authentication gate](https://github.com/prowider5565/vpos/blob/main/frontend/src/app/AuthGate.tsx): `frontend/src/app/AuthGate.tsx`
- [Point of sale](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/pos/pages/PosPage.tsx): `frontend/src/modules/pos/pages/PosPage.tsx`
- [Sale workflow](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/pos/hooks/usePosPage.ts): `frontend/src/modules/pos/hooks/usePosPage.ts`
- [Order history](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/orderHistory/pages/OrderHistoryPage.tsx): `frontend/src/modules/orderHistory/pages/OrderHistoryPage.tsx`
- [History workflow](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/orderHistory/hooks/useOrderHistoryPage.ts): `frontend/src/modules/orderHistory/hooks/useOrderHistoryPage.ts`
- [Cash desk](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/cashDesk/pages/CashDeskPage.tsx): `frontend/src/modules/cashDesk/pages/CashDeskPage.tsx`
- [Cash desk workflow](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/cashDesk/hooks/useCashDeskPage.ts): `frontend/src/modules/cashDesk/hooks/useCashDeskPage.ts`
- [Statistics](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/statistics/pages/StatisticsPage.tsx): `frontend/src/modules/statistics/pages/StatisticsPage.tsx`
- [User management](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/users/pages/UsersPage.tsx): `frontend/src/modules/users/pages/UsersPage.tsx`
- [Settings](https://github.com/prowider5565/vpos/blob/main/frontend/src/modules/settings/pages/SettingsPage.tsx): `frontend/src/modules/settings/pages/SettingsPage.tsx`

### Sales and catalog

- [Order routes](https://github.com/prowider5565/vpos/blob/main/backend/orders/router.py): `backend/orders/router.py`
- [Order operations](https://github.com/prowider5565/vpos/blob/main/backend/orders/handlers.py): `backend/orders/handlers.py`
- [Orders and tables](https://github.com/prowider5565/vpos/blob/main/backend/orders/models.py): `backend/orders/models.py`
- [Product routes](https://github.com/prowider5565/vpos/blob/main/backend/products/router.py): `backend/products/router.py`
- [Product operations](https://github.com/prowider5565/vpos/blob/main/backend/products/handlers.py): `backend/products/handlers.py`
- [Products and categories](https://github.com/prowider5565/vpos/blob/main/backend/products/models.py): `backend/products/models.py`

### Financial records

- [Cash-desk routes](https://github.com/prowider5565/vpos/blob/main/backend/cash_desk/router.py): `backend/cash_desk/router.py`
- [Cash-desk records](https://github.com/prowider5565/vpos/blob/main/backend/cash_desk/models.py): `backend/cash_desk/models.py`

### Identity and operations

- [FastAPI application](https://github.com/prowider5565/vpos/blob/main/backend/main.py): `backend/main.py`
- [User operations](https://github.com/prowider5565/vpos/blob/main/backend/users/handlers.py): `backend/users/handlers.py`
- [User records](https://github.com/prowider5565/vpos/blob/main/backend/users/models.py): `backend/users/models.py`
- [Authentication helpers](https://github.com/prowider5565/vpos/blob/main/backend/users/helpers.py): `backend/users/helpers.py`
- [Cheque printing](https://github.com/prowider5565/vpos/blob/main/backend/cheque/handlers.py): `backend/cheque/handlers.py`

### Backend persistence

- [Database sessions](https://github.com/prowider5565/vpos/blob/main/backend/config/database.py): `backend/config/database.py`

### Other components

- **Staff user**

## Connections

- Staff user → Authentication gate: opens app
- Authentication gate → App shell: admits session (evidence: `frontend/src/app/App.tsx`)
- App shell → Point of sale: shows sales (evidence: `frontend/src/app/App.tsx`)
- App shell → Order history: shows history (evidence: `frontend/src/app/App.tsx`)
- App shell → Cash desk: shows cash desk (evidence: `frontend/src/app/App.tsx`)
- App shell → Statistics: shows statistics (evidence: `frontend/src/app/App.tsx`)
- App shell → User management: shows users (evidence: `frontend/src/app/App.tsx`)
- App shell → Settings: shows settings (evidence: `frontend/src/app/App.tsx`)
- Point of sale → Sale workflow: uses workflow
- Order history → History workflow: uses workflow
- Cash desk → Cash desk workflow: uses workflow
- Sale workflow → Order routes: requests sales
- History workflow → Order routes: requests history
- Cash desk workflow → Cash-desk routes: requests records
- User management → User operations: requests users
- Statistics → Order routes: requests analytics
- FastAPI application → Order routes: mounts routes (evidence: `backend/main.py`)
- FastAPI application → Product routes: mounts routes (evidence: `backend/main.py`)
- FastAPI application → User operations: mounts routes (evidence: `backend/main.py`)
- FastAPI application → Cash-desk routes: mounts routes (evidence: `backend/main.py`)
- FastAPI application → Cheque printing: mounts on Windows (evidence: `backend/main.py`)
- Order routes → Order operations: dispatches operations (evidence: `backend/orders/router.py`)
- Order operations → Orders and tables: queries and writes (evidence: `backend/orders/handlers.py`)
- Order operations → Products and categories: reads products (evidence: `backend/orders/handlers.py`)
- Product routes → Product operations: dispatches operations (evidence: `backend/products/router.py`)
- Product operations → Products and categories: queries and writes (evidence: `backend/products/handlers.py`)
- Cash-desk routes → Cash-desk records: queries and writes (evidence: `backend/cash_desk/router.py`)
- Cash-desk routes → Orders and tables: reads paid orders (evidence: `backend/cash_desk/router.py`)
- User operations → Authentication helpers: authenticates and hashes (evidence: `backend/users/handlers.py`)
- User operations → User records: queries and writes (evidence: `backend/users/handlers.py`)
- Order operations → Database sessions: uses session
- Product operations → Database sessions: uses session
- Cash-desk routes → Database sessions: gets session (evidence: `backend/cash_desk/router.py`)
- User operations → Database sessions: gets session (evidence: `backend/users/handlers.py`)
- Cheque printing → FastAPI application: included conditionally (evidence: `backend/main.py`)
