# phalla009/krpos architecture

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

- Interactive diagram: https://gitdiagram.com/phalla009/krpos
- Repository: https://github.com/phalla009/krpos

## Overview

POS_SYS is a Laravel retail point-of-sale application. The main documented workflow is staff setting up the catalog and stock, then processing a checkout and producing a receipt; customer, access-control, reporting, and backup capabilities support store operations. The excerpts show POS checkout reading products and customers and creating orders and payments, plus product management and exports. Routing and several controllers were not sampled, so connections to those workflows are omitted or marked unverified rather than inferred.

Main entry points: [`app/Http/Controllers/PosController.php`](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/PosController.php) (POS checkout), [`app/Models/Order.php`](https://github.com/phalla009/krpos/blob/main/app/Models/Order.php) (Orders and payments), [`app/Models/Product.php`](https://github.com/phalla009/krpos/blob/main/app/Models/Product.php) (Product catalog), [`app/Http/Controllers/OrderController.php`](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/OrderController.php) (Order management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_http["Web application<br/>[index.php]"]
  node_routing["Web routing<br/>[web.php]"]
end

subgraph group_sales["Sales and checkout"]
  node_pos["POS checkout<br/>[PosController.php]"]
  node_orders["Order management"]
  node_orderdata[("Orders and payments<br/>[Order.php]")]
  node_paymentdata[("Payment records<br/>[Payment.php]")]
  node_customers["Customer management"]
  node_customerdata[("Customer records<br/>[Customer.php]")]
end

subgraph group_catalog["Catalog and inventory"]
  node_catalogctl["Product management"]
  node_productdata[("Product catalog<br/>[Product.php]")]
  node_categoryctl["Category management"]
  node_categorydata[("Categories<br/>[Category.php]")]
  node_inventory["Inventory operations"]
  node_inventoryitems[("Inventory items<br/>[InventoryItem.php]")]
end

subgraph group_operations["Store operations"]
  node_reports["Sales reporting"]
  node_reportexport["Report exports<br/>[ReportExport.php]"]
  node_backup["Backup management"]
  node_notifier["Telegram notifications"]
end

subgraph group_access["Access and data"]
  node_users["Staff and roles"]
  node_userdata[("User accounts<br/>[User.php]")]
  node_roles[("Role permissions<br/>[Role.php]")]
  node_database[("Configured database<br/>[database.php]")]
end

node_staff(("Store staff"))
node_bakong{{"Bakong payment service"}}
node_telegram{{"Telegram service"}}

node_staff -->|"uses"| node_http
node_http -->|"loads routes"| node_routing
node_routing -.->|"dispatches to"| node_pos
node_pos -->|"creates and reads"| node_orderdata
node_pos -->|"creates payments"| node_paymentdata
node_pos -->|"checks and deducts stock"| node_productdata
node_pos -->|"loads customers"| node_customerdata
node_pos -->|"checks payment"| node_bakong
node_orders -->|"reads and updates"| node_orderdata
node_orders -->|"loads customers"| node_customerdata
node_orders -->|"loads products"| node_productdata
node_orders -->|"uses payments"| node_paymentdata
node_catalogctl -->|"manages products"| node_productdata
node_catalogctl -->|"loads categories"| node_categorydata
node_catalogctl -->|"imports and exports"| node_productdata
node_categoryctl -->|"manages categories"| node_categorydata
node_inventory -.->|"manages stock"| node_inventoryitems
node_reports -->|"queries sales"| node_orderdata
node_reports -->|"queries customers"| node_customerdata
node_reports -->|"queries inventory"| node_inventoryitems
node_reports -->|"exports reports"| node_reportexport
node_backup -->|"uses notifier"| node_notifier
node_notifier -->|"sends messages"| node_telegram
node_users -->|"manages accounts"| node_userdata
node_userdata -->|"checks permissions"| node_roles
node_orderdata -.->|"persists records"| node_database
node_productdata -->|"belongs to"| node_categorydata
node_customerdata -->|"has many"| node_orderdata

click node_http "https://github.com/phalla009/krpos/blob/main/public/index.php"
click node_routing "https://github.com/phalla009/krpos/blob/main/routes/web.php"
click node_pos "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/PosController.php"
click node_orders "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/OrderController.php"
click node_orderdata "https://github.com/phalla009/krpos/blob/main/app/Models/Order.php"
click node_paymentdata "https://github.com/phalla009/krpos/blob/main/app/Models/Payment.php"
click node_customers "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/CustomerController.php"
click node_customerdata "https://github.com/phalla009/krpos/blob/main/app/Models/Customer.php"
click node_catalogctl "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/ProductController.php"
click node_productdata "https://github.com/phalla009/krpos/blob/main/app/Models/Product.php"
click node_categoryctl "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/CategoryController.php"
click node_categorydata "https://github.com/phalla009/krpos/blob/main/app/Models/Category.php"
click node_inventory "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/InventoryController.php"
click node_inventoryitems "https://github.com/phalla009/krpos/blob/main/app/Models/InventoryItem.php"
click node_reports "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/ReportController.php"
click node_reportexport "https://github.com/phalla009/krpos/blob/main/app/Exports/ReportExport.php"
click node_backup "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/BackupController.php"
click node_notifier "https://github.com/phalla009/krpos/blob/main/app/Services/TelegramNotifier.php"
click node_users "https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/UserManagerController.php"
click node_userdata "https://github.com/phalla009/krpos/blob/main/app/Models/User.php"
click node_roles "https://github.com/phalla009/krpos/blob/main/app/Models/Role.php"
click node_database "https://github.com/phalla009/krpos/blob/main/config/database.php"

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_http,node_routing toneBlue
class node_pos,node_orders,node_orderdata,node_paymentdata,node_customers,node_customerdata toneAmber
class node_catalogctl,node_productdata,node_categoryctl,node_categorydata,node_inventory,node_inventoryitems toneMint
class node_reports,node_reportexport,node_backup,node_notifier toneRose
class node_users,node_userdata,node_roles,node_database,node_staff,node_bakong,node_telegram toneIndigo
```

## Components

### Application entry

- [Web application](https://github.com/phalla009/krpos/blob/main/public/index.php): `public/index.php`
- [Web routing](https://github.com/phalla009/krpos/blob/main/routes/web.php): `routes/web.php`

### Sales and checkout

- [POS checkout](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/PosController.php): `app/Http/Controllers/PosController.php`
- [Order management](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/OrderController.php): `app/Http/Controllers/OrderController.php`
- [Orders and payments](https://github.com/phalla009/krpos/blob/main/app/Models/Order.php): `app/Models/Order.php`
- [Payment records](https://github.com/phalla009/krpos/blob/main/app/Models/Payment.php): `app/Models/Payment.php`
- [Customer management](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/CustomerController.php): `app/Http/Controllers/CustomerController.php`
- [Customer records](https://github.com/phalla009/krpos/blob/main/app/Models/Customer.php): `app/Models/Customer.php`

### Catalog and inventory

- [Product management](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/ProductController.php): `app/Http/Controllers/ProductController.php`
- [Product catalog](https://github.com/phalla009/krpos/blob/main/app/Models/Product.php): `app/Models/Product.php`
- [Category management](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/CategoryController.php): `app/Http/Controllers/CategoryController.php`
- [Categories](https://github.com/phalla009/krpos/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Inventory operations](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/InventoryController.php): `app/Http/Controllers/InventoryController.php`
- [Inventory items](https://github.com/phalla009/krpos/blob/main/app/Models/InventoryItem.php): `app/Models/InventoryItem.php`

### Store operations

- [Sales reporting](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/ReportController.php): `app/Http/Controllers/ReportController.php`
- [Report exports](https://github.com/phalla009/krpos/blob/main/app/Exports/ReportExport.php): `app/Exports/ReportExport.php`
- [Backup management](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/BackupController.php): `app/Http/Controllers/BackupController.php`
- [Telegram notifications](https://github.com/phalla009/krpos/blob/main/app/Services/TelegramNotifier.php): `app/Services/TelegramNotifier.php`

### Access and data

- [Staff and roles](https://github.com/phalla009/krpos/blob/main/app/Http/Controllers/UserManagerController.php): `app/Http/Controllers/UserManagerController.php`
- [User accounts](https://github.com/phalla009/krpos/blob/main/app/Models/User.php): `app/Models/User.php`
- [Role permissions](https://github.com/phalla009/krpos/blob/main/app/Models/Role.php): `app/Models/Role.php`
- [Configured database](https://github.com/phalla009/krpos/blob/main/config/database.php): `config/database.php`

### Other components

- **Store staff**
- **Bakong payment service**
- **Telegram service**

## Connections

- Store staff → Web application: uses
- Web application → Web routing: loads routes
- Web routing → POS checkout: dispatches to
- POS checkout → Orders and payments: creates and reads (evidence: `app/Http/Controllers/PosController.php`)
- POS checkout → Payment records: creates payments (evidence: `app/Http/Controllers/PosController.php`)
- POS checkout → Product catalog: checks and deducts stock (evidence: `app/Http/Controllers/PosController.php`)
- POS checkout → Customer records: loads customers (evidence: `app/Http/Controllers/PosController.php`)
- POS checkout → Bakong payment service: checks payment (evidence: `app/Http/Controllers/PosController.php`)
- Order management → Orders and payments: reads and updates (evidence: `app/Http/Controllers/OrderController.php`)
- Order management → Customer records: loads customers (evidence: `app/Http/Controllers/OrderController.php`)
- Order management → Product catalog: loads products (evidence: `app/Http/Controllers/OrderController.php`)
- Order management → Payment records: uses payments (evidence: `app/Http/Controllers/OrderController.php`)
- Product management → Product catalog: manages products (evidence: `app/Http/Controllers/ProductController.php`)
- Product management → Categories: loads categories (evidence: `app/Http/Controllers/ProductController.php`)
- Product management → Product catalog: imports and exports (evidence: `app/Http/Controllers/ProductController.php`)
- Category management → Categories: manages categories (evidence: `app/Http/Controllers/CategoryController.php`)
- Inventory operations → Inventory items: manages stock
- Sales reporting → Orders and payments: queries sales (evidence: `app/Http/Controllers/ReportController.php`)
- Sales reporting → Customer records: queries customers (evidence: `app/Http/Controllers/ReportController.php`)
- Sales reporting → Inventory items: queries inventory (evidence: `app/Http/Controllers/ReportController.php`)
- Sales reporting → Report exports: exports reports (evidence: `app/Http/Controllers/ReportController.php`)
- Backup management → Telegram notifications: uses notifier (evidence: `app/Http/Controllers/BackupController.php`)
- Telegram notifications → Telegram service: sends messages (evidence: `app/Services/TelegramNotifier.php`)
- Staff and roles → User accounts: manages accounts
- User accounts → Role permissions: checks permissions (evidence: `app/Models/User.php`)
- Orders and payments → Configured database: persists records
- Product catalog → Categories: belongs to (evidence: `app/Models/Product.php`)
- Customer records → Orders and payments: has many (evidence: `app/Models/Customer.php`)
