# sebastiangerhaupt/qr_box architecture

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

- Interactive diagram: https://gitdiagram.com/sebastiangerhaupt/qr_box
- Repository: https://github.com/sebastiangerhaupt/qr_box

## Overview

QR Box is a browser-based QR-code generator that also aims to teach how QR codes are created. Its runtime is concentrated in `js/main.js`: the `QR` class prepares encoded content and error-correction data, while `Matrix` builds and draws the QR pattern. The excerpt shows page-load generation of a sample code and a call to draw it; the README describes generating custom codes, but the input interface and the rest of the page wiring were not sampled, so those links are left unverified.

Main entry points: [`js/main.js`](https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js) (Page startup), [`index.html`](https://github.com/sebastiangerhaupt/qr_box/blob/main/index.html) (QR Box page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_encoding["QR encoding"]
  node_encode["QR data encoding<br/>[main.js]"]
  node_correction["Error correction<br/>[main.js]"]
end

subgraph group_matrix["QR matrix"]
  node_matrix["Matrix construction<br/>[main.js]"]
  node_draw["Matrix drawing<br/>[main.js]"]
end

subgraph group_web["Browser runtime"]
  node_page["QR Box page<br/>[index.html]"]
  node_runtime["Page startup<br/>[main.js]"]
end

node_user(("User"))
node_qrresult["QR code"]

node_user -.->|"uses"| node_page
node_page -.->|"loads"| node_runtime
node_runtime -->|"creates QR"| node_encode
node_encode -->|"builds blocks"| node_correction
node_runtime -->|"builds matrix"| node_matrix
node_matrix -->|"draws"| node_draw
node_draw -.->|"renders"| node_qrresult

click node_page "https://github.com/sebastiangerhaupt/qr_box/blob/main/index.html"
click node_runtime "https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js"
click node_encode "https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js"
click node_correction "https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js"
click node_matrix "https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js"
click node_draw "https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.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_encode,node_correction,node_user toneBlue
class node_matrix,node_draw toneAmber
class node_page,node_runtime toneMint
class node_qrresult toneIndigo
```

## Components

### QR encoding

- [QR data encoding](https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js): `js/main.js`
- [Error correction](https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js): `js/main.js`

### QR matrix

- [Matrix construction](https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js): `js/main.js`
- [Matrix drawing](https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js): `js/main.js`

### Browser runtime

- [QR Box page](https://github.com/sebastiangerhaupt/qr_box/blob/main/index.html): `index.html`
- [Page startup](https://github.com/sebastiangerhaupt/qr_box/blob/main/js/main.js): `js/main.js`

### Other components

- **User**
- **QR code**

## Connections

- User → QR Box page: uses
- QR Box page → Page startup: loads
- Page startup → QR data encoding: creates QR (evidence: `js/main.js`)
- QR data encoding → Error correction: builds blocks (evidence: `js/main.js`)
- Page startup → Matrix construction: builds matrix (evidence: `js/main.js`)
- Matrix construction → Matrix drawing: draws (evidence: `js/main.js`)
- Matrix drawing → QR code: renders
