# wendirosandi/mtk architecture

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

- Interactive diagram: https://gitdiagram.com/wendirosandi/mtk
- Repository: https://github.com/wendirosandi/mtk

## Overview

This repository combines a student/teacher learning portal, a standalone LKPD assessment engine, Supabase-backed services, and a Pythagoras calendar learning project. The principal portal workflow is login, role-guarded navigation to learning or teacher functions, then viewing grades or managing a student profile. The assessment engine covers question data, generation, rendering, scoring, and packet creation; the calendar project provides calendar and geometry-proof experiences. Edges are limited to relationships visible in excerpts; several modules and the calendar implementation were not sampled, so their links are omitted.

Main entry points: [`lib/router.js`](https://github.com/wendirosandi/mtk/blob/main/lib/router.js) (Role routing), [`lib/portal-api.js`](https://github.com/wendirosandi/mtk/blob/main/lib/portal-api.js) (Portal API), [`pages/nilai.js`](https://github.com/wendirosandi/mtk/blob/main/pages/nilai.js) (Grades and LKPD), [`pages/login.js`](https://github.com/wendirosandi/mtk/blob/main/pages/login.js) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Learning portal"]
  node_router["Role routing<br/>[router.js]"]
  node_portal_api["Portal API<br/>[portal-api.js]"]
  node_login["Login<br/>[login.js]"]
  node_student_dash["Student dashboard<br/>[dash-siswa.js]"]
  node_teacher_dash["Teacher dashboard<br/>[dash-guru.js]"]
  node_activities["Student activities<br/>[aktifitas-siswa.js]"]
  node_grades["Grades and LKPD<br/>[nilai.js]"]
  node_profile["Student profile<br/>[profil-siswa.js]"]
end

subgraph group_lkpd["Assessment engine"]
  node_attempt_state["Attempt state<br/>[APP_STATE.js]"]
  node_question_data["Question pool<br/>[DATA_POOL.js]"]
  node_grid_metadata["Curriculum mapping<br/>[Mesin_Kisi.js]"]
  node_question_generators["Question generators<br/>[GENERATORS.js]"]
  node_packet_generator["Packet generation"]
  node_bank_merge["Question bank merge<br/>[MERGE_BANK.js]"]
  node_question_render["Question rendering"]
  node_svg_generation["Geometry SVGs<br/>[SVG_GENERATORS.js]"]
  node_event_handlers["Answer interactions<br/>[EVENT_HANDLERS.js]"]
  node_scoring["Scoring logic<br/>[SCORING_LOGIC.js]"]
  node_plain_output["Plain output<br/>[PLAIN.js]"]
  node_templates["Assessment templates<br/>[TEMPLATES.js]"]
end

subgraph group_backend["Supabase services"]
  node_transport["Supabase transport<br/>[transport.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_supabase_store[("Supabase data store<br/>[0001_init.sql]")]
end

subgraph group_calendar["Pythagoras calendar"]
  node_calendar_app["Calendar experience<br/>[index.html]"]
  node_calendar_logic["Calendar navigation<br/>[kalender.js]"]
  node_proof_pages["Monthly proof pages"]
  node_geometry_animation["Geometry animations"]
  node_pdf_export["PDF export<br/>[pdf-export.js]"]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_supabase_service[("Supabase service")]

node_student -->|"signs in"| node_login
node_teacher -->|"signs in"| node_login
node_login -->|"authenticates through"| node_portal_api
node_router -->|"checks session and role"| node_portal_api
node_router -.->|"routes to"| node_student_dash
node_router -.->|"routes to"| node_teacher_dash
node_router -.->|"routes to"| node_activities
node_router -.->|"routes to"| node_grades
node_router -.->|"routes to"| node_profile
node_grades -->|"loads and saves"| node_portal_api
node_profile -->|"updates account"| node_portal_api
node_portal_api -->|"posts to configured endpoint"| node_supabase_service
node_transport -->|"calls RPC and auth"| node_supabase_client
node_supabase_client -->|"creates client for"| node_supabase_service
node_supabase_service -.->|"uses schema"| node_supabase_store
node_grades -.->|"opens assessment"| node_attempt_state

click node_router "https://github.com/wendirosandi/mtk/blob/main/lib/router.js"
click node_portal_api "https://github.com/wendirosandi/mtk/blob/main/lib/portal-api.js"
click node_login "https://github.com/wendirosandi/mtk/blob/main/pages/login.js"
click node_student_dash "https://github.com/wendirosandi/mtk/blob/main/pages/dash-siswa.js"
click node_teacher_dash "https://github.com/wendirosandi/mtk/blob/main/pages/dash-guru.js"
click node_activities "https://github.com/wendirosandi/mtk/blob/main/pages/aktifitas-siswa.js"
click node_grades "https://github.com/wendirosandi/mtk/blob/main/pages/nilai.js"
click node_profile "https://github.com/wendirosandi/mtk/blob/main/pages/profil-siswa.js"
click node_attempt_state "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/APP_STATE.js"
click node_question_data "https://github.com/wendirosandi/mtk/blob/main/LKPD/data/DATA_POOL.js"
click node_grid_metadata "https://github.com/wendirosandi/mtk/blob/main/LKPD/data/Mesin_Kisi.js"
click node_question_generators "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/GENERATORS.js"
click node_packet_generator "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/PACKET_GENERATOR.js"
click node_bank_merge "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/MERGE_BANK.js"
click node_question_render "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/FUNCTIONS_RENDER.js"
click node_svg_generation "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/SVG_GENERATORS.js"
click node_event_handlers "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/EVENT_HANDLERS.js"
click node_scoring "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/SCORING_LOGIC.js"
click node_plain_output "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/PLAIN.js"
click node_templates "https://github.com/wendirosandi/mtk/blob/main/LKPD/core/TEMPLATES.js"
click node_transport "https://github.com/wendirosandi/mtk/blob/main/src/lib/transport.js"
click node_supabase_client "https://github.com/wendirosandi/mtk/blob/main/src/lib/supabase.js"
click node_supabase_store "https://github.com/wendirosandi/mtk/blob/main/supabase/migrations/0001_init.sql"
click node_calendar_app "https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/index.html"
click node_calendar_logic "https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/assets/js/kalender.js"
click node_proof_pages "https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/pages/bukti-01-januari.html"
click node_geometry_animation "https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/assets/js/geogebra-perigal-mesin.js"
click node_pdf_export "https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/assets/js/pdf-export.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_router,node_portal_api,node_login,node_student_dash,node_teacher_dash,node_activities,node_grades,node_profile toneBlue
class node_attempt_state,node_question_data,node_grid_metadata,node_question_generators,node_packet_generator,node_bank_merge,node_question_render,node_svg_generation,node_event_handlers,node_scoring,node_plain_output,node_templates,node_supabase_service toneAmber
class node_transport,node_supabase_client,node_supabase_store toneMint
class node_calendar_app,node_calendar_logic,node_proof_pages,node_geometry_animation,node_pdf_export toneRose
class node_student,node_teacher toneIndigo
```

## Components

### Learning portal

- [Role routing](https://github.com/wendirosandi/mtk/blob/main/lib/router.js): `lib/router.js`
- [Portal API](https://github.com/wendirosandi/mtk/blob/main/lib/portal-api.js): `lib/portal-api.js`
- [Login](https://github.com/wendirosandi/mtk/blob/main/pages/login.js): `pages/login.js`
- [Student dashboard](https://github.com/wendirosandi/mtk/blob/main/pages/dash-siswa.js): `pages/dash-siswa.js`
- [Teacher dashboard](https://github.com/wendirosandi/mtk/blob/main/pages/dash-guru.js): `pages/dash-guru.js`
- [Student activities](https://github.com/wendirosandi/mtk/blob/main/pages/aktifitas-siswa.js): `pages/aktifitas-siswa.js`
- [Grades and LKPD](https://github.com/wendirosandi/mtk/blob/main/pages/nilai.js): `pages/nilai.js`
- [Student profile](https://github.com/wendirosandi/mtk/blob/main/pages/profil-siswa.js): `pages/profil-siswa.js`

### Assessment engine

- [Attempt state](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/APP_STATE.js): `LKPD/core/APP_STATE.js`
- [Question pool](https://github.com/wendirosandi/mtk/blob/main/LKPD/data/DATA_POOL.js): `LKPD/data/DATA_POOL.js`
- [Curriculum mapping](https://github.com/wendirosandi/mtk/blob/main/LKPD/data/Mesin_Kisi.js): `LKPD/data/Mesin_Kisi.js`
- [Question generators](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/GENERATORS.js): `LKPD/core/GENERATORS.js`
- [Packet generation](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/PACKET_GENERATOR.js): `LKPD/core/PACKET_GENERATOR.js`
- [Question bank merge](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/MERGE_BANK.js): `LKPD/core/MERGE_BANK.js`
- [Question rendering](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/FUNCTIONS_RENDER.js): `LKPD/core/FUNCTIONS_RENDER.js`
- [Geometry SVGs](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/SVG_GENERATORS.js): `LKPD/core/SVG_GENERATORS.js`
- [Answer interactions](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/EVENT_HANDLERS.js): `LKPD/core/EVENT_HANDLERS.js`
- [Scoring logic](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/SCORING_LOGIC.js): `LKPD/core/SCORING_LOGIC.js`
- [Plain output](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/PLAIN.js): `LKPD/core/PLAIN.js`
- [Assessment templates](https://github.com/wendirosandi/mtk/blob/main/LKPD/core/TEMPLATES.js): `LKPD/core/TEMPLATES.js`

### Supabase services

- [Supabase transport](https://github.com/wendirosandi/mtk/blob/main/src/lib/transport.js): `src/lib/transport.js`
- [Supabase client](https://github.com/wendirosandi/mtk/blob/main/src/lib/supabase.js): `src/lib/supabase.js`
- [Supabase data store](https://github.com/wendirosandi/mtk/blob/main/supabase/migrations/0001_init.sql): `supabase/migrations/0001_init.sql`

### Pythagoras calendar

- [Calendar experience](https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/index.html): `kalender-pythagoras/index.html`
- [Calendar navigation](https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/assets/js/kalender.js): `kalender-pythagoras/assets/js/kalender.js`
- [Monthly proof pages](https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/pages/bukti-01-januari.html): `kalender-pythagoras/pages/bukti-01-januari.html`
- [Geometry animations](https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/assets/js/geogebra-perigal-mesin.js): `kalender-pythagoras/assets/js/geogebra-perigal-mesin.js`
- [PDF export](https://github.com/wendirosandi/mtk/blob/main/kalender-pythagoras/assets/js/pdf-export.js): `kalender-pythagoras/assets/js/pdf-export.js`

### Other components

- **Student**
- **Teacher**
- **Supabase service**

## Connections

- Student → Login: signs in
- Teacher → Login: signs in
- Login → Portal API: authenticates through (evidence: `lib/portal-api.js`)
- Role routing → Portal API: checks session and role (evidence: `lib/router.js`)
- Role routing → Student dashboard: routes to
- Role routing → Teacher dashboard: routes to
- Role routing → Student activities: routes to
- Role routing → Grades and LKPD: routes to
- Role routing → Student profile: routes to
- Grades and LKPD → Portal API: loads and saves (evidence: `pages/nilai.js`)
- Student profile → Portal API: updates account (evidence: `pages/profil-siswa.js`)
- Portal API → Supabase service: posts to configured endpoint (evidence: `lib/portal-api.js`)
- Supabase transport → Supabase client: calls RPC and auth (evidence: `src/lib/transport.js`)
- Supabase client → Supabase service: creates client for (evidence: `src/lib/supabase.js`)
- Supabase service → Supabase data store: uses schema
- Grades and LKPD → Attempt state: opens assessment
