# sleepyhead46/emmortal-qr architecture

> Architecture diagram of the GitHub repository sleepyhead46/emmortal-qr, 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/sleepyhead46/emmortal-qr
- Repository: https://github.com/sleepyhead46/emmortal-qr

## Overview

Emmortal is a browser-based QR generator: users choose a purpose, enter details, adjust appearance, preview the code, and export PNG or SVG. The main workflow and rendering, styling, and export responsibilities live in the client-side QR studio; theme preference is a separate browser-local feature. The README documents the purpose formats and privacy behavior, while the sampled source shows the QR library calls and theme persistence. Unsampled implementation details are represented only where the README documents them.

Main entry points: [`app/page.tsx`](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/page.tsx) (Page shell), [`app/theme-toggle.tsx`](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/theme-toggle.tsx) (Theme toggle), [`app/qr-studio.tsx`](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx) (QR preview), [`app/layout.tsx`](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/layout.tsx) (Root layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generator["QR generation"]
  node_studio["QR studio<br/>[qr-studio.tsx]"]
  node_purpose["Purpose forms<br/>[qr-studio.tsx]"]
  node_payload["Payload validation<br/>[qr-studio.tsx]"]
  node_appearance["Style and logo<br/>[qr-studio.tsx]"]
  node_preview["QR preview<br/>[qr-studio.tsx]"]
  node_qrengine["QR renderer"]
  node_export["PNG / SVG export<br/>[qr-studio.tsx]"]
end

subgraph group_presentation["App presentation"]
  node_page["Page shell<br/>[page.tsx]"]
  node_layout["Root layout<br/>[layout.tsx]"]
end

subgraph group_preferences["Local preferences"]
  node_theme["Theme toggle<br/>[theme-toggle.tsx]"]
end

node_visitor(("Visitor"))
node_storage["Browser localStorage"]

node_visitor -->|"opens"| node_page
node_page -->|"renders"| node_studio
node_page -->|"renders"| node_theme
node_visitor -->|"chooses and enters"| node_purpose
node_purpose -->|"validates and encodes"| node_payload
node_visitor -->|"customizes"| node_appearance
node_payload -->|"updates data"| node_preview
node_appearance -->|"updates style"| node_preview
node_studio -->|"creates, updates"| node_qrengine
node_qrengine -->|"renders"| node_preview
node_visitor -->|"requests download"| node_export
node_export -->|"downloads"| node_qrengine
node_visitor -->|"toggles"| node_theme
node_theme -->|"reads and writes preference"| node_storage
node_layout -.->|"wraps"| node_page

click node_studio "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx"
click node_purpose "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx"
click node_payload "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx"
click node_appearance "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx"
click node_preview "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx"
click node_export "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx"
click node_page "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/page.tsx"
click node_layout "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/layout.tsx"
click node_theme "https://github.com/sleepyhead46/emmortal-qr/blob/main/app/theme-toggle.tsx"

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_studio,node_purpose,node_payload,node_appearance,node_preview,node_qrengine,node_export toneBlue
class node_page,node_layout,node_storage toneAmber
class node_theme toneMint
class node_visitor toneIndigo
```

## Components

### QR generation

- [QR studio](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx): `app/qr-studio.tsx`
- [Purpose forms](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx): `app/qr-studio.tsx`
- [Payload validation](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx): `app/qr-studio.tsx`
- [Style and logo](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx): `app/qr-studio.tsx`
- [QR preview](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx): `app/qr-studio.tsx`
- **QR renderer**
- [PNG / SVG export](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/qr-studio.tsx): `app/qr-studio.tsx`

### App presentation

- [Page shell](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/page.tsx): `app/page.tsx`
- [Root layout](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/layout.tsx): `app/layout.tsx`

### Local preferences

- [Theme toggle](https://github.com/sleepyhead46/emmortal-qr/blob/main/app/theme-toggle.tsx): `app/theme-toggle.tsx`

### Other components

- **Visitor**
- **Browser localStorage**

## Connections

- Visitor → Page shell: opens (evidence: `README.md`)
- Page shell → QR studio: renders (evidence: `app/page.tsx`)
- Page shell → Theme toggle: renders (evidence: `app/page.tsx`)
- Visitor → Purpose forms: chooses and enters (evidence: `README.md`)
- Purpose forms → Payload validation: validates and encodes (evidence: `README.md`)
- Visitor → Style and logo: customizes (evidence: `README.md`)
- Payload validation → QR preview: updates data (evidence: `README.md`)
- Style and logo → QR preview: updates style (evidence: `README.md`)
- QR studio → QR renderer: creates, updates (evidence: `app/qr-studio.tsx`)
- QR renderer → QR preview: renders (evidence: `app/qr-studio.tsx`)
- Visitor → PNG / SVG export: requests download (evidence: `README.md`)
- PNG / SVG export → QR renderer: downloads (evidence: `app/qr-studio.tsx`)
- Visitor → Theme toggle: toggles (evidence: `app/theme-toggle.tsx`)
- Theme toggle → Browser localStorage: reads and writes preference (evidence: `app/theme-toggle.tsx`)
- Root layout → Page shell: wraps
