# hammadali-185/industrial-weight-ticket-system architecture

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

- Interactive diagram: https://gitdiagram.com/hammadali-185/industrial-weight-ticket-system
- Repository: https://github.com/hammadali-185/industrial-weight-ticket-system

## Overview

Industrial Weight Ticket System is an Electron desktop application for textile operations. Its main workflow reads weight-indicator data, detects stable readings, presents them live, and supports fabric-roll ticket creation and printing. Separate screens manage generated lists, weight history, inventory, and payments; local persistence and Google Drive backup support those workflows. The graph combines explicit React routing and sampled calls with README-documented capabilities. Some page internals and the Electron bridge implementation were not sampled, so uncertain links are omitted.

Main entry points: [`weight-dashboard/src/utils/storage.js`](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/utils/storage.js) (Storage Utility), [`weight-dashboard/src/App.jsx`](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/App.jsx) (Application Router), [`weight-dashboard/main.cjs`](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main.cjs) (Electron Main), [`weight-dashboard/main/serialManager.cjs`](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main/serialManager.cjs) (Serial Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Runtime"]
  node_app["Application Router<br/>[App.jsx]"]
  node_electron["Electron Main<br/>[main.cjs]"]
  node_preload["Native Bridge<br/>[preload.cjs]"]
end

subgraph group_weight["Weight Capture"]
  node_indicator(("Weighing Indicator"))
  node_serial["Serial Manager<br/>[serialManager.cjs]"]
  node_serialhook["Serial Connection Hook"]
  node_weightcontext["Weight Context<br/>[WeightContext.jsx]"]
  node_live["Live Weight<br/>[LiveWeight.jsx]"]
  node_weightdisplay["Weight Display<br/>[WeightDisplay.jsx]"]
  node_logs["Connection Logs<br/>[LogsPanel.jsx]"]
end

subgraph group_operations["Production Operations"]
  node_ticket["Ticket Generator"]
  node_list["Generate List<br/>[GenerateList.jsx]"]
  node_history["History Management<br/>[History.jsx]"]
  node_inventory["Inventory<br/>[Inventory.jsx]"]
  node_payment["Payments<br/>[Payment.jsx]"]
end

subgraph group_data["Persistence And Backup"]
  node_storage["Storage Utility<br/>[storage.js]"]
  node_localdata[("Local Application Data")]
  node_drive[("Google Drive")]
  node_driveservice["Drive Service"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_app
node_app -->|"provides"| node_weightcontext
node_app -->|"routes to"| node_live
node_app -->|"routes to"| node_ticket
node_app -->|"routes to"| node_list
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_payment
node_app -->|"routes to"| node_inventory
node_weightcontext -->|"uses"| node_serialhook
node_serialhook -->|"receives readings"| node_serial
node_indicator -->|"sends readings"| node_serial
node_serial -->|"scans ports"| node_indicator
node_serial -->|"emits weight"| node_weightcontext
node_weightcontext -->|"provides state"| node_live
node_live -->|"renders"| node_weightdisplay
node_live -->|"renders"| node_logs
node_electron -->|"starts"| node_serial
node_electron -->|"calls"| node_driveservice
node_electron -.->|"exposes bridge"| node_preload
node_ticket -->|"uses weight"| node_weightcontext
node_ticket -->|"prints tickets"| node_operator
node_ticket -->|"generates QR"| node_operator
node_list -->|"loads inventory"| node_storage
node_list -->|"saves records"| node_storage
node_history -->|"manages history"| node_storage
node_inventory -->|"persists stock"| node_storage
node_payment -.->|"persists payments"| node_storage
node_storage -->|"calls native API"| node_preload
node_preload -.->|"forwards requests"| node_electron
node_electron -->|"reads and writes"| node_localdata
node_storage -.->|"uses web storage"| node_localdata
node_history -->|"backs up history"| node_storage
node_storage -->|"requests Drive"| node_preload
node_electron -->|"handles auth and upload"| node_driveservice
node_driveservice -->|"uploads history"| node_drive

click node_app "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/App.jsx"
click node_electron "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main.cjs"
click node_preload "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/preload.cjs"
click node_serial "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main/serialManager.cjs"
click node_serialhook "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/hooks/useSerialConnection.js"
click node_weightcontext "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/context/WeightContext.jsx"
click node_live "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/LiveWeight.jsx"
click node_weightdisplay "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/components/WeightDisplay.jsx"
click node_logs "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/components/LogsPanel.jsx"
click node_ticket "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/TicketGenerator.jsx"
click node_list "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/GenerateList.jsx"
click node_history "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/History.jsx"
click node_inventory "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/Inventory.jsx"
click node_payment "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/Payment.jsx"
click node_storage "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/utils/storage.js"
click node_driveservice "https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main/googleDriveService.cjs"

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_electron,node_preload toneBlue
class node_indicator,node_serial,node_serialhook,node_weightcontext,node_live,node_weightdisplay,node_logs toneAmber
class node_ticket,node_list,node_history,node_inventory,node_payment toneMint
class node_storage,node_localdata,node_drive,node_driveservice toneRose
class node_operator toneIndigo
```

## Components

### Desktop Runtime

- [Application Router](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/App.jsx): `weight-dashboard/src/App.jsx`
- [Electron Main](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main.cjs): `weight-dashboard/main.cjs`
- [Native Bridge](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/preload.cjs): `weight-dashboard/preload.cjs`

### Weight Capture

- **Weighing Indicator**
- [Serial Manager](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main/serialManager.cjs): `weight-dashboard/main/serialManager.cjs`
- [Serial Connection Hook](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/hooks/useSerialConnection.js): `weight-dashboard/src/hooks/useSerialConnection.js`
- [Weight Context](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/context/WeightContext.jsx): `weight-dashboard/src/context/WeightContext.jsx`
- [Live Weight](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/LiveWeight.jsx): `weight-dashboard/src/pages/LiveWeight.jsx`
- [Weight Display](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/components/WeightDisplay.jsx): `weight-dashboard/src/components/WeightDisplay.jsx`
- [Connection Logs](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/components/LogsPanel.jsx): `weight-dashboard/src/components/LogsPanel.jsx`

### Production Operations

- [Ticket Generator](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/TicketGenerator.jsx): `weight-dashboard/src/pages/TicketGenerator.jsx`
- [Generate List](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/GenerateList.jsx): `weight-dashboard/src/pages/GenerateList.jsx`
- [History Management](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/History.jsx): `weight-dashboard/src/pages/History.jsx`
- [Inventory](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/Inventory.jsx): `weight-dashboard/src/pages/Inventory.jsx`
- [Payments](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/pages/Payment.jsx): `weight-dashboard/src/pages/Payment.jsx`

### Persistence And Backup

- [Storage Utility](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/src/utils/storage.js): `weight-dashboard/src/utils/storage.js`
- **Local Application Data**
- **Google Drive**
- [Drive Service](https://github.com/hammadali-185/industrial-weight-ticket-system/blob/main/weight-dashboard/main/googleDriveService.cjs): `weight-dashboard/main/googleDriveService.cjs`

### Other components

- **Operator**

## Connections

- Operator → Application Router: uses
- Application Router → Weight Context: provides (evidence: `weight-dashboard/src/App.jsx`)
- Application Router → Live Weight: routes to (evidence: `weight-dashboard/src/App.jsx`)
- Application Router → Ticket Generator: routes to (evidence: `weight-dashboard/src/App.jsx`)
- Application Router → Generate List: routes to (evidence: `weight-dashboard/src/App.jsx`)
- Application Router → History Management: routes to (evidence: `weight-dashboard/src/App.jsx`)
- Application Router → Payments: routes to (evidence: `weight-dashboard/src/App.jsx`)
- Application Router → Inventory: routes to (evidence: `weight-dashboard/src/App.jsx`)
- Weight Context → Serial Connection Hook: uses (evidence: `weight-dashboard/src/context/WeightContext.jsx`)
- Serial Connection Hook → Serial Manager: receives readings (evidence: `weight-dashboard/src/hooks/useSerialConnection.js`)
- Weighing Indicator → Serial Manager: sends readings
- Serial Manager → Weighing Indicator: scans ports (evidence: `weight-dashboard/main/serialManager.cjs`)
- Serial Manager → Weight Context: emits weight
- Weight Context → Live Weight: provides state (evidence: `weight-dashboard/src/pages/LiveWeight.jsx`)
- Live Weight → Weight Display: renders (evidence: `weight-dashboard/src/pages/LiveWeight.jsx`)
- Live Weight → Connection Logs: renders (evidence: `weight-dashboard/src/pages/LiveWeight.jsx`)
- Electron Main → Serial Manager: starts (evidence: `weight-dashboard/main.cjs`)
- Electron Main → Drive Service: calls (evidence: `weight-dashboard/main.cjs`)
- Electron Main → Native Bridge: exposes bridge
- Ticket Generator → Weight Context: uses weight (evidence: `weight-dashboard/src/pages/TicketGenerator.jsx`)
- Ticket Generator → Operator: prints tickets
- Ticket Generator → Operator: generates QR
- Generate List → Storage Utility: loads inventory (evidence: `weight-dashboard/src/pages/GenerateList.jsx`)
- Generate List → Storage Utility: saves records (evidence: `weight-dashboard/src/pages/GenerateList.jsx`)
- History Management → Storage Utility: manages history (evidence: `weight-dashboard/src/pages/History.jsx`)
- Inventory → Storage Utility: persists stock (evidence: `weight-dashboard/src/pages/Inventory.jsx`)
- Payments → Storage Utility: persists payments (evidence: `weight-dashboard/src/pages/Payment.jsx`)
- Storage Utility → Native Bridge: calls native API (evidence: `weight-dashboard/src/utils/storage.js`)
- Native Bridge → Electron Main: forwards requests
- Electron Main → Local Application Data: reads and writes (evidence: `weight-dashboard/main.cjs`)
- Storage Utility → Local Application Data: uses web storage
- History Management → Storage Utility: backs up history (evidence: `weight-dashboard/src/pages/History.jsx`)
- Storage Utility → Native Bridge: requests Drive (evidence: `weight-dashboard/src/utils/storage.js`)
- Electron Main → Drive Service: handles auth and upload (evidence: `weight-dashboard/main.cjs`)
- Drive Service → Google Drive: uploads history (evidence: `weight-dashboard/main/googleDriveService.cjs`)
