# dimassl/koreksik architecture

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

## Overview

KoreksiK is a server-backed Indonesian answer-sheet correction app. The visible server routes support account access, encrypted question-package management, OCR submission, and correction-result storage/querying; the README is too brief to establish more detailed client-side workflow. The service worker supplies an offline shell while explicitly bypassing API requests. Source excerpts are partial, so links among client-side stages are omitted where no wiring is shown.

Main entry points: [`server.js`](https://github.com/dimassl/koreksik/blob/main/server.js) (HTTP application), [`public/sw.js`](https://github.com/dimassl/koreksik/blob/main/public/sw.js) (Offline shell cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Account access"]
  node_auth["Account and sessions<br/>[server.js]"]
  node_login_limits["Login throttling<br/>[server.js]"]
  node_accounts_db[("Account records<br/>[server.js]")]
end

subgraph group_packages["Question packages"]
  node_packages_api["Package management<br/>[server.js]"]
  node_package_db[("Question packages<br/>[server.js]")]
end

subgraph group_grading["Correction workflow"]
  node_ocr["Answer-sheet OCR<br/>[server.js]"]
  node_gemini["Gemini OCR service"]
  node_other_ocr["Alternate OCR service"]
  node_results_api["Correction results<br/>[server.js]"]
  node_results_db[("Saved results<br/>[server.js]")]
end

subgraph group_runtime["Application runtime"]
  node_server["HTTP application<br/>[server.js]"]
  node_static["Static app files<br/>[server.js]"]
  node_offline[("Offline shell cache<br/>[sw.js]")]
end

node_teacher(("Teacher"))
node_browser(("Browser"))

node_teacher -->|"sends requests"| node_server
node_server -->|"checks login rate"| node_login_limits
node_server -->|"handles auth routes"| node_auth
node_auth -->|"reads and writes"| node_accounts_db
node_server -->|"routes package requests"| node_packages_api
node_packages_api -->|"reads and writes"| node_package_db
node_server -->|"routes OCR requests"| node_ocr
node_ocr -->|"submits image"| node_gemini
node_ocr -->|"submits image"| node_other_ocr
node_server -->|"routes result requests"| node_results_api
node_results_api -->|"reads and writes"| node_results_db
node_server -->|"serves files"| node_static
node_browser -.->|"runs worker"| node_offline
node_offline -->|"caches app shell"| node_static

click node_server "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_auth "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_login_limits "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_accounts_db "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_packages_api "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_package_db "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_ocr "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_results_api "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_results_db "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_static "https://github.com/dimassl/koreksik/blob/main/server.js"
click node_offline "https://github.com/dimassl/koreksik/blob/main/public/sw.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_auth,node_login_limits,node_accounts_db,node_browser toneBlue
class node_packages_api,node_package_db toneAmber
class node_ocr,node_gemini,node_other_ocr,node_results_api,node_results_db toneMint
class node_server,node_static,node_offline toneRose
class node_teacher toneIndigo
```

## Components

### Account access

- [Account and sessions](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- [Login throttling](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- [Account records](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`

### Question packages

- [Package management](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- [Question packages](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`

### Correction workflow

- [Answer-sheet OCR](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- **Gemini OCR service**
- **Alternate OCR service**
- [Correction results](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- [Saved results](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`

### Application runtime

- [HTTP application](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- [Static app files](https://github.com/dimassl/koreksik/blob/main/server.js): `server.js`
- [Offline shell cache](https://github.com/dimassl/koreksik/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Teacher**
- **Browser**

## Connections

- Teacher → HTTP application: sends requests (evidence: `server.js`)
- HTTP application → Login throttling: checks login rate (evidence: `server.js`)
- HTTP application → Account and sessions: handles auth routes (evidence: `server.js`)
- Account and sessions → Account records: reads and writes (evidence: `server.js`)
- HTTP application → Package management: routes package requests (evidence: `server.js`)
- Package management → Question packages: reads and writes (evidence: `server.js`)
- HTTP application → Answer-sheet OCR: routes OCR requests (evidence: `server.js`)
- Answer-sheet OCR → Gemini OCR service: submits image (evidence: `server.js`)
- Answer-sheet OCR → Alternate OCR service: submits image (evidence: `server.js`)
- HTTP application → Correction results: routes result requests (evidence: `server.js`)
- Correction results → Saved results: reads and writes (evidence: `server.js`)
- HTTP application → Static app files: serves files (evidence: `server.js`)
- Browser → Offline shell cache: runs worker
- Offline shell cache → Static app files: caches app shell (evidence: `public/sw.js`)
