# mkl168-system/mkl-system- architecture

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

- Interactive diagram: https://gitdiagram.com/mkl168-system/mkl-system-
- Repository: https://github.com/mkl168-system/mkl-system-

## Overview

Mekong Laundry Stock System is a browser-based inventory and operations application. Staff sign in, work through inventory, stock movement, purchasing, audit, supplier, and laundry-wood tracking screens, then review operational reports or export/share them. App.tsx owns application state and selects the active views; it loads persisted data through networkDb. The README also describes automatic local-storage saving and JSON backup/restore. Several large view modules are indexed but only partly sampled, so their documented capabilities are represented while unsupported call paths are omitted.

Main entry points: [`src/App.tsx`](https://github.com/mkl168-system/mkl-system-/blob/main/src/App.tsx) (Application State and Routing), [`src/components/ReportsView.tsx`](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/ReportsView.tsx) (Reports), [`src/components/InventoryView.tsx`](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/InventoryView.tsx) (Product Inventory), [`src/utils/telegramBot.ts`](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/telegramBot.ts) (Telegram Reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Shell"]
  node_app["Application State and Routing<br/>[App.tsx]"]
  node_storage["Network Data Loading<br/>[networkDb.ts]"]
  node_firebase[("Firebase<br/>[firebase.ts]")]
end

subgraph group_stock["Inventory Operations"]
  node_inventory["Product Inventory<br/>[InventoryView.tsx]"]
  node_movements["Stock Movements"]
  node_barcode["Barcode Studio"]
  node_scanner["Camera Scanner"]
  node_csv["CSV Import<br/>[CsvImportModal.tsx]"]
  node_audit["Stock Audit<br/>[StockAuditView.tsx]"]
end

subgraph group_business["Business Workflows"]
  node_purchase["Purchase Orders"]
  node_suppliers["Supplier Management<br/>[SuppliersView.tsx]"]
  node_wood["Wood Tracking"]
  node_usage["Daily Usage"]
end

subgraph group_insight["Reports and Integrations"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_reports["Reports<br/>[ReportsView.tsx]"]
  node_pdf["PDF Export<br/>[pdfExporter.ts]"]
  node_telegram["Telegram Reporting<br/>[telegramBot.ts]"]
  node_sheets["Google Sheets<br/>[googleSheets.ts]"]
  node_advisor["AI Advisor<br/>[AIAdvisorView.tsx]"]
  node_backup["Backup and Restore"]
end

subgraph group_shared["Shared Services"]
  node_types["Domain Types<br/>[types.ts]"]
  node_helpers["Inventory and Report Helpers<br/>[helpers.ts]"]
  node_initial["Initial Data<br/>[initialData.ts]"]
  node_voice["Scan Voice Feedback"]
  node_translator["Translations<br/>[translations.ts]"]
end

node_staff(("Staff"))

node_staff -->|"uses"| node_app
node_app -->|"loads data"| node_storage
node_storage -->|"uses"| node_firebase
node_app -->|"renders"| node_wood
node_app -->|"renders"| node_dashboard
node_inventory -->|"opens"| node_scanner
node_inventory -->|"imports"| node_csv
node_barcode -->|"uses"| node_scanner
node_barcode -->|"announces scans"| node_voice
node_movements -->|"exports report"| node_pdf
node_reports -->|"exports reports"| node_pdf
node_reports -->|"sends report"| node_telegram
node_app -->|"sends weekly report"| node_telegram
node_telegram -->|"generates documents"| node_pdf
node_inventory -->|"uses"| node_helpers
node_reports -.->|"integrates"| node_sheets
node_app -.->|"initializes from"| node_initial
node_app -.->|"opens"| node_backup
node_app -.->|"renders"| node_purchase
node_app -.->|"renders"| node_suppliers
node_app -.->|"renders"| node_movements
node_app -.->|"renders"| node_inventory
node_app -.->|"renders"| node_barcode
node_app -.->|"renders"| node_audit
node_app -.->|"renders"| node_reports
node_app -.->|"renders"| node_advisor
node_app -.->|"opens"| node_usage
node_app -->|"models state"| node_types
node_inventory -->|"uses"| node_types
node_reports -->|"uses"| node_types
node_app -->|"reads settings"| node_helpers
node_wood -.->|"uses"| node_telegram
node_purchase -->|"uses"| node_helpers
node_reports -->|"uses"| node_helpers

click node_app "https://github.com/mkl168-system/mkl-system-/blob/main/src/App.tsx"
click node_storage "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/networkDb.ts"
click node_firebase "https://github.com/mkl168-system/mkl-system-/blob/main/src/lib/firebase.ts"
click node_inventory "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/InventoryView.tsx"
click node_movements "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/StockMovementView.tsx"
click node_barcode "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/BarcodeStudioView.tsx"
click node_scanner "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/CameraScannerModal.tsx"
click node_csv "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/CsvImportModal.tsx"
click node_audit "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/StockAuditView.tsx"
click node_purchase "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/PurchaseOrdersView.tsx"
click node_suppliers "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/SuppliersView.tsx"
click node_wood "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/WoodTrackerView.tsx"
click node_usage "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/DailyUsageModal.tsx"
click node_dashboard "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/DashboardView.tsx"
click node_reports "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/ReportsView.tsx"
click node_pdf "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/pdfExporter.ts"
click node_telegram "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/telegramBot.ts"
click node_sheets "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/googleSheets.ts"
click node_advisor "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/AIAdvisorView.tsx"
click node_backup "https://github.com/mkl168-system/mkl-system-/blob/main/src/components/BackupRestoreModal.tsx"
click node_types "https://github.com/mkl168-system/mkl-system-/blob/main/src/types.ts"
click node_helpers "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/helpers.ts"
click node_initial "https://github.com/mkl168-system/mkl-system-/blob/main/src/data/initialData.ts"
click node_voice "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/voiceSynthesizer.ts"
click node_translator "https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/translations.ts"

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_app,node_storage,node_firebase toneBlue
class node_inventory,node_movements,node_barcode,node_scanner,node_csv,node_audit toneAmber
class node_purchase,node_suppliers,node_wood,node_usage toneMint
class node_dashboard,node_reports,node_pdf,node_telegram,node_sheets,node_advisor,node_backup toneRose
class node_types,node_helpers,node_initial,node_voice,node_translator,node_staff toneIndigo
```

## Components

### Application Shell

- [Application State and Routing](https://github.com/mkl168-system/mkl-system-/blob/main/src/App.tsx): `src/App.tsx`
- [Network Data Loading](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/networkDb.ts): `src/utils/networkDb.ts`
- [Firebase](https://github.com/mkl168-system/mkl-system-/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`

### Inventory Operations

- [Product Inventory](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/InventoryView.tsx): `src/components/InventoryView.tsx`
- [Stock Movements](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/StockMovementView.tsx): `src/components/StockMovementView.tsx`
- [Barcode Studio](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/BarcodeStudioView.tsx): `src/components/BarcodeStudioView.tsx`
- [Camera Scanner](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/CameraScannerModal.tsx): `src/components/CameraScannerModal.tsx`
- [CSV Import](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/CsvImportModal.tsx): `src/components/CsvImportModal.tsx`
- [Stock Audit](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/StockAuditView.tsx): `src/components/StockAuditView.tsx`

### Business Workflows

- [Purchase Orders](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/PurchaseOrdersView.tsx): `src/components/PurchaseOrdersView.tsx`
- [Supplier Management](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/SuppliersView.tsx): `src/components/SuppliersView.tsx`
- [Wood Tracking](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/WoodTrackerView.tsx): `src/components/WoodTrackerView.tsx`
- [Daily Usage](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/DailyUsageModal.tsx): `src/components/DailyUsageModal.tsx`

### Reports and Integrations

- [Dashboard](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/DashboardView.tsx): `src/components/DashboardView.tsx`
- [Reports](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/ReportsView.tsx): `src/components/ReportsView.tsx`
- [PDF Export](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/pdfExporter.ts): `src/utils/pdfExporter.ts`
- [Telegram Reporting](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/telegramBot.ts): `src/utils/telegramBot.ts`
- [Google Sheets](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/googleSheets.ts): `src/utils/googleSheets.ts`
- [AI Advisor](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/AIAdvisorView.tsx): `src/components/AIAdvisorView.tsx`
- [Backup and Restore](https://github.com/mkl168-system/mkl-system-/blob/main/src/components/BackupRestoreModal.tsx): `src/components/BackupRestoreModal.tsx`

### Shared Services

- [Domain Types](https://github.com/mkl168-system/mkl-system-/blob/main/src/types.ts): `src/types.ts`
- [Inventory and Report Helpers](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/helpers.ts): `src/utils/helpers.ts`
- [Initial Data](https://github.com/mkl168-system/mkl-system-/blob/main/src/data/initialData.ts): `src/data/initialData.ts`
- [Scan Voice Feedback](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/voiceSynthesizer.ts): `src/utils/voiceSynthesizer.ts`
- [Translations](https://github.com/mkl168-system/mkl-system-/blob/main/src/utils/translations.ts): `src/utils/translations.ts`

### Other components

- **Staff**

## Connections

- Staff → Application State and Routing: uses (evidence: `README.md`)
- Application State and Routing → Network Data Loading: loads data (evidence: `src/App.tsx`)
- Network Data Loading → Firebase: uses (evidence: `src/utils/networkDb.ts`)
- Application State and Routing → Wood Tracking: renders (evidence: `src/App.tsx`)
- Application State and Routing → Dashboard: renders (evidence: `src/App.tsx`)
- Product Inventory → Camera Scanner: opens (evidence: `src/components/InventoryView.tsx`)
- Product Inventory → CSV Import: imports (evidence: `src/components/InventoryView.tsx`)
- Barcode Studio → Camera Scanner: uses (evidence: `src/components/BarcodeStudioView.tsx`)
- Barcode Studio → Scan Voice Feedback: announces scans (evidence: `src/components/BarcodeStudioView.tsx`)
- Stock Movements → PDF Export: exports report (evidence: `src/components/StockMovementView.tsx`)
- Reports → PDF Export: exports reports (evidence: `src/components/ReportsView.tsx`)
- Reports → Telegram Reporting: sends report (evidence: `src/components/ReportsView.tsx`)
- Application State and Routing → Telegram Reporting: sends weekly report (evidence: `src/App.tsx`)
- Telegram Reporting → PDF Export: generates documents (evidence: `src/utils/telegramBot.ts`)
- Product Inventory → Inventory and Report Helpers: uses (evidence: `src/components/InventoryView.tsx`)
- Reports → Google Sheets: integrates (evidence: `src/components/ReportsView.tsx`)
- Application State and Routing → Initial Data: initializes from (evidence: `src/App.tsx`)
- Application State and Routing → Backup and Restore: opens (evidence: `src/App.tsx`)
- Application State and Routing → Purchase Orders: renders (evidence: `src/App.tsx`)
- Application State and Routing → Supplier Management: renders (evidence: `src/App.tsx`)
- Application State and Routing → Stock Movements: renders (evidence: `src/App.tsx`)
- Application State and Routing → Product Inventory: renders (evidence: `src/App.tsx`)
- Application State and Routing → Barcode Studio: renders (evidence: `src/App.tsx`)
- Application State and Routing → Stock Audit: renders (evidence: `src/App.tsx`)
- Application State and Routing → Reports: renders (evidence: `src/App.tsx`)
- Application State and Routing → AI Advisor: renders (evidence: `src/App.tsx`)
- Application State and Routing → Daily Usage: opens (evidence: `src/App.tsx`)
- Application State and Routing → Domain Types: models state (evidence: `src/App.tsx`)
- Product Inventory → Domain Types: uses (evidence: `src/components/InventoryView.tsx`)
- Reports → Domain Types: uses (evidence: `src/components/ReportsView.tsx`)
- Application State and Routing → Inventory and Report Helpers: reads settings (evidence: `src/App.tsx`)
- Wood Tracking → Telegram Reporting: uses (evidence: `src/components/WoodTrackerView.tsx`)
- Purchase Orders → Inventory and Report Helpers: uses (evidence: `src/components/PurchaseOrdersView.tsx`)
- Reports → Inventory and Report Helpers: uses (evidence: `src/components/ReportsView.tsx`)
