# saravanakumarmj/qr-scanner-web architecture

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

- Interactive diagram: https://gitdiagram.com/saravanakumarmj/qr-scanner-web
- Repository: https://github.com/saravanakumarmj/qr-scanner-web

## Overview

This is a NiceGUI QR management web application. Users sign in, then use the dashboard and operations pages to generate QR batches, print or reprint labels, and inspect print history; administration provides user and printer management. The graph preserves documented routes and capabilities, while unsampled reports, discard, and other administrative modules are represented by their exact page paths. Some service internals and database relationships are not shown, so uncertain links are omitted.

Main entry points: [`app.py`](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/app.py) (Routes and auth gate), [`database/supabase_db.py`](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/database/supabase_db.py) (Supabase client), [`components/layout.py`](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/layout.py) (Shared page layout), [`services/printer_service.py`](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/printer_service.py) (Printer service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_app["Routes and auth gate<br/>[app.py]"]
  node_login["Sign-in<br/>[login.py]"]
  node_layout["Shared page layout<br/>[layout.py]"]
  node_nav["Navigation<br/>[navigation.py]"]
  node_header["Header<br/>[header.py]"]
  node_footer["Status footer<br/>[footer.py]"]
  node_dashboard["Dashboard<br/>[dashboard.py]"]
  node_reports["Reports<br/>[reports.py]"]
end

subgraph group_domain["QR operations"]
  node_generate["QR generation<br/>[qr_generation.py]"]
  node_qrservice["QR batch service<br/>[qr_service.py]"]
  node_reprint["QR reprint<br/>[qr_reprint.py]"]
  node_history["Print history<br/>[print_history.py]"]
  node_discard["QR discard<br/>[qr_discard.py]"]
  node_printer["Printer service<br/>[printer_service.py]"]
end

subgraph group_admin["Administration"]
  node_useradmin["User administration<br/>[administration.py]"]
  node_user_svc["User service<br/>[user_service.py]"]
  node_auth["Authentication service<br/>[auth_service.py]"]
  node_profile["Profile<br/>[profile.py]"]
  node_admin_other["Device, location, settings, audit<br/>[administration.py]"]
end

subgraph group_infra["Data and integrations"]
  node_db[("Supabase client<br/>[supabase_db.py]")]
  node_dashboard_db["Dashboard queries<br/>[dashboard_db.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

node_user(("Operator"))
node_agent{{"Print agent"}}
node_supabase[("Supabase service")]

node_user -->|"opens pages"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_generate
node_app -->|"routes to"| node_reprint
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_reports
node_app -->|"routes to"| node_useradmin
node_app -->|"routes to"| node_discard
node_app -->|"routes to"| node_profile
node_app -->|"checks session"| node_auth
node_login -->|"authenticates with"| node_auth
node_layout -->|"renders"| node_header
node_layout -->|"renders"| node_nav
node_layout -->|"renders"| node_footer
node_dashboard -->|"uses"| node_layout
node_generate -->|"uses"| node_layout
node_generate -->|"generates batch"| node_qrservice
node_qrservice -->|"reads and writes"| node_db
node_qrservice -->|"submits batch"| node_printer
node_printer -->|"checks and prints"| node_agent
node_printer -->|"reads settings"| node_config
node_reprint -->|"uses"| node_layout
node_reprint -->|"prints labels"| node_printer
node_reprint -->|"reads QR records"| node_db
node_history -->|"uses"| node_layout
node_history -->|"reprints labels"| node_printer
node_history -->|"queries history"| node_db
node_dashboard -->|"loads metrics"| node_dashboard_db
node_dashboard_db -->|"queries data"| node_db
node_useradmin -->|"uses"| node_layout
node_useradmin -->|"manages users"| node_user_svc
node_useradmin -->|"tests printer"| node_printer
node_user_svc -->|"reads and writes"| node_db
node_auth -->|"authenticates via"| node_db
node_auth -->|"builds auth email"| node_user_svc
node_header -->|"checks user"| node_auth
node_footer -->|"shows status"| node_db
node_db -->|"uses settings"| node_config
node_db -->|"connects to"| node_supabase

click node_app "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/app.py"
click node_login "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/login.py"
click node_layout "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/layout.py"
click node_nav "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/navigation.py"
click node_header "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/header.py"
click node_footer "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/footer.py"
click node_dashboard "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/dashboard.py"
click node_reports "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/reports.py"
click node_generate "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/qr_generation.py"
click node_qrservice "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/qr_service.py"
click node_reprint "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/qr_reprint.py"
click node_history "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/print_history.py"
click node_discard "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/qr_discard.py"
click node_printer "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/printer_service.py"
click node_useradmin "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/administration.py"
click node_user_svc "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/user_service.py"
click node_auth "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/auth_service.py"
click node_profile "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/profile.py"
click node_admin_other "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/administration.py"
click node_db "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/database/supabase_db.py"
click node_dashboard_db "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/database/dashboard_db.py"
click node_config "https://github.com/saravanakumarmj/qr-scanner-web/blob/main/config.py"

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_app,node_login,node_layout,node_nav,node_header,node_footer,node_dashboard,node_reports toneBlue
class node_generate,node_qrservice,node_reprint,node_history,node_discard,node_printer,node_supabase toneAmber
class node_useradmin,node_user_svc,node_auth,node_profile,node_admin_other toneMint
class node_db,node_dashboard_db,node_config toneRose
class node_user,node_agent toneIndigo
```

## Components

### Web interface

- [Routes and auth gate](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/app.py): `app.py`
- [Sign-in](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/login.py): `pages/login.py`
- [Shared page layout](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/layout.py): `components/layout.py`
- [Navigation](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/navigation.py): `components/navigation.py`
- [Header](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/header.py): `components/header.py`
- [Status footer](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/components/footer.py): `components/footer.py`
- [Dashboard](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/dashboard.py): `pages/dashboard.py`
- [Reports](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/reports.py): `pages/reports.py`

### QR operations

- [QR generation](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/qr_generation.py): `pages/qr_generation.py`
- [QR batch service](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/qr_service.py): `services/qr_service.py`
- [QR reprint](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/qr_reprint.py): `pages/qr_reprint.py`
- [Print history](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/print_history.py): `pages/print_history.py`
- [QR discard](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/qr_discard.py): `pages/qr_discard.py`
- [Printer service](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/printer_service.py): `services/printer_service.py`

### Administration

- [User administration](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/administration.py): `pages/administration.py`
- [User service](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/user_service.py): `services/user_service.py`
- [Authentication service](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/services/auth_service.py): `services/auth_service.py`
- [Profile](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/profile.py): `pages/profile.py`
- [Device, location, settings, audit](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/pages/administration.py): `pages/administration.py`

### Data and integrations

- [Supabase client](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/database/supabase_db.py): `database/supabase_db.py`
- [Dashboard queries](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/database/dashboard_db.py): `database/dashboard_db.py`
- [Runtime configuration](https://github.com/saravanakumarmj/qr-scanner-web/blob/main/config.py): `config.py`

### Other components

- **Operator**
- **Print agent**
- **Supabase service**

## Connections

- Operator → Routes and auth gate: opens pages (evidence: `app.py`)
- Routes and auth gate → Sign-in: routes to (evidence: `app.py`)
- Routes and auth gate → Dashboard: routes to (evidence: `app.py`)
- Routes and auth gate → QR generation: routes to (evidence: `app.py`)
- Routes and auth gate → QR reprint: routes to (evidence: `app.py`)
- Routes and auth gate → Print history: routes to (evidence: `app.py`)
- Routes and auth gate → Reports: routes to (evidence: `app.py`)
- Routes and auth gate → User administration: routes to (evidence: `app.py`)
- Routes and auth gate → QR discard: routes to (evidence: `app.py`)
- Routes and auth gate → Profile: routes to (evidence: `app.py`)
- Routes and auth gate → Authentication service: checks session (evidence: `app.py`)
- Sign-in → Authentication service: authenticates with (evidence: `pages/login.py`)
- Shared page layout → Header: renders (evidence: `components/layout.py`)
- Shared page layout → Navigation: renders (evidence: `components/layout.py`)
- Shared page layout → Status footer: renders (evidence: `components/layout.py`)
- Dashboard → Shared page layout: uses (evidence: `pages/dashboard.py`)
- QR generation → Shared page layout: uses (evidence: `pages/qr_generation.py`)
- QR generation → QR batch service: generates batch (evidence: `pages/qr_generation.py`)
- QR batch service → Supabase client: reads and writes (evidence: `services/qr_service.py`)
- QR batch service → Printer service: submits batch (evidence: `services/qr_service.py`)
- Printer service → Print agent: checks and prints (evidence: `services/printer_service.py`)
- Printer service → Runtime configuration: reads settings (evidence: `services/printer_service.py`)
- QR reprint → Shared page layout: uses (evidence: `pages/qr_reprint.py`)
- QR reprint → Printer service: prints labels (evidence: `pages/qr_reprint.py`)
- QR reprint → Supabase client: reads QR records (evidence: `pages/qr_reprint.py`)
- Print history → Shared page layout: uses (evidence: `pages/print_history.py`)
- Print history → Printer service: reprints labels (evidence: `pages/print_history.py`)
- Print history → Supabase client: queries history (evidence: `pages/print_history.py`)
- Dashboard → Dashboard queries: loads metrics (evidence: `pages/dashboard.py`)
- Dashboard queries → Supabase client: queries data (evidence: `database/dashboard_db.py`)
- User administration → Shared page layout: uses (evidence: `pages/administration.py`)
- User administration → User service: manages users (evidence: `pages/administration.py`)
- User administration → Printer service: tests printer (evidence: `pages/administration.py`)
- User service → Supabase client: reads and writes (evidence: `services/user_service.py`)
- Authentication service → Supabase client: authenticates via (evidence: `services/auth_service.py`)
- Authentication service → User service: builds auth email (evidence: `services/auth_service.py`)
- Header → Authentication service: checks user (evidence: `components/header.py`)
- Status footer → Supabase client: shows status (evidence: `components/footer.py`)
- Supabase client → Runtime configuration: uses settings (evidence: `database/supabase_db.py`)
- Supabase client → Supabase service: connects to (evidence: `database/supabase_db.py`)
