# lengocbe/canoto architecture

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

- Interactive diagram: https://gitdiagram.com/lengocbe/canoto
- Repository: https://github.com/lengocbe/canoto

## Overview

CanOTo is a Windows weigh-station application. An operator signs in, captures two stable vehicle weights from a simulator or COM scale, completes a ticket, then previews and prints its two-part slip; the ticket history and audit trail are stored locally. The graph also shows documented catalog, account, configuration, and backup capabilities. Some feature implementations were not sampled, so those nodes use supported enclosing source paths and their links rely on README documentation.

Main entry points: [`source/MainForm.cs`](https://github.com/lengocbe/canoto/blob/main/source/MainForm.cs) (Weighing workspace), [`source/Database.cs`](https://github.com/lengocbe/canoto/blob/main/source/Database.cs) (SQLite tickets and history), [`source/Program.cs`](https://github.com/lengocbe/canoto/blob/main/source/Program.cs) (Application startup), [`source/Scale.cs`](https://github.com/lengocbe/canoto/blob/main/source/Scale.cs) (Scale connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_weighing["Weighing workflow"]
  node_program["Application startup<br/>[Program.cs]"]
  node_main["Weighing workspace<br/>[MainForm.cs]"]
  node_scale["Scale connection<br/>[Scale.cs]"]
  node_decoder["Frame decoder<br/>[Scale.cs]"]
  node_stability["Weight stability<br/>[Scale.cs]"]
end

subgraph group_records["Tickets and records"]
  node_ticket["Ticket model<br/>[Models.cs]"]
  node_database[("SQLite tickets and history<br/>[Database.cs]")]
  node_catalog["Vehicle and item catalogs<br/>[Database.cs]"]
  node_audit["Ticket audit<br/>[Database.cs]"]
  node_backup["Backup and restore<br/>[Database.cs]"]
  node_search["Ticket search<br/>[MainForm.cs]"]
end

subgraph group_printing["Slip printing"]
  node_preview["Slip preview<br/>[Printing.cs]"]
  node_slip["Slip rendering<br/>[Printing.cs]"]
  node_printer["Windows printer"]
end

subgraph group_admin["Setup and access"]
  node_login["User sign-in<br/>[Dialogs.cs]"]
  node_settings["Scale and company settings<br/>[Dialogs.cs]"]
  node_config["Persistent settings<br/>[Models.cs]"]
  node_users["User accounts and passwords<br/>[Users.cs]"]
  node_branding["Company branding<br/>[Branding.cs]"]
end

node_operator(("Operator"))
node_com["COM scale"]

node_operator -->|"starts"| node_program
node_program -->|"opens sign-in"| node_login
node_login -->|"authenticates"| node_users
node_program -->|"opens workspace"| node_main
node_main -->|"connects to"| node_scale
node_scale -->|"reads serial data"| node_com
node_scale -->|"decodes frames"| node_decoder
node_main -->|"checks readings"| node_stability
node_main -->|"captures weights"| node_ticket
node_main -->|"creates and completes tickets"| node_database
node_database -->|"persists ticket data"| node_ticket
node_main -->|"uses catalogs"| node_catalog
node_main -->|"searches history"| node_search
node_database -->|"records changes"| node_audit
node_main -->|"backs up and restores"| node_backup
node_main -->|"opens preview"| node_preview
node_preview -->|"renders slip"| node_slip
node_main -->|"logs print attempts"| node_database
node_main -->|"sends print job"| node_printer
node_settings -->|"saves settings"| node_config
node_settings -->|"imports logo"| node_branding
node_slip -->|"uses ticket logo"| node_branding
node_login -->|"loads account settings"| node_config
node_main -->|"opens configuration"| node_settings

click node_program "https://github.com/lengocbe/canoto/blob/main/source/Program.cs"
click node_login "https://github.com/lengocbe/canoto/blob/main/source/Dialogs.cs"
click node_main "https://github.com/lengocbe/canoto/blob/main/source/MainForm.cs"
click node_scale "https://github.com/lengocbe/canoto/blob/main/source/Scale.cs"
click node_decoder "https://github.com/lengocbe/canoto/blob/main/source/Scale.cs"
click node_stability "https://github.com/lengocbe/canoto/blob/main/source/Scale.cs"
click node_ticket "https://github.com/lengocbe/canoto/blob/main/source/Models.cs"
click node_database "https://github.com/lengocbe/canoto/blob/main/source/Database.cs"
click node_catalog "https://github.com/lengocbe/canoto/blob/main/source/Database.cs"
click node_audit "https://github.com/lengocbe/canoto/blob/main/source/Database.cs"
click node_backup "https://github.com/lengocbe/canoto/blob/main/source/Database.cs"
click node_search "https://github.com/lengocbe/canoto/blob/main/source/MainForm.cs"
click node_preview "https://github.com/lengocbe/canoto/blob/main/source/Printing.cs"
click node_slip "https://github.com/lengocbe/canoto/blob/main/source/Printing.cs"
click node_settings "https://github.com/lengocbe/canoto/blob/main/source/Dialogs.cs"
click node_config "https://github.com/lengocbe/canoto/blob/main/source/Models.cs"
click node_users "https://github.com/lengocbe/canoto/blob/main/source/Users.cs"
click node_branding "https://github.com/lengocbe/canoto/blob/main/source/Branding.cs"

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_program,node_main,node_scale,node_decoder,node_stability toneBlue
class node_ticket,node_database,node_catalog,node_audit,node_backup,node_search toneAmber
class node_preview,node_slip,node_printer toneMint
class node_login,node_settings,node_config,node_users,node_branding toneRose
class node_operator,node_com toneIndigo
```

## Components

### Weighing workflow

- [Application startup](https://github.com/lengocbe/canoto/blob/main/source/Program.cs): `source/Program.cs`
- [Weighing workspace](https://github.com/lengocbe/canoto/blob/main/source/MainForm.cs): `source/MainForm.cs`
- [Scale connection](https://github.com/lengocbe/canoto/blob/main/source/Scale.cs): `source/Scale.cs`
- [Frame decoder](https://github.com/lengocbe/canoto/blob/main/source/Scale.cs): `source/Scale.cs`
- [Weight stability](https://github.com/lengocbe/canoto/blob/main/source/Scale.cs): `source/Scale.cs`

### Tickets and records

- [Ticket model](https://github.com/lengocbe/canoto/blob/main/source/Models.cs): `source/Models.cs`
- [SQLite tickets and history](https://github.com/lengocbe/canoto/blob/main/source/Database.cs): `source/Database.cs`
- [Vehicle and item catalogs](https://github.com/lengocbe/canoto/blob/main/source/Database.cs): `source/Database.cs`
- [Ticket audit](https://github.com/lengocbe/canoto/blob/main/source/Database.cs): `source/Database.cs`
- [Backup and restore](https://github.com/lengocbe/canoto/blob/main/source/Database.cs): `source/Database.cs`
- [Ticket search](https://github.com/lengocbe/canoto/blob/main/source/MainForm.cs): `source/MainForm.cs`

### Slip printing

- [Slip preview](https://github.com/lengocbe/canoto/blob/main/source/Printing.cs): `source/Printing.cs`
- [Slip rendering](https://github.com/lengocbe/canoto/blob/main/source/Printing.cs): `source/Printing.cs`
- **Windows printer**

### Setup and access

- [User sign-in](https://github.com/lengocbe/canoto/blob/main/source/Dialogs.cs): `source/Dialogs.cs`
- [Scale and company settings](https://github.com/lengocbe/canoto/blob/main/source/Dialogs.cs): `source/Dialogs.cs`
- [Persistent settings](https://github.com/lengocbe/canoto/blob/main/source/Models.cs): `source/Models.cs`
- [User accounts and passwords](https://github.com/lengocbe/canoto/blob/main/source/Users.cs): `source/Users.cs`
- [Company branding](https://github.com/lengocbe/canoto/blob/main/source/Branding.cs): `source/Branding.cs`

### Other components

- **Operator**
- **COM scale**

## Connections

- Operator → Application startup: starts (evidence: `README.md`)
- Application startup → User sign-in: opens sign-in (evidence: `source/Program.cs`)
- User sign-in → User accounts and passwords: authenticates (evidence: `source/Dialogs.cs`)
- Application startup → Weighing workspace: opens workspace (evidence: `source/Program.cs`)
- Weighing workspace → Scale connection: connects to (evidence: `source/MainForm.cs`)
- Scale connection → COM scale: reads serial data (evidence: `README.md`)
- Scale connection → Frame decoder: decodes frames (evidence: `source/Scale.cs`)
- Weighing workspace → Weight stability: checks readings (evidence: `source/MainForm.cs`)
- Weighing workspace → Ticket model: captures weights (evidence: `README.md`)
- Weighing workspace → SQLite tickets and history: creates and completes tickets (evidence: `source/MainForm.cs`)
- SQLite tickets and history → Ticket model: persists ticket data (evidence: `source/Database.cs`)
- Weighing workspace → Vehicle and item catalogs: uses catalogs (evidence: `README.md`)
- Weighing workspace → Ticket search: searches history (evidence: `README.md`)
- SQLite tickets and history → Ticket audit: records changes (evidence: `source/Database.cs`)
- Weighing workspace → Backup and restore: backs up and restores (evidence: `README.md`)
- Weighing workspace → Slip preview: opens preview (evidence: `source/MainForm.cs`)
- Slip preview → Slip rendering: renders slip (evidence: `source/Printing.cs`)
- Weighing workspace → SQLite tickets and history: logs print attempts (evidence: `source/MainForm.cs`)
- Weighing workspace → Windows printer: sends print job (evidence: `source/MainForm.cs`)
- Scale and company settings → Persistent settings: saves settings (evidence: `README.md`)
- Scale and company settings → Company branding: imports logo (evidence: `source/Dialogs.cs`)
- Slip rendering → Company branding: uses ticket logo (evidence: `source/Printing.cs`)
- User sign-in → Persistent settings: loads account settings
- Weighing workspace → Scale and company settings: opens configuration (evidence: `README.md`)
