# xhamzar/koreksi-lembar-jawab architecture

> Architecture diagram of the GitHub repository xhamzar/koreksi-lembar-jawab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/xhamzar/koreksi-lembar-jawab
- Repository: https://github.com/xhamzar/koreksi-lembar-jawab

## Overview

Koreksi Lembar Jawab is an offline-first PWA for teachers: configure an exam and answer key, print its sheet, scan and correct one or more responses, then review and export results. AppRoot selects the user-facing stages; shared context coordinates state and local persistence. The README documents major capabilities not fully visible in the sampled code, including multi-sheet OMR, offline operation, and backup/restore. Edges use excerpts, the source index, or README statements; unsampled implementation details are not assumed.

Main entry points: [`components/AppRoot.tsx`](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/AppRoot.tsx) (App entry and router), [`components/settings/SettingsView.tsx`](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/SettingsView.tsx) (Exam and answer key), [`components/scanner/ScannerView.tsx`](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/scanner/ScannerView.tsx) (Camera and scan review), [`components/results/ResultsView.tsx`](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/results/ResultsView.tsx) (Rankings and analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_exam_setup["Exam setup"]
  node_settings["Exam and answer key<br/>[SettingsView.tsx]"]
  node_question_count["Question settings"]
  node_answer_key["Answer key editor<br/>[AnswerKeyTab.tsx]"]
  node_template["Printable sheet setup"]
  node_renderer["Sheet renderer"]
end

subgraph group_scanning["Scanning and OMR"]
  node_layout["Sheet geometry<br/>[layout-spec.ts]"]
  node_scanner["Camera and scan review<br/>[ScannerView.tsx]"]
  node_calibrator["Corner calibration"]
  node_worker_client["OMR worker client<br/>[worker-client.ts]"]
  node_omr_worker["Image processing worker<br/>[omr-worker.js]"]
end

subgraph group_assessment["Results and history"]
  node_grading["Scoring and analytics<br/>[engine.ts]"]
  node_results["Rankings and analysis<br/>[ResultsView.tsx]"]
  node_student_detail["Student detail"]
  node_history["Scan history and backup<br/>[HistoryView.tsx]"]
  node_export["Import and report export<br/>[exporters.ts]"]
end

subgraph group_shared["Shared app services"]
  node_app["App entry and router<br/>[AppRoot.tsx]"]
  node_landing["Landing screen<br/>[LandingScreen.tsx]"]
  node_navigation["App navigation<br/>[AppShell.tsx]"]
  node_context["App state and actions<br/>[AppContext.tsx]"]
  node_database[("Local IndexedDB<br/>[db.ts]")]
  node_overlays["Notifications and dialogs<br/>[AppOverlays.tsx]"]
end

subgraph group_offline["Offline PWA"]
  node_service_worker["Offline asset cache<br/>[sw.js]"]
  node_pwa_manifest["PWA manifest<br/>[manifest.ts]"]
end

node_teacher(("Teacher"))

node_teacher -->|"opens"| node_app
node_app -->|"provides state"| node_context
node_app -->|"shows entry"| node_landing
node_app -->|"shows workspace"| node_navigation
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_scanner
node_app -->|"routes to"| node_results
node_app -->|"routes to"| node_history
node_app -->|"renders"| node_overlays
node_settings -->|"shows editor"| node_answer_key
node_settings -->|"shows setup"| node_template
node_settings -->|"configures"| node_question_count
node_template -->|"renders sheet"| node_renderer
node_renderer -->|"uses geometry"| node_layout
node_scanner -->|"offers calibration"| node_calibrator
node_scanner -->|"requests processing"| node_worker_client
node_worker_client -.->|"dispatches scan"| node_omr_worker
node_scanner -->|"evaluates answers"| node_grading
node_results -->|"computes analytics"| node_grading
node_results -->|"opens detail"| node_student_detail
node_results -->|"exports reports"| node_export
node_history -->|"imports roster"| node_export
node_context -->|"loads and saves"| node_database
node_context -->|"recalculates results"| node_grading
node_history -->|"manages records"| node_context
node_service_worker -.->|"serves cached app"| node_teacher
node_pwa_manifest -->|"enables installation"| node_teacher

click node_app "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/AppRoot.tsx"
click node_landing "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/landing/LandingScreen.tsx"
click node_navigation "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/navigation/AppShell.tsx"
click node_context "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/providers/AppContext.tsx"
click node_settings "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/SettingsView.tsx"
click node_question_count "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/QuestionCountSelector.tsx"
click node_answer_key "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/AnswerKeyTab.tsx"
click node_template "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/SheetTemplateTab.tsx"
click node_layout "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/omr/layout-spec.ts"
click node_renderer "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/omr/template-renderer.ts"
click node_scanner "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/scanner/ScannerView.tsx"
click node_calibrator "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/scanner/CornerCalibrator.tsx"
click node_worker_client "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/omr/worker-client.ts"
click node_omr_worker "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/public/workers/omr-worker.js"
click node_grading "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/grading/engine.ts"
click node_results "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/results/ResultsView.tsx"
click node_student_detail "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/results/StudentDetailView.tsx"
click node_history "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/history/HistoryView.tsx"
click node_export "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/export/exporters.ts"
click node_database "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/storage/db.ts"
click node_overlays "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/ui/AppOverlays.tsx"
click node_service_worker "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/public/sw.js"
click node_pwa_manifest "https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/app/manifest.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_settings,node_question_count,node_answer_key,node_template,node_renderer toneBlue
class node_layout,node_scanner,node_calibrator,node_worker_client,node_omr_worker toneAmber
class node_grading,node_results,node_student_detail,node_history,node_export toneMint
class node_app,node_landing,node_navigation,node_context,node_database,node_overlays toneRose
class node_service_worker,node_pwa_manifest,node_teacher toneIndigo
```

## Components

### Exam setup

- [Exam and answer key](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/SettingsView.tsx): `components/settings/SettingsView.tsx`
- [Question settings](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/QuestionCountSelector.tsx): `components/settings/QuestionCountSelector.tsx`
- [Answer key editor](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/AnswerKeyTab.tsx): `components/settings/AnswerKeyTab.tsx`
- [Printable sheet setup](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/settings/SheetTemplateTab.tsx): `components/settings/SheetTemplateTab.tsx`
- [Sheet renderer](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/omr/template-renderer.ts): `lib/omr/template-renderer.ts`

### Scanning and OMR

- [Sheet geometry](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/omr/layout-spec.ts): `lib/omr/layout-spec.ts`
- [Camera and scan review](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/scanner/ScannerView.tsx): `components/scanner/ScannerView.tsx`
- [Corner calibration](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/scanner/CornerCalibrator.tsx): `components/scanner/CornerCalibrator.tsx`
- [OMR worker client](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/omr/worker-client.ts): `lib/omr/worker-client.ts`
- [Image processing worker](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/public/workers/omr-worker.js): `public/workers/omr-worker.js`

### Results and history

- [Scoring and analytics](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/grading/engine.ts): `lib/grading/engine.ts`
- [Rankings and analysis](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/results/ResultsView.tsx): `components/results/ResultsView.tsx`
- [Student detail](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/results/StudentDetailView.tsx): `components/results/StudentDetailView.tsx`
- [Scan history and backup](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/history/HistoryView.tsx): `components/history/HistoryView.tsx`
- [Import and report export](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/export/exporters.ts): `lib/export/exporters.ts`

### Shared app services

- [App entry and router](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/AppRoot.tsx): `components/AppRoot.tsx`
- [Landing screen](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/landing/LandingScreen.tsx): `components/landing/LandingScreen.tsx`
- [App navigation](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/navigation/AppShell.tsx): `components/navigation/AppShell.tsx`
- [App state and actions](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/providers/AppContext.tsx): `components/providers/AppContext.tsx`
- [Local IndexedDB](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/lib/storage/db.ts): `lib/storage/db.ts`
- [Notifications and dialogs](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/components/ui/AppOverlays.tsx): `components/ui/AppOverlays.tsx`

### Offline PWA

- [Offline asset cache](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/public/sw.js): `public/sw.js`
- [PWA manifest](https://github.com/xhamzar/koreksi-lembar-jawab/blob/main/app/manifest.ts): `app/manifest.ts`

### Other components

- **Teacher**

## Connections

- Teacher → App entry and router: opens (evidence: `README.md`)
- App entry and router → App state and actions: provides state (evidence: `components/AppRoot.tsx`)
- App entry and router → Landing screen: shows entry (evidence: `components/AppRoot.tsx`)
- App entry and router → App navigation: shows workspace (evidence: `components/AppRoot.tsx`)
- App entry and router → Exam and answer key: routes to (evidence: `components/AppRoot.tsx`)
- App entry and router → Camera and scan review: routes to (evidence: `components/AppRoot.tsx`)
- App entry and router → Rankings and analysis: routes to (evidence: `components/AppRoot.tsx`)
- App entry and router → Scan history and backup: routes to (evidence: `components/AppRoot.tsx`)
- App entry and router → Notifications and dialogs: renders (evidence: `components/AppRoot.tsx`)
- Exam and answer key → Answer key editor: shows editor (evidence: `components/settings/SettingsView.tsx`)
- Exam and answer key → Printable sheet setup: shows setup (evidence: `components/settings/SettingsView.tsx`)
- Exam and answer key → Question settings: configures (evidence: `components/settings/SettingsView.tsx`)
- Printable sheet setup → Sheet renderer: renders sheet (evidence: `lib/omr/template-renderer.ts`)
- Sheet renderer → Sheet geometry: uses geometry (evidence: `lib/omr/template-renderer.ts`)
- Camera and scan review → Corner calibration: offers calibration (evidence: `components/scanner/ScannerView.tsx`)
- Camera and scan review → OMR worker client: requests processing (evidence: `components/scanner/ScannerView.tsx`)
- OMR worker client → Image processing worker: dispatches scan
- Camera and scan review → Scoring and analytics: evaluates answers (evidence: `components/scanner/ScannerView.tsx`)
- Rankings and analysis → Scoring and analytics: computes analytics (evidence: `components/results/ResultsView.tsx`)
- Rankings and analysis → Student detail: opens detail (evidence: `components/results/ResultsView.tsx`)
- Rankings and analysis → Import and report export: exports reports (evidence: `components/results/ResultsView.tsx`)
- Scan history and backup → Import and report export: imports roster (evidence: `components/history/HistoryView.tsx`)
- App state and actions → Local IndexedDB: loads and saves (evidence: `components/providers/AppContext.tsx`)
- App state and actions → Scoring and analytics: recalculates results (evidence: `components/providers/AppContext.tsx`)
- Scan history and backup → App state and actions: manages records (evidence: `components/history/HistoryView.tsx`)
- Offline asset cache → Teacher: serves cached app
- PWA manifest → Teacher: enables installation (evidence: `README.md`)
