# qzind/tray architecture

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

- Interactive diagram: https://gitdiagram.com/qzind/tray
- Repository: https://github.com/qzind/tray

## Overview

QZ Tray is a desktop bridge that lets browser-based clients send print jobs and raw commands to printers or attached devices. The principal workflow begins with a browser client, reaches the tray’s local socket service, and uses its printer or device capabilities; certificate-based site trust controls access. The application also provides printer status, a system-tray UI, and installation, certificate, and provisioning management. The README and sampled source support the product boundaries and several startup and UI calls; unsampled runtime links are omitted or marked unverified.

Main entry points: [`src/qz/ws/PrintSocketClient.java`](https://github.com/qzind/tray/blob/master/src/qz/ws/PrintSocketClient.java) (Socket Request Handler), [`src/qz/App.java`](https://github.com/qzind/tray/blob/master/src/qz/App.java) (Application Startup), [`src/qz/ws/PrintSocketServer.java`](https://github.com/qzind/tray/blob/master/src/qz/ws/PrintSocketServer.java) (Print Socket Service), [`src/qz/installer/certificate/CertificateManager.java`](https://github.com/qzind/tray/blob/master/src/qz/installer/certificate/CertificateManager.java) (Certificate Management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Client and Runtime"]
  node_jsclient["JavaScript Client<br/>[qz-tray.js]"]
  node_app["Application Startup<br/>[App.java]"]
  node_socket["Print Socket Service"]
  node_socketclient["Socket Request Handler"]
  node_prefs["Runtime Preferences<br/>[ArgValue.java]"]
  node_system["Platform Utilities"]
end

subgraph group_trust["Trust and Security"]
  node_cert["Certificate Validation<br/>[Certificate.java]"]
  node_request["Request Authorization<br/>[Request.java]"]
  node_certmgr["Certificate Management"]
end

subgraph group_printing["Printing and Devices"]
  node_matcher["Printer Discovery"]
  node_printactions["Print Processing"]
  node_printerio["Printer I/O<br/>[DeviceIO.java]"]
  node_deviceio["Device Communications<br/>[SerialIO.java]"]
  node_fileio["File Communications<br/>[FileIO.java]"]
end

subgraph group_management["Installation Management"]
  node_installer["Platform Installer<br/>[Installer.java]"]
  node_provision["Provisioning"]
end

subgraph group_experience["Tray and Status"]
  node_status["Printer Status<br/>[StatusMonitor.java]"]
  node_tray["System Tray UI<br/>[TrayManager.java]"]
  node_siteui["Site Trust UI"]
end

node_browser(("Browser"))

node_browser -->|"uses"| node_jsclient
node_jsclient -.->|"connects"| node_socket
node_app -->|"starts"| node_socket
node_app -->|"initializes"| node_certmgr
node_app -->|"configures"| node_installer
node_app -->|"invokes"| node_provision
node_app -->|"queries"| node_system
node_socket -.->|"dispatches"| node_socketclient
node_socketclient -->|"validates"| node_cert
node_socketclient -->|"handles"| node_request
node_socketclient -->|"uses"| node_matcher
node_socketclient -->|"uses"| node_status
node_socketclient -->|"uses"| node_fileio
node_matcher -.->|"selects"| node_printactions
node_printactions -.->|"prints via"| node_printerio
node_socketclient -->|"uses"| node_deviceio
node_tray -->|"discovers"| node_matcher
node_tray -.->|"opens"| node_siteui
node_siteui -->|"manages"| node_certmgr
node_installer -->|"invokes"| node_provision
node_certmgr -->|"checks platform"| node_system
node_prefs -->|"configures"| node_socketclient

click node_jsclient "https://github.com/qzind/tray/blob/master/js/qz-tray.js"
click node_app "https://github.com/qzind/tray/blob/master/src/qz/App.java"
click node_socket "https://github.com/qzind/tray/blob/master/src/qz/ws/PrintSocketServer.java"
click node_socketclient "https://github.com/qzind/tray/blob/master/src/qz/ws/PrintSocketClient.java"
click node_cert "https://github.com/qzind/tray/blob/master/src/qz/auth/Certificate.java"
click node_request "https://github.com/qzind/tray/blob/master/src/qz/auth/Request.java"
click node_certmgr "https://github.com/qzind/tray/blob/master/src/qz/installer/certificate/CertificateManager.java"
click node_matcher "https://github.com/qzind/tray/blob/master/src/qz/printer/PrintServiceMatcher.java"
click node_printactions "https://github.com/qzind/tray/blob/master/src/qz/printer/action/PrintProcessor.java"
click node_printerio "https://github.com/qzind/tray/blob/master/src/qz/communication/DeviceIO.java"
click node_deviceio "https://github.com/qzind/tray/blob/master/src/qz/communication/SerialIO.java"
click node_fileio "https://github.com/qzind/tray/blob/master/src/qz/communication/FileIO.java"
click node_status "https://github.com/qzind/tray/blob/master/src/qz/printer/status/StatusMonitor.java"
click node_tray "https://github.com/qzind/tray/blob/master/src/qz/common/TrayManager.java"
click node_siteui "https://github.com/qzind/tray/blob/master/src/qz/ui/SiteManagerDialog.java"
click node_installer "https://github.com/qzind/tray/blob/master/src/qz/installer/Installer.java"
click node_provision "https://github.com/qzind/tray/blob/master/src/qz/installer/provision/ProvisionInstaller.java"
click node_prefs "https://github.com/qzind/tray/blob/master/src/qz/utils/ArgValue.java"
click node_system "https://github.com/qzind/tray/blob/master/src/qz/utils/SystemUtilities.java"

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_jsclient,node_app,node_socket,node_socketclient,node_prefs,node_system,node_browser toneBlue
class node_cert,node_request,node_certmgr toneAmber
class node_matcher,node_printactions,node_printerio,node_deviceio,node_fileio toneMint
class node_installer,node_provision toneRose
class node_status,node_tray,node_siteui toneIndigo
```

## Components

### Client and Runtime

- [JavaScript Client](https://github.com/qzind/tray/blob/master/js/qz-tray.js): `js/qz-tray.js`
- [Application Startup](https://github.com/qzind/tray/blob/master/src/qz/App.java): `src/qz/App.java`
- [Print Socket Service](https://github.com/qzind/tray/blob/master/src/qz/ws/PrintSocketServer.java): `src/qz/ws/PrintSocketServer.java`
- [Socket Request Handler](https://github.com/qzind/tray/blob/master/src/qz/ws/PrintSocketClient.java): `src/qz/ws/PrintSocketClient.java`
- [Runtime Preferences](https://github.com/qzind/tray/blob/master/src/qz/utils/ArgValue.java): `src/qz/utils/ArgValue.java`
- [Platform Utilities](https://github.com/qzind/tray/blob/master/src/qz/utils/SystemUtilities.java): `src/qz/utils/SystemUtilities.java`

### Trust and Security

- [Certificate Validation](https://github.com/qzind/tray/blob/master/src/qz/auth/Certificate.java): `src/qz/auth/Certificate.java`
- [Request Authorization](https://github.com/qzind/tray/blob/master/src/qz/auth/Request.java): `src/qz/auth/Request.java`
- [Certificate Management](https://github.com/qzind/tray/blob/master/src/qz/installer/certificate/CertificateManager.java): `src/qz/installer/certificate/CertificateManager.java`

### Printing and Devices

- [Printer Discovery](https://github.com/qzind/tray/blob/master/src/qz/printer/PrintServiceMatcher.java): `src/qz/printer/PrintServiceMatcher.java`
- [Print Processing](https://github.com/qzind/tray/blob/master/src/qz/printer/action/PrintProcessor.java): `src/qz/printer/action/PrintProcessor.java`
- [Printer I/O](https://github.com/qzind/tray/blob/master/src/qz/communication/DeviceIO.java): `src/qz/communication/DeviceIO.java`
- [Device Communications](https://github.com/qzind/tray/blob/master/src/qz/communication/SerialIO.java): `src/qz/communication/SerialIO.java`
- [File Communications](https://github.com/qzind/tray/blob/master/src/qz/communication/FileIO.java): `src/qz/communication/FileIO.java`

### Installation Management

- [Platform Installer](https://github.com/qzind/tray/blob/master/src/qz/installer/Installer.java): `src/qz/installer/Installer.java`
- [Provisioning](https://github.com/qzind/tray/blob/master/src/qz/installer/provision/ProvisionInstaller.java): `src/qz/installer/provision/ProvisionInstaller.java`

### Tray and Status

- [Printer Status](https://github.com/qzind/tray/blob/master/src/qz/printer/status/StatusMonitor.java): `src/qz/printer/status/StatusMonitor.java`
- [System Tray UI](https://github.com/qzind/tray/blob/master/src/qz/common/TrayManager.java): `src/qz/common/TrayManager.java`
- [Site Trust UI](https://github.com/qzind/tray/blob/master/src/qz/ui/SiteManagerDialog.java): `src/qz/ui/SiteManagerDialog.java`

### Other components

- **Browser**

## Connections

- Browser → JavaScript Client: uses
- JavaScript Client → Print Socket Service: connects
- Application Startup → Print Socket Service: starts (evidence: `src/qz/App.java`)
- Application Startup → Certificate Management: initializes (evidence: `src/qz/App.java`)
- Application Startup → Platform Installer: configures (evidence: `src/qz/App.java`)
- Application Startup → Provisioning: invokes (evidence: `src/qz/App.java`)
- Application Startup → Platform Utilities: queries (evidence: `src/qz/App.java`)
- Print Socket Service → Socket Request Handler: dispatches (evidence: `src/qz/ws/PrintSocketClient.java`)
- Socket Request Handler → Certificate Validation: validates (evidence: `src/qz/ws/PrintSocketClient.java`)
- Socket Request Handler → Request Authorization: handles (evidence: `src/qz/ws/PrintSocketClient.java`)
- Socket Request Handler → Printer Discovery: uses (evidence: `src/qz/ws/PrintSocketClient.java`)
- Socket Request Handler → Printer Status: uses (evidence: `src/qz/ws/PrintSocketClient.java`)
- Socket Request Handler → File Communications: uses (evidence: `src/qz/ws/PrintSocketClient.java`)
- Printer Discovery → Print Processing: selects
- Print Processing → Printer I/O: prints via
- Socket Request Handler → Device Communications: uses (evidence: `src/qz/ws/PrintSocketClient.java`)
- System Tray UI → Printer Discovery: discovers (evidence: `src/qz/common/TrayManager.java`)
- System Tray UI → Site Trust UI: opens (evidence: `src/qz/common/TrayManager.java`)
- Site Trust UI → Certificate Management: manages (evidence: `src/qz/ui/SiteManagerDialog.java`)
- Platform Installer → Provisioning: invokes (evidence: `src/qz/installer/Installer.java`)
- Certificate Management → Platform Utilities: checks platform (evidence: `src/qz/installer/certificate/CertificateManager.java`)
- Runtime Preferences → Socket Request Handler: configures (evidence: `src/qz/utils/ArgValue.java`)
