# rahmadmrhd/qc-app architecture

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

- Interactive diagram: https://gitdiagram.com/rahmadmrhd/qc-app
- Repository: https://github.com/rahmadmrhd/qc-app

## Overview

QC App is an internal quality-control web application with a Bun/Hono server and MariaDB backend; a companion Electron desktop app and Countrylock device-injection package extend it. The principal workflow is a staff member using the web UI to access operational records and submit actions through server routes into domain services. The graph preserves major README-described product areas and prominent indexed modules. Some subsystem links are omitted because the excerpts do not show their wiring; dashed links indicate relationships that are plausible but not verified here.

Main entry points: [`server/src/routes.ts`](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/routes.ts) (HTTP and API routes), [`server/src/core/db.ts`](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/core/db.ts) (MariaDB), [`web/src/main.tsx`](https://github.com/rahmadmrhd/qc-app/blob/main/web/src/main.tsx) (Web application), [`server/src/main.ts`](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/main.ts) (Server runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interfaces"]
  node_webapp["Web application<br/>[main.tsx]"]
  node_desktopapp["Desktop client<br/>[index.ts]"]
end

subgraph group_server["Server platform"]
  node_serverboot["Server runtime<br/>[main.ts]"]
  node_api["HTTP and API routes<br/>[routes.ts]"]
  node_database[("MariaDB<br/>[db.ts]")]
  node_auth["Authentication"]
end

subgraph group_operations["QC operations"]
  node_access["Access administration"]
  node_serial["Serial workflows"]
  node_warehouse["Serial warehouse"]
  node_sticker["Sticker catalog and stock"]
  node_handover["Handovers"]
  node_postel["Postel records"]
  node_qrcode["QR exports"]
  node_serialroutes["Serial route handlers<br/>[routes.ts]"]
  node_accessroutes["Access route handlers<br/>[routes.ts]"]
  node_stickerroutes["Sticker route handlers<br/>[routes.ts]"]
  node_warehouseroutes["Warehouse route handlers<br/>[routes.ts]"]
end

subgraph group_special["Specialized capabilities"]
  node_dashboard["Dashboards and reports"]
  node_countrylockserver["Countrylock bundles"]
  node_countrylockengine["Device injection engine<br/>[engine.ts]"]
  node_injectscript["Injection planning<br/>[script-template.ts]"]
  node_desktoproutes["Desktop services<br/>[routes.ts]"]
end

subgraph group_shared["Shared contracts"]
  node_contracts["Shared API contracts<br/>[contract.ts]"]
end

node_staff(("QC staff"))

node_staff -->|"uses"| node_webapp
node_webapp -.->|"accesses backend"| node_serverboot
node_serverboot -.->|"serves routes"| node_api
node_api -.->|"dispatches"| node_accessroutes
node_api -.->|"dispatches"| node_serialroutes
node_api -.->|"dispatches"| node_stickerroutes
node_api -.->|"dispatches"| node_warehouseroutes
node_accessroutes -->|"calls services"| node_access
node_serialroutes -->|"calls services"| node_serial
node_stickerroutes -->|"calls services"| node_sticker
node_warehouseroutes -->|"calls handlers"| node_warehouse
node_serial -.->|"reads and writes"| node_database
node_access -.->|"reads and writes"| node_database
node_warehouse -.->|"reads and writes"| node_database
node_sticker -.->|"reads and writes"| node_database
node_desktopapp -.->|"uses services"| node_desktoproutes
node_desktoproutes -.->|"serves bundles"| node_countrylockserver
node_countrylockengine -->|"uses template"| node_injectscript
node_dashboard -.->|"runs widget queries"| node_database
node_api -.->|"routes sign-in"| node_auth
node_webapp -.->|"uses data shapes"| node_contracts
node_api -.->|"uses data shapes"| node_contracts

click node_webapp "https://github.com/rahmadmrhd/qc-app/blob/main/web/src/main.tsx"
click node_desktopapp "https://github.com/rahmadmrhd/qc-app/blob/main/desktop/src/main/index.ts"
click node_serverboot "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/main.ts"
click node_api "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/routes.ts"
click node_database "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/core/db.ts"
click node_auth "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/auth"
click node_access "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/access"
click node_serial "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/serial"
click node_warehouse "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/serialwh"
click node_sticker "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/sticker"
click node_handover "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/handover"
click node_postel "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/postel"
click node_qrcode "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/qrcode"
click node_dashboard "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/dashboard"
click node_countrylockserver "https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/countrylock"
click node_countrylockengine "https://github.com/rahmadmrhd/qc-app/blob/main/countrylock/src/multi/engine.ts"
click node_injectscript "https://github.com/rahmadmrhd/qc-app/blob/main/countrylock/src/script-template.ts"
click node_desktoproutes "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/desktop/routes.ts"
click node_contracts "https://github.com/rahmadmrhd/qc-app/blob/main/shared/contract.ts"
click node_serialroutes "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/serial/routes.ts"
click node_accessroutes "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/access/routes.ts"
click node_stickerroutes "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/sticker/routes.ts"
click node_warehouseroutes "https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/serialwh/routes.ts"

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_webapp,node_desktopapp toneBlue
class node_serverboot,node_api,node_database,node_auth toneAmber
class node_access,node_serial,node_warehouse,node_sticker,node_handover,node_postel,node_qrcode,node_serialroutes,node_accessroutes,node_stickerroutes,node_warehouseroutes toneMint
class node_dashboard,node_countrylockserver,node_countrylockengine,node_injectscript,node_desktoproutes toneRose
class node_contracts,node_staff toneIndigo
```

## Components

### User interfaces

- [Web application](https://github.com/rahmadmrhd/qc-app/blob/main/web/src/main.tsx): `web/src/main.tsx`
- [Desktop client](https://github.com/rahmadmrhd/qc-app/blob/main/desktop/src/main/index.ts): `desktop/src/main/index.ts`

### Server platform

- [Server runtime](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/main.ts): `server/src/main.ts`
- [HTTP and API routes](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/routes.ts): `server/src/routes.ts`
- [MariaDB](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/core/db.ts): `server/src/core/db.ts`
- [Authentication](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/auth): `server/src/modules/auth`

### QC operations

- [Access administration](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/access): `server/src/modules/access`
- [Serial workflows](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/serial): `server/src/modules/serial`
- [Serial warehouse](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/serialwh): `server/src/modules/serialwh`
- [Sticker catalog and stock](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/sticker): `server/src/modules/sticker`
- [Handovers](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/handover): `server/src/modules/handover`
- [Postel records](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/postel): `server/src/modules/postel`
- [QR exports](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/qrcode): `server/src/modules/qrcode`
- [Serial route handlers](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/serial/routes.ts): `server/src/modules/serial/routes.ts`
- [Access route handlers](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/access/routes.ts): `server/src/modules/access/routes.ts`
- [Sticker route handlers](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/sticker/routes.ts): `server/src/modules/sticker/routes.ts`
- [Warehouse route handlers](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/serialwh/routes.ts): `server/src/modules/serialwh/routes.ts`

### Specialized capabilities

- [Dashboards and reports](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/dashboard): `server/src/modules/dashboard`
- [Countrylock bundles](https://github.com/rahmadmrhd/qc-app/tree/main/server/src/modules/countrylock): `server/src/modules/countrylock`
- [Device injection engine](https://github.com/rahmadmrhd/qc-app/blob/main/countrylock/src/multi/engine.ts): `countrylock/src/multi/engine.ts`
- [Injection planning](https://github.com/rahmadmrhd/qc-app/blob/main/countrylock/src/script-template.ts): `countrylock/src/script-template.ts`
- [Desktop services](https://github.com/rahmadmrhd/qc-app/blob/main/server/src/modules/desktop/routes.ts): `server/src/modules/desktop/routes.ts`

### Shared contracts

- [Shared API contracts](https://github.com/rahmadmrhd/qc-app/blob/main/shared/contract.ts): `shared/contract.ts`

### Other components

- **QC staff**

## Connections

- QC staff → Web application: uses (evidence: `README.md`)
- Web application → Server runtime: accesses backend
- Server runtime → HTTP and API routes: serves routes
- HTTP and API routes → Access route handlers: dispatches
- HTTP and API routes → Serial route handlers: dispatches
- HTTP and API routes → Sticker route handlers: dispatches
- HTTP and API routes → Warehouse route handlers: dispatches
- Access route handlers → Access administration: calls services (evidence: `server/src/modules/access/routes.ts`)
- Serial route handlers → Serial workflows: calls services (evidence: `server/src/modules/serial/routes.ts`)
- Sticker route handlers → Sticker catalog and stock: calls services (evidence: `server/src/modules/sticker/routes.ts`)
- Warehouse route handlers → Serial warehouse: calls handlers (evidence: `server/src/modules/serialwh/routes.ts`)
- Serial workflows → MariaDB: reads and writes
- Access administration → MariaDB: reads and writes
- Serial warehouse → MariaDB: reads and writes
- Sticker catalog and stock → MariaDB: reads and writes
- Desktop client → Desktop services: uses services
- Desktop services → Countrylock bundles: serves bundles
- Device injection engine → Injection planning: uses template (evidence: `countrylock/src/multi/engine.ts`)
- Dashboards and reports → MariaDB: runs widget queries
- HTTP and API routes → Authentication: routes sign-in
- Web application → Shared API contracts: uses data shapes
- HTTP and API routes → Shared API contracts: uses data shapes
