# lokegani/threadpass architecture

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

- Interactive diagram: https://gitdiagram.com/lokegani/threadpass
- Repository: https://github.com/lokegani/threadpass

## Overview

ThreadPass is a static effluent-compliance monitoring demo for textile-dyeing units. Its main workflow generates simulated readings, evaluates them with a 30-day baseline, MAD threshold, sustained-run rule, and satellite/sensor agreement, then presents unit and cluster status. Monitors and units use role-based demo views; buyers can independently check certificates or review printable reports. The README documents the main page capabilities and module responsibilities, but source excerpts are limited to a palette-validation utility, so implementation-level links beyond those statements are omitted.

Main entry points: [`site/assets/js/detect.js`](https://github.com/lokegani/threadpass/blob/main/site/assets/js/detect.js) (Dual-layer detection), [`site/unit.html`](https://github.com/lokegani/threadpass/blob/main/site/unit.html) (Unit detail), [`site/dashboard.html`](https://github.com/lokegani/threadpass/blob/main/site/dashboard.html) (Cluster dashboard), [`site/assets/js/auth.js`](https://github.com/lokegani/threadpass/blob/main/site/assets/js/auth.js) (Demo sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_monitoring["Monitoring method"]
  node_data["Simulated readings<br/>[data.js]"]
  node_detect["Dual-layer detection<br/>[detect.js]"]
end

subgraph group_portal["Monitoring portal"]
  node_auth["Demo sessions<br/>[auth.js]"]
  node_signin["Sign-in<br/>[signin.html]"]
  node_dashboard["Cluster dashboard<br/>[dashboard.html]"]
  node_unit_view["Unit detail<br/>[unit.html]"]
  node_alerts["Alerts<br/>[alerts.html]"]
  node_pending["Pending status<br/>[pending.html]"]
  node_admin["Certificate admin<br/>[admin.html]"]
  node_methodology["Methodology guide<br/>[methodology.html]"]
  node_landing["Product landing<br/>[index.html]"]
end

subgraph group_assurance["Buyer assurance"]
  node_verify["Certificate verification<br/>[verify.html]"]
  node_report["Due-diligence report<br/>[report.html]"]
  node_certificate["Printable certificate<br/>[certificate.html]"]
  node_qr["QR encoder<br/>[qr.js]"]
end

subgraph group_shared["Shared presentation"]
  node_charts["SVG charts<br/>[charts.js]"]
  node_ui["Shared UI<br/>[ui.js]"]
end

node_monitor(("Monitor"))
node_unit_user(("Textile unit"))
node_buyer(("Certificate buyer"))

node_monitor -->|"signs in"| node_signin
node_unit_user -->|"signs in"| node_signin
node_buyer -->|"checks certificate"| node_verify
node_signin -->|"starts session"| node_auth
node_auth -->|"routes by role"| node_dashboard
node_auth -->|"restricts access"| node_admin
node_data -->|"supplies readings"| node_detect
node_detect -->|"determines status"| node_dashboard
node_detect -->|"determines status"| node_unit_view
node_detect -->|"flags events"| node_alerts
node_detect -->|"identifies insufficient history"| node_pending
node_certificate -->|"encodes verification link"| node_qr
node_qr -->|"opens verification"| node_verify
node_monitor -->|"views cluster"| node_dashboard
node_unit_user -->|"views own unit"| node_unit_view
node_dashboard -->|"renders charts"| node_charts
node_unit_view -->|"renders charts"| node_charts
node_unit_view -->|"opens report"| node_report
node_unit_view -->|"opens certificate"| node_certificate
node_landing -->|"explains method"| node_methodology

click node_data "https://github.com/lokegani/threadpass/blob/main/site/assets/js/data.js"
click node_detect "https://github.com/lokegani/threadpass/blob/main/site/assets/js/detect.js"
click node_auth "https://github.com/lokegani/threadpass/blob/main/site/assets/js/auth.js"
click node_signin "https://github.com/lokegani/threadpass/blob/main/site/signin.html"
click node_dashboard "https://github.com/lokegani/threadpass/blob/main/site/dashboard.html"
click node_unit_view "https://github.com/lokegani/threadpass/blob/main/site/unit.html"
click node_alerts "https://github.com/lokegani/threadpass/blob/main/site/alerts.html"
click node_pending "https://github.com/lokegani/threadpass/blob/main/site/pending.html"
click node_admin "https://github.com/lokegani/threadpass/blob/main/site/admin.html"
click node_methodology "https://github.com/lokegani/threadpass/blob/main/site/methodology.html"
click node_landing "https://github.com/lokegani/threadpass/blob/main/site/index.html"
click node_verify "https://github.com/lokegani/threadpass/blob/main/site/verify.html"
click node_report "https://github.com/lokegani/threadpass/blob/main/site/report.html"
click node_certificate "https://github.com/lokegani/threadpass/blob/main/site/certificate.html"
click node_qr "https://github.com/lokegani/threadpass/blob/main/site/assets/js/qr.js"
click node_charts "https://github.com/lokegani/threadpass/blob/main/site/assets/js/charts.js"
click node_ui "https://github.com/lokegani/threadpass/blob/main/site/assets/js/ui.js"

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_data,node_detect toneBlue
class node_auth,node_signin,node_dashboard,node_unit_view,node_alerts,node_pending,node_admin,node_methodology,node_landing toneAmber
class node_verify,node_report,node_certificate,node_qr toneMint
class node_charts,node_ui toneRose
class node_monitor,node_unit_user,node_buyer toneIndigo
```

## Components

### Monitoring method

- [Simulated readings](https://github.com/lokegani/threadpass/blob/main/site/assets/js/data.js): `site/assets/js/data.js`
- [Dual-layer detection](https://github.com/lokegani/threadpass/blob/main/site/assets/js/detect.js): `site/assets/js/detect.js`

### Monitoring portal

- [Demo sessions](https://github.com/lokegani/threadpass/blob/main/site/assets/js/auth.js): `site/assets/js/auth.js`
- [Sign-in](https://github.com/lokegani/threadpass/blob/main/site/signin.html): `site/signin.html`
- [Cluster dashboard](https://github.com/lokegani/threadpass/blob/main/site/dashboard.html): `site/dashboard.html`
- [Unit detail](https://github.com/lokegani/threadpass/blob/main/site/unit.html): `site/unit.html`
- [Alerts](https://github.com/lokegani/threadpass/blob/main/site/alerts.html): `site/alerts.html`
- [Pending status](https://github.com/lokegani/threadpass/blob/main/site/pending.html): `site/pending.html`
- [Certificate admin](https://github.com/lokegani/threadpass/blob/main/site/admin.html): `site/admin.html`
- [Methodology guide](https://github.com/lokegani/threadpass/blob/main/site/methodology.html): `site/methodology.html`
- [Product landing](https://github.com/lokegani/threadpass/blob/main/site/index.html): `site/index.html`

### Buyer assurance

- [Certificate verification](https://github.com/lokegani/threadpass/blob/main/site/verify.html): `site/verify.html`
- [Due-diligence report](https://github.com/lokegani/threadpass/blob/main/site/report.html): `site/report.html`
- [Printable certificate](https://github.com/lokegani/threadpass/blob/main/site/certificate.html): `site/certificate.html`
- [QR encoder](https://github.com/lokegani/threadpass/blob/main/site/assets/js/qr.js): `site/assets/js/qr.js`

### Shared presentation

- [SVG charts](https://github.com/lokegani/threadpass/blob/main/site/assets/js/charts.js): `site/assets/js/charts.js`
- [Shared UI](https://github.com/lokegani/threadpass/blob/main/site/assets/js/ui.js): `site/assets/js/ui.js`

### Other components

- **Monitor**
- **Textile unit**
- **Certificate buyer**

## Connections

- Monitor → Sign-in: signs in (evidence: `README.md`)
- Textile unit → Sign-in: signs in (evidence: `README.md`)
- Certificate buyer → Certificate verification: checks certificate (evidence: `README.md`)
- Sign-in → Demo sessions: starts session (evidence: `README.md`)
- Demo sessions → Cluster dashboard: routes by role (evidence: `README.md`)
- Demo sessions → Certificate admin: restricts access (evidence: `README.md`)
- Simulated readings → Dual-layer detection: supplies readings (evidence: `README.md`)
- Dual-layer detection → Cluster dashboard: determines status (evidence: `README.md`)
- Dual-layer detection → Unit detail: determines status (evidence: `README.md`)
- Dual-layer detection → Alerts: flags events (evidence: `README.md`)
- Dual-layer detection → Pending status: identifies insufficient history (evidence: `README.md`)
- Printable certificate → QR encoder: encodes verification link (evidence: `README.md`)
- QR encoder → Certificate verification: opens verification (evidence: `README.md`)
- Monitor → Cluster dashboard: views cluster (evidence: `README.md`)
- Textile unit → Unit detail: views own unit (evidence: `README.md`)
- Cluster dashboard → SVG charts: renders charts (evidence: `README.md`)
- Unit detail → SVG charts: renders charts (evidence: `README.md`)
- Unit detail → Due-diligence report: opens report (evidence: `README.md`)
- Unit detail → Printable certificate: opens certificate (evidence: `README.md`)
- Product landing → Methodology guide: explains method (evidence: `README.md`)
