# same-self/tripos architecture

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

- Interactive diagram: https://gitdiagram.com/same-self/tripos
- Repository: https://github.com/same-self/tripos

## Overview

TRIPOS is a web POS and store-management system for a stationery shop with photocopy/printing services. The main workflow is cashier checkout: select goods or services, record payment, save the sale, and—when configured—deduct service materials from stock; the system also supports receipt printing. Admin workflows cover catalog and supplier management, restocking, inventory recommendations, and financial reporting. The graph preserves these documented product branches. Some controller-to-service wiring and route dispatch are not shown in the excerpts, so unverified workflow links are dashed.

Main entry points: [`app/Services/SaleService.php`](https://github.com/same-self/tripos/blob/main/app/Services/SaleService.php) (Sale Processing), [`resources/js/Pages/Pos/Index.jsx`](https://github.com/same-self/tripos/blob/main/resources/js/Pages/Pos/Index.jsx) (POS Screen), [`app/Http/Controllers/LaporanController.php`](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/LaporanController.php) (Financial Reports), [`app/Http/Controllers/Auth/AuthenticatedSessionController.php`](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php) (Login Handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_checkout["Checkout"]
  node_pos_ui["POS Screen<br/>[Index.jsx]"]
  node_pos_controller["POS Handler<br/>[PosController.php]"]
  node_sale_service["Sale Processing<br/>[SaleService.php]"]
  node_sales[("Sales Records<br/>[Sale.php]")]
  node_receipt["Thermal Receipt<br/>[ThermalReceipt.jsx]"]
end

subgraph group_catalog["Catalog &amp; Stock"]
  node_items[("Goods Catalog<br/>[Item.php]")]
  node_services[("Service Catalog<br/>[Service.php]")]
  node_materials[("Service Materials")]
  node_stock_service["Stock Processing<br/>[StockService.php]"]
  node_stock_mutations[("Stock Movements<br/>[StockMutation.php]")]
  node_catalog_admin["Catalog Admin"]
  node_service_admin["Service Admin"]
end

subgraph group_procurement["Procurement"]
  node_restock["Restock Workflow"]
  node_purchase_service["Purchase Processing"]
  node_purchases[("Purchase Records<br/>[Purchase.php]")]
end

subgraph group_insights["Reports &amp; Insights"]
  node_reports["Financial Reports"]
  node_report_service["Dashboard Metrics<br/>[ReportService.php]"]
  node_profitability["Profit Ranking"]
  node_stock_report["Stock Recommendations<br/>[StokController.php]"]
end

subgraph group_access["Access &amp; UI"]
  node_users[("User Accounts<br/>[User.php]")]
  node_role_guard["Role Guard"]
  node_login["Login Handler"]
  node_settings[("Business Settings<br/>[Setting.php]")]
end

node_cashier(("Cashier"))

node_cashier -->|"uses"| node_pos_ui
node_pos_ui -.->|"submits checkout"| node_pos_controller
node_pos_controller -.->|"processes sale"| node_sale_service
node_sale_service -->|"records transaction"| node_sales
node_pos_ui -->|"prints receipt"| node_receipt
node_sale_service -->|"deducts stock"| node_stock_service
node_stock_service -->|"records movements"| node_stock_mutations
node_services -->|"defines composition"| node_materials
node_service_admin -->|"manages services"| node_services
node_catalog_admin -->|"manages goods"| node_items
node_restock -.->|"records restock"| node_purchase_service
node_purchase_service -.->|"creates purchase"| node_purchases
node_reports -->|"reads sales"| node_sales
node_reports -->|"reads purchases"| node_purchases
node_reports -->|"requests ranking"| node_profitability
node_report_service -.->|"builds metrics"| node_profitability
node_stock_report -->|"recommends restock"| node_items
node_login -->|"authenticates"| node_users
node_login -->|"redirects cashier"| node_pos_ui
node_role_guard -.->|"checks role"| node_users
node_sale_service -->|"reads rules"| node_settings

click node_pos_ui "https://github.com/same-self/tripos/blob/main/resources/js/Pages/Pos/Index.jsx"
click node_pos_controller "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/PosController.php"
click node_sale_service "https://github.com/same-self/tripos/blob/main/app/Services/SaleService.php"
click node_sales "https://github.com/same-self/tripos/blob/main/app/Models/Sale.php"
click node_receipt "https://github.com/same-self/tripos/blob/main/resources/js/Components/ThermalReceipt.jsx"
click node_items "https://github.com/same-self/tripos/blob/main/app/Models/Item.php"
click node_services "https://github.com/same-self/tripos/blob/main/app/Models/Service.php"
click node_materials "https://github.com/same-self/tripos/blob/main/app/Models/ServiceMaterial.php"
click node_stock_service "https://github.com/same-self/tripos/blob/main/app/Services/StockService.php"
click node_stock_mutations "https://github.com/same-self/tripos/blob/main/app/Models/StockMutation.php"
click node_catalog_admin "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/BarangController.php"
click node_service_admin "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/LayananController.php"
click node_restock "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/RestokController.php"
click node_purchase_service "https://github.com/same-self/tripos/blob/main/app/Services/PurchaseService.php"
click node_purchases "https://github.com/same-self/tripos/blob/main/app/Models/Purchase.php"
click node_reports "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/LaporanController.php"
click node_report_service "https://github.com/same-self/tripos/blob/main/app/Services/ReportService.php"
click node_profitability "https://github.com/same-self/tripos/blob/main/app/Services/ProfitabilityService.php"
click node_stock_report "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/StokController.php"
click node_users "https://github.com/same-self/tripos/blob/main/app/Models/User.php"
click node_role_guard "https://github.com/same-self/tripos/blob/main/app/Http/Middleware/EnsureUserHasRole.php"
click node_login "https://github.com/same-self/tripos/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_settings "https://github.com/same-self/tripos/blob/main/app/Models/Setting.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_pos_ui,node_pos_controller,node_sale_service,node_sales,node_receipt toneBlue
class node_items,node_services,node_materials,node_stock_service,node_stock_mutations,node_catalog_admin,node_service_admin toneAmber
class node_restock,node_purchase_service,node_purchases toneMint
class node_reports,node_report_service,node_profitability,node_stock_report toneRose
class node_users,node_role_guard,node_login,node_settings,node_cashier toneIndigo
```

## Components

### Checkout

- [POS Screen](https://github.com/same-self/tripos/blob/main/resources/js/Pages/Pos/Index.jsx): `resources/js/Pages/Pos/Index.jsx`
- [POS Handler](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/PosController.php): `app/Http/Controllers/PosController.php`
- [Sale Processing](https://github.com/same-self/tripos/blob/main/app/Services/SaleService.php): `app/Services/SaleService.php`
- [Sales Records](https://github.com/same-self/tripos/blob/main/app/Models/Sale.php): `app/Models/Sale.php`
- [Thermal Receipt](https://github.com/same-self/tripos/blob/main/resources/js/Components/ThermalReceipt.jsx): `resources/js/Components/ThermalReceipt.jsx`

### Catalog & Stock

- [Goods Catalog](https://github.com/same-self/tripos/blob/main/app/Models/Item.php): `app/Models/Item.php`
- [Service Catalog](https://github.com/same-self/tripos/blob/main/app/Models/Service.php): `app/Models/Service.php`
- [Service Materials](https://github.com/same-self/tripos/blob/main/app/Models/ServiceMaterial.php): `app/Models/ServiceMaterial.php`
- [Stock Processing](https://github.com/same-self/tripos/blob/main/app/Services/StockService.php): `app/Services/StockService.php`
- [Stock Movements](https://github.com/same-self/tripos/blob/main/app/Models/StockMutation.php): `app/Models/StockMutation.php`
- [Catalog Admin](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/BarangController.php): `app/Http/Controllers/BarangController.php`
- [Service Admin](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/LayananController.php): `app/Http/Controllers/LayananController.php`

### Procurement

- [Restock Workflow](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/RestokController.php): `app/Http/Controllers/RestokController.php`
- [Purchase Processing](https://github.com/same-self/tripos/blob/main/app/Services/PurchaseService.php): `app/Services/PurchaseService.php`
- [Purchase Records](https://github.com/same-self/tripos/blob/main/app/Models/Purchase.php): `app/Models/Purchase.php`

### Reports & Insights

- [Financial Reports](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/LaporanController.php): `app/Http/Controllers/LaporanController.php`
- [Dashboard Metrics](https://github.com/same-self/tripos/blob/main/app/Services/ReportService.php): `app/Services/ReportService.php`
- [Profit Ranking](https://github.com/same-self/tripos/blob/main/app/Services/ProfitabilityService.php): `app/Services/ProfitabilityService.php`
- [Stock Recommendations](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/StokController.php): `app/Http/Controllers/StokController.php`

### Access & UI

- [User Accounts](https://github.com/same-self/tripos/blob/main/app/Models/User.php): `app/Models/User.php`
- [Role Guard](https://github.com/same-self/tripos/blob/main/app/Http/Middleware/EnsureUserHasRole.php): `app/Http/Middleware/EnsureUserHasRole.php`
- [Login Handler](https://github.com/same-self/tripos/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [Business Settings](https://github.com/same-self/tripos/blob/main/app/Models/Setting.php): `app/Models/Setting.php`

### Other components

- **Cashier**

## Connections

- Cashier → POS Screen: uses
- POS Screen → POS Handler: submits checkout
- POS Handler → Sale Processing: processes sale
- Sale Processing → Sales Records: records transaction (evidence: `app/Services/SaleService.php`)
- POS Screen → Thermal Receipt: prints receipt
- Sale Processing → Stock Processing: deducts stock (evidence: `app/Services/SaleService.php`)
- Stock Processing → Stock Movements: records movements (evidence: `app/Services/StockService.php`)
- Service Catalog → Service Materials: defines composition (evidence: `app/Models/Service.php`)
- Service Admin → Service Catalog: manages services (evidence: `app/Http/Controllers/LayananController.php`)
- Catalog Admin → Goods Catalog: manages goods (evidence: `app/Http/Controllers/BarangController.php`)
- Restock Workflow → Purchase Processing: records restock
- Purchase Processing → Purchase Records: creates purchase
- Financial Reports → Sales Records: reads sales (evidence: `app/Http/Controllers/LaporanController.php`)
- Financial Reports → Purchase Records: reads purchases (evidence: `app/Http/Controllers/LaporanController.php`)
- Financial Reports → Profit Ranking: requests ranking (evidence: `app/Http/Controllers/LaporanController.php`)
- Dashboard Metrics → Profit Ranking: builds metrics (evidence: `app/Services/ReportService.php`)
- Stock Recommendations → Goods Catalog: recommends restock
- Login Handler → User Accounts: authenticates (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Login Handler → POS Screen: redirects cashier (evidence: `app/Http/Controllers/Auth/AuthenticatedSessionController.php`)
- Role Guard → User Accounts: checks role
- Sale Processing → Business Settings: reads rules (evidence: `app/Services/SaleService.php`)
