# nguyenminh121/thesms architecture

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

- Interactive diagram: https://gitdiagram.com/nguyenminh121/thesms
- Repository: https://github.com/nguyenminh121/thesms

## Overview

TheSMS is an offline desktop POS and inventory-management ERP. The main workflow is a staff member using the Vue interface to create or manage a sale; the frontend sends API requests to the local Express backend, whose controllers and business services handle order and stock operations against SQLite through Prisma. The product also covers catalog and warehouse management, partners, pricing, invoices, payments, finance, reporting, users, settings, and printing. README and sampled files support the overall Electron/Vue/Express boundary; most individual feature routes were not sampled, so their internal wiring is left unspecified.

Main entry points: [`src/frontend/src/api/index.js`](https://github.com/nguyenminh121/thesms/blob/main/src/frontend/src/api/index.js) (API client), [`src/backend/controllers/orderController.js`](https://github.com/nguyenminh121/thesms/blob/main/src/backend/controllers/orderController.js) (Order controller), [`src/backend/routes/index.js`](https://github.com/nguyenminh121/thesms/blob/main/src/backend/routes/index.js) (API routes), [`src/backend/utils/prisma.js`](https://github.com/nguyenminh121/thesms/blob/main/src/backend/utils/prisma.js) (Prisma data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_ui["Vue application<br/>[App.vue]"]
  node_api_client["API client<br/>[index.js]"]
end

subgraph group_commerce["Sales and commerce"]
  node_sales["POS and orders"]
  node_order_controller["Order controller<br/>[orderController.js]"]
  node_order_service["Order service<br/>[orderService.js]"]
  node_partners["Partners and pricing"]
  node_billing["Invoices and payments"]
end

subgraph group_operations["Catalog and inventory"]
  node_stock_service["Stock service<br/>[stockService.js]"]
  node_catalog["Product catalog"]
  node_warehouse["Warehouse operations"]
end

subgraph group_platform["Backend platform"]
  node_server["Local API server<br/>[server.js]"]
  node_routes["API routes<br/>[index.js]"]
  node_auth["Authentication<br/>[authService.js]"]
  node_prisma["Prisma data access<br/>[prisma.js]"]
  node_sqlite[("SQLite database<br/>[schema.prisma]")]
end

subgraph group_support["Business support"]
  node_finance_reports["Finance and reports"]
  node_users_settings["Users and settings"]
  node_printing["Printing<br/>[printService.js]"]
end

node_staff(("Store staff"))

node_staff -->|"uses"| node_ui
node_ui -->|"opens sales"| node_sales
node_sales -->|"requests operations"| node_api_client
node_api_client -->|"HTTP requests"| node_server
node_server -->|"mounts API"| node_routes
node_routes -.->|"auth endpoints"| node_auth
node_routes -.->|"order endpoints"| node_order_controller
node_order_controller -->|"calls"| node_order_service
node_order_controller -->|"checks stock"| node_stock_service
node_order_controller -->|"queries"| node_prisma
node_auth -->|"queries users"| node_prisma
node_prisma -->|"reads and writes"| node_sqlite
node_catalog -.->|"uses API"| node_api_client
node_warehouse -.->|"uses API"| node_api_client
node_partners -.->|"uses API"| node_api_client
node_billing -.->|"uses API"| node_api_client
node_finance_reports -.->|"uses API"| node_api_client
node_users_settings -.->|"uses API"| node_api_client
node_printing -.->|"invoice data"| node_sqlite

click node_ui "https://github.com/nguyenminh121/thesms/blob/main/src/frontend/src/App.vue"
click node_sales "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/sales"
click node_api_client "https://github.com/nguyenminh121/thesms/blob/main/src/frontend/src/api/index.js"
click node_server "https://github.com/nguyenminh121/thesms/blob/main/src/backend/server.js"
click node_routes "https://github.com/nguyenminh121/thesms/blob/main/src/backend/routes/index.js"
click node_auth "https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/authService.js"
click node_order_controller "https://github.com/nguyenminh121/thesms/blob/main/src/backend/controllers/orderController.js"
click node_order_service "https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/orderService.js"
click node_stock_service "https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/stockService.js"
click node_catalog "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/products"
click node_warehouse "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/stock-management"
click node_partners "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/partners"
click node_billing "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/invoices"
click node_finance_reports "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/finance"
click node_users_settings "https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/settings"
click node_printing "https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/printService.js"
click node_prisma "https://github.com/nguyenminh121/thesms/blob/main/src/backend/utils/prisma.js"
click node_sqlite "https://github.com/nguyenminh121/thesms/blob/main/database/schema.prisma"

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_ui,node_api_client toneBlue
class node_sales,node_order_controller,node_order_service,node_partners,node_billing toneAmber
class node_stock_service,node_catalog,node_warehouse toneMint
class node_server,node_routes,node_auth,node_prisma,node_sqlite toneRose
class node_finance_reports,node_users_settings,node_printing,node_staff toneIndigo
```

## Components

### Desktop interface

- [Vue application](https://github.com/nguyenminh121/thesms/blob/main/src/frontend/src/App.vue): `src/frontend/src/App.vue`
- [API client](https://github.com/nguyenminh121/thesms/blob/main/src/frontend/src/api/index.js): `src/frontend/src/api/index.js`

### Sales and commerce

- [POS and orders](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/sales): `src/frontend/src/views/sales`
- [Order controller](https://github.com/nguyenminh121/thesms/blob/main/src/backend/controllers/orderController.js): `src/backend/controllers/orderController.js`
- [Order service](https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/orderService.js): `src/backend/services/orderService.js`
- [Partners and pricing](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/partners): `src/frontend/src/views/partners`
- [Invoices and payments](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/invoices): `src/frontend/src/views/invoices`

### Catalog and inventory

- [Stock service](https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/stockService.js): `src/backend/services/stockService.js`
- [Product catalog](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/products): `src/frontend/src/views/products`
- [Warehouse operations](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/stock-management): `src/frontend/src/views/stock-management`

### Backend platform

- [Local API server](https://github.com/nguyenminh121/thesms/blob/main/src/backend/server.js): `src/backend/server.js`
- [API routes](https://github.com/nguyenminh121/thesms/blob/main/src/backend/routes/index.js): `src/backend/routes/index.js`
- [Authentication](https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/authService.js): `src/backend/services/authService.js`
- [Prisma data access](https://github.com/nguyenminh121/thesms/blob/main/src/backend/utils/prisma.js): `src/backend/utils/prisma.js`
- [SQLite database](https://github.com/nguyenminh121/thesms/blob/main/database/schema.prisma): `database/schema.prisma`

### Business support

- [Finance and reports](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/finance): `src/frontend/src/views/finance`
- [Users and settings](https://github.com/nguyenminh121/thesms/tree/main/src/frontend/src/views/settings): `src/frontend/src/views/settings`
- [Printing](https://github.com/nguyenminh121/thesms/blob/main/src/backend/services/printService.js): `src/backend/services/printService.js`

### Other components

- **Store staff**

## Connections

- Store staff → Vue application: uses
- Vue application → POS and orders: opens sales
- POS and orders → API client: requests operations
- API client → Local API server: HTTP requests
- Local API server → API routes: mounts API
- API routes → Authentication: auth endpoints
- API routes → Order controller: order endpoints
- Order controller → Order service: calls
- Order controller → Stock service: checks stock
- Order controller → Prisma data access: queries
- Authentication → Prisma data access: queries users
- Prisma data access → SQLite database: reads and writes
- Product catalog → API client: uses API
- Warehouse operations → API client: uses API
- Partners and pricing → API client: uses API
- Invoices and payments → API client: uses API
- Finance and reports → API client: uses API
- Users and settings → API client: uses API
- Printing → SQLite database: invoice data
