# risa-remaja-indonesia-sehat/risa-v3 architecture

> Architecture diagram of the GitHub repository risa-remaja-indonesia-sehat/risa-v3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/risa-remaja-indonesia-sehat/risa-v3
- Repository: https://github.com/risa-remaja-indonesia-sehat/risa-v3

## Overview

RISA is a frontend learning platform: learners explore seven chapter microlearning modules and games, complete chapter-by-chapter progress, then take a post-test; guardians register, consent, create child profiles, and review progress. The map also covers child login and the Temanku community. Backend services and persistence are external and documented as authoritative; unsampled route implementations are represented only where supported by the tree and README, with uncertain links omitted.

Main entry points: [`lib/api/client.ts`](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/api/client.ts) (Guardian API Client), [`app/chapters`](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/chapters) (Chapter Games), [`components/home/HomeScreen.tsx`](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/home/HomeScreen.tsx) (Progress Home), [`lib/api/child-client.ts`](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/api/child-client.ts) (Child API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning Journey"]
  node_home["Progress Home<br/>[HomeScreen.tsx]"]
  node_progressmap["Chapter Map"]
  node_modules["Chapter Modules"]
  node_renderer["Module Renderer<br/>[ModuleRenderer.tsx]"]
  node_chapterpages["Chapter Routes"]
  node_games["Chapter Games"]
  node_evaluators["Game Evaluators"]
  node_gamerules["Game Rules<br/>[chapter-rules.ts]"]
  node_gameprogress["Progress Logic<br/>[progress.ts]"]
  node_guestprogress["Guest Progress<br/>[guest-progress.ts]"]
  node_posttest["Post-Test"]
end

subgraph group_identity["Accounts &amp; Consent"]
  node_guardianroutes["Guardian Routes"]
  node_consent["Consent Flow<br/>[page.tsx]"]
  node_childsetup["Child Setup"]
  node_childlogin["Child Login"]
  node_sessionhook["Child Session<br/>[useChildSession.ts]"]
end

subgraph group_family["Guardian Tools"]
  node_dashboard["Guardian Dashboard"]
end

subgraph group_community["Child Community"]
  node_temanku["Temanku Community<br/>[TemankuContent.tsx]"]
end

subgraph group_integration["API Integrations"]
  node_guardianapi["Guardian API Client<br/>[client.ts]"]
  node_supabase["Supabase Auth<br/>[client.ts]"]
  node_childapi["Child API Client<br/>[child-client.ts]"]
  node_backend["RISA Backend"]
end

node_learner(("Learner"))
node_guardian(("Guardian"))

node_learner -->|"opens"| node_home
node_home -->|"shows progress"| node_progressmap
node_progressmap -->|"selects chapter"| node_chapterpages
node_chapterpages -->|"renders lessons"| node_modules
node_modules -->|"renders blocks"| node_renderer
node_chapterpages -->|"opens games"| node_games
node_games -->|"evaluates answers"| node_evaluators
node_games -->|"checks rules"| node_gamerules
node_games -->|"updates progress"| node_gameprogress
node_games -.->|"stores guest score"| node_guestprogress
node_home -.->|"reads guest status"| node_guestprogress
node_home -->|"opens after completion"| node_posttest
node_posttest -->|"loads and submits"| node_childapi
node_childapi -->|"sends cookie requests"| node_backend
node_guardian -->|"registers or logs in"| node_guardianroutes
node_guardianroutes -->|"authenticates"| node_supabase
node_guardianroutes -->|"requests guardian actions"| node_guardianapi
node_guardianapi -->|"reads access token"| node_supabase
node_guardianapi -->|"sends bearer requests"| node_backend
node_guardianroutes -->|"starts consent"| node_consent
node_consent -->|"validates consent"| node_guardianapi
node_consent -->|"continues when valid"| node_childsetup
node_childsetup -->|"creates child profile"| node_guardianapi
node_childlogin -->|"logs in child"| node_childapi
node_sessionhook -->|"checks and ends session"| node_childapi
node_sessionhook -->|"provides child progress"| node_home
node_guardian -->|"views family progress"| node_dashboard
node_dashboard -->|"loads dashboard"| node_guardianapi
node_learner -->|"shares and reads"| node_temanku
node_temanku -->|"checks child session"| node_sessionhook
node_temanku -->|"manages community content"| node_childapi

click node_home "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/home/HomeScreen.tsx"
click node_progressmap "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/home/SunflowerProgressMap.tsx"
click node_modules "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/modules/ChapterModulePage.tsx"
click node_renderer "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/modules/ModuleRenderer.tsx"
click node_chapterpages "https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/chapters"
click node_games "https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/chapters"
click node_evaluators "https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/lib/game/evaluate"
click node_gamerules "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/game/chapter-rules.ts"
click node_gameprogress "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/game/progress.ts"
click node_guestprogress "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/game/guest-progress.ts"
click node_posttest "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/post-test/PostTestContent.tsx"
click node_guardianroutes "https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/guardian"
click node_consent "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/guardian/consent/page.tsx"
click node_childsetup "https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/child/setup"
click node_childlogin "https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/child/login"
click node_sessionhook "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/hooks/useChildSession.ts"
click node_guardianapi "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/api/client.ts"
click node_supabase "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/supabase/client.ts"
click node_childapi "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/api/child-client.ts"
click node_dashboard "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/guardian/dashboard/GuardianDashboardContent.tsx"
click node_temanku "https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/temanku/TemankuContent.tsx"

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_home,node_progressmap,node_modules,node_renderer,node_chapterpages,node_games,node_evaluators,node_gamerules,node_gameprogress,node_guestprogress,node_posttest toneBlue
class node_guardianroutes,node_consent,node_childsetup,node_childlogin,node_sessionhook toneAmber
class node_dashboard toneMint
class node_temanku toneRose
class node_guardianapi,node_supabase,node_childapi,node_backend,node_learner,node_guardian toneIndigo
```

## Components

### Learning Journey

- [Progress Home](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/home/HomeScreen.tsx): `components/home/HomeScreen.tsx`
- [Chapter Map](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/home/SunflowerProgressMap.tsx): `components/home/SunflowerProgressMap.tsx`
- [Chapter Modules](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/modules/ChapterModulePage.tsx): `components/modules/ChapterModulePage.tsx`
- [Module Renderer](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/components/modules/ModuleRenderer.tsx): `components/modules/ModuleRenderer.tsx`
- [Chapter Routes](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/chapters): `app/chapters`
- [Chapter Games](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/chapters): `app/chapters`
- [Game Evaluators](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/lib/game/evaluate): `lib/game/evaluate`
- [Game Rules](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/game/chapter-rules.ts): `lib/game/chapter-rules.ts`
- [Progress Logic](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/game/progress.ts): `lib/game/progress.ts`
- [Guest Progress](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/game/guest-progress.ts): `lib/game/guest-progress.ts`
- [Post-Test](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/post-test/PostTestContent.tsx): `app/post-test/PostTestContent.tsx`

### Accounts & Consent

- [Guardian Routes](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/guardian): `app/guardian`
- [Consent Flow](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/guardian/consent/page.tsx): `app/guardian/consent/page.tsx`
- [Child Setup](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/child/setup): `app/child/setup`
- [Child Login](https://github.com/risa-remaja-indonesia-sehat/risa-v3/tree/main/app/child/login): `app/child/login`
- [Child Session](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/hooks/useChildSession.ts): `hooks/useChildSession.ts`

### Guardian Tools

- [Guardian Dashboard](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/guardian/dashboard/GuardianDashboardContent.tsx): `app/guardian/dashboard/GuardianDashboardContent.tsx`

### Child Community

- [Temanku Community](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/app/temanku/TemankuContent.tsx): `app/temanku/TemankuContent.tsx`

### API Integrations

- [Guardian API Client](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/api/client.ts): `lib/api/client.ts`
- [Supabase Auth](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/supabase/client.ts): `lib/supabase/client.ts`
- [Child API Client](https://github.com/risa-remaja-indonesia-sehat/risa-v3/blob/main/lib/api/child-client.ts): `lib/api/child-client.ts`
- **RISA Backend**

### Other components

- **Learner**
- **Guardian**

## Connections

- Learner → Progress Home: opens
- Progress Home → Chapter Map: shows progress
- Chapter Map → Chapter Routes: selects chapter
- Chapter Routes → Chapter Modules: renders lessons
- Chapter Modules → Module Renderer: renders blocks
- Chapter Routes → Chapter Games: opens games
- Chapter Games → Game Evaluators: evaluates answers
- Chapter Games → Game Rules: checks rules
- Chapter Games → Progress Logic: updates progress
- Chapter Games → Guest Progress: stores guest score
- Progress Home → Guest Progress: reads guest status
- Progress Home → Post-Test: opens after completion
- Post-Test → Child API Client: loads and submits
- Child API Client → RISA Backend: sends cookie requests
- Guardian → Guardian Routes: registers or logs in
- Guardian Routes → Supabase Auth: authenticates
- Guardian Routes → Guardian API Client: requests guardian actions
- Guardian API Client → Supabase Auth: reads access token
- Guardian API Client → RISA Backend: sends bearer requests
- Guardian Routes → Consent Flow: starts consent
- Consent Flow → Guardian API Client: validates consent
- Consent Flow → Child Setup: continues when valid
- Child Setup → Guardian API Client: creates child profile
- Child Login → Child API Client: logs in child
- Child Session → Child API Client: checks and ends session
- Child Session → Progress Home: provides child progress
- Guardian → Guardian Dashboard: views family progress
- Guardian Dashboard → Guardian API Client: loads dashboard
- Learner → Temanku Community: shares and reads
- Temanku Community → Child Session: checks child session
- Temanku Community → Child API Client: manages community content
