# pftsafety/ptw architecture

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

- Interactive diagram: https://gitdiagram.com/pftsafety/ptw
- Repository: https://github.com/pftsafety/ptw

## Overview

This appears to be a small browser-based scanning app: the file names identify home and scanner pages, while the service worker explicitly caches those pages and two QR-scanning libraries. The available evidence does not show the pages’ scanning workflow, result handling, or how the manual and PDF are presented, so those relationships are left unspecified.

Main entry points: [`sw.js`](https://github.com/pftsafety/ptw/blob/main/sw.js) (Service worker), [`index.html`](https://github.com/pftsafety/ptw/blob/main/index.html) (Home page), [`scanner.html`](https://github.com/pftsafety/ptw/blob/main/scanner.html) (Scanner page), [`scanner-manifest.json`](https://github.com/pftsafety/ptw/blob/main/scanner-manifest.json) (Scanner manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Scanner app"]
  node_home["Home page<br/>[index.html]"]
  node_scanner["Scanner page<br/>[scanner.html]"]
  node_worker["Service worker<br/>[sw.js]"]
  node_manifest["Scanner manifest"]
end

subgraph group_reference["Reference files"]
  node_manual["User manual<br/>[user-manual.html]"]
  node_record["Record PDF<br/>[tbt-record.pdf]"]
end

node_user(("User"))
node_html5qr["html5-qrcode"]
node_jsqr["jsQR"]

node_worker -->|"caches and refreshes"| node_home
node_worker -->|"caches and refreshes"| node_scanner
node_worker -->|"caches and refreshes"| node_manifest
node_worker -->|"caches and refreshes"| node_html5qr
node_worker -->|"caches and refreshes"| node_jsqr

click node_home "https://github.com/pftsafety/ptw/blob/main/index.html"
click node_scanner "https://github.com/pftsafety/ptw/blob/main/scanner.html"
click node_worker "https://github.com/pftsafety/ptw/blob/main/sw.js"
click node_manifest "https://github.com/pftsafety/ptw/blob/main/scanner-manifest.json"
click node_manual "https://github.com/pftsafety/ptw/blob/main/user-manual.html"
click node_record "https://github.com/pftsafety/ptw/blob/main/tbt-record.pdf"

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_home,node_scanner,node_worker,node_manifest,node_user toneBlue
class node_manual,node_record toneAmber
class node_html5qr,node_jsqr toneIndigo
```

## Components

### Scanner app

- [Home page](https://github.com/pftsafety/ptw/blob/main/index.html): `index.html`
- [Scanner page](https://github.com/pftsafety/ptw/blob/main/scanner.html): `scanner.html`
- [Service worker](https://github.com/pftsafety/ptw/blob/main/sw.js): `sw.js`
- [Scanner manifest](https://github.com/pftsafety/ptw/blob/main/scanner-manifest.json): `scanner-manifest.json`

### Reference files

- [User manual](https://github.com/pftsafety/ptw/blob/main/user-manual.html): `user-manual.html`
- [Record PDF](https://github.com/pftsafety/ptw/blob/main/tbt-record.pdf): `tbt-record.pdf`

### Other components

- **User**
- **html5-qrcode**
- **jsQR**

## Connections

- Service worker → Home page: caches and refreshes (evidence: `sw.js`)
- Service worker → Scanner page: caches and refreshes (evidence: `sw.js`)
- Service worker → Scanner manifest: caches and refreshes (evidence: `sw.js`)
- Service worker → html5-qrcode: caches and refreshes (evidence: `sw.js`)
- Service worker → jsQR: caches and refreshes (evidence: `sw.js`)
