# haidirwf/vs-tebak architecture

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

- Interactive diagram: https://gitdiagram.com/haidirwf/vs-tebak
- Repository: https://github.com/haidirwf/vs-tebak

## Overview

Skillungo is a gamified learning platform: students sign in, study interactive modules or compete in quizzes, then earn XP and progress their RPG character, quests, and rewards. The map emphasizes those domain stages and the documented leaderboard, streak, and voucher capabilities. Evidence is limited to the README and indexed excerpts; unsampled route and client wiring is therefore shown only where documented, or omitted.

Main entry points: [`app/api/xp/route.ts`](https://github.com/haidirwf/vs-tebak/blob/main/app/api/xp/route.ts) (XP & Activity API), [`app/(dashboard)/battle/page.tsx`](https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/battle/page.tsx) (Battle Arena), [`app/(dashboard)/character/page.tsx`](https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/character/page.tsx) (Character Setup), [`app/(dashboard)/modules`](https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/modules) (Learning Modules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning"]
  node_modules["Learning Modules"]
  node_contentstore["Content Cache<br/>[contentStore.ts]"]
end

subgraph group_battle["Quiz Battles"]
  node_battleui["Battle Arena<br/>[page.tsx]"]
  node_practice["Computer Practice"]
  node_battleroom["Battle Room"]
  node_battleapi["Battle Room API<br/>[route.ts]"]
  node_battlestore["Battle State<br/>[battleStore.ts]"]
  node_arena["Combat Stage"]
end

subgraph group_progression["RPG Progression"]
  node_character["Character Setup<br/>[page.tsx]"]
  node_roles["Role &amp; Stats Rules<br/>[character.ts]"]
  node_items["Equipment Catalog<br/>[items.ts]"]
  node_visual["Character Visuals"]
  node_userstore["Player Cache<br/>[userStore.ts]"]
  node_xpapi["XP &amp; Activity API<br/>[route.ts]"]
  node_xprules["XP &amp; Level Rules<br/>[xp.ts]"]
  node_quests["Daily Quests<br/>[dailyQuests.ts]"]
  node_questrules["Quest Progress<br/>[quests.ts]"]
  node_streaks["Streak Rules<br/>[streak.ts]"]
  node_badges["Achievement Badges<br/>[badges.ts]"]
end

subgraph group_rewards["Rewards &amp; Rankings"]
  node_voucherui["Voucher Store"]
  node_voucherapi["Voucher Redemption<br/>[route.ts]"]
  node_leaderboard["Leaderboards"]
  node_dashboard["Progress Dashboard<br/>[page.tsx]"]
end

subgraph group_platform["Identity &amp; Data"]
  node_landing["Landing<br/>[LandingClient.tsx]"]
  node_auth["Sign in / Register"]
  node_authhelper["Auth &amp; Profile<br/>[get-user.ts]"]
  node_supabase[("Supabase")]
end

node_student(("Student"))

node_student -->|"visits"| node_landing
node_landing -->|"links to"| node_auth
node_student -.->|"signs in"| node_auth
node_auth -->|"authenticates"| node_supabase
node_authhelper -->|"reads profile"| node_supabase
node_student -.->|"studies"| node_modules
node_modules -->|"uses cache"| node_contentstore
node_student -.->|"starts duel"| node_battleui
node_student -.->|"practices"| node_practice
node_battleui -->|"creates or joins"| node_battleapi
node_battleui -.->|"opens room"| node_battleroom
node_battleroom -.->|"syncs state"| node_battlestore
node_battleroom -.->|"renders combat"| node_arena
node_practice -.->|"renders combat"| node_arena
node_battleapi -->|"reads and writes"| node_supabase
node_student -.->|"chooses class"| node_character
node_character -->|"uses role rules"| node_roles
node_character -->|"uses catalog"| node_items
node_character -->|"reads player state"| node_userstore
node_visual -->|"renders stats"| node_roles
node_visual -->|"renders equipment"| node_items
node_modules -.->|"awards completion XP"| node_xpapi
node_battleui -.->|"reports battle result"| node_xpapi
node_xpapi -->|"updates progress"| node_supabase
node_xpapi -->|"calculates reward"| node_xprules
node_xpapi -->|"updates quests"| node_questrules
node_xpapi -->|"ensures daily quests"| node_quests
node_xpapi -->|"checks streak"| node_streaks
node_xpapi -->|"ensures badges"| node_badges
node_student -.->|"spends rewards"| node_voucherui
node_voucherui -.->|"redeems voucher"| node_voucherapi
node_voucherapi -->|"records redemption"| node_supabase
node_student -.->|"checks rankings"| node_leaderboard
node_student -.->|"reviews progress"| node_dashboard

click node_landing "https://github.com/haidirwf/vs-tebak/blob/main/components/landing/LandingClient.tsx"
click node_auth "https://github.com/haidirwf/vs-tebak/tree/main/app/(auth)"
click node_authhelper "https://github.com/haidirwf/vs-tebak/blob/main/lib/auth/get-user.ts"
click node_modules "https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/modules"
click node_contentstore "https://github.com/haidirwf/vs-tebak/blob/main/stores/contentStore.ts"
click node_battleui "https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/battle/page.tsx"
click node_practice "https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/battle/computer"
click node_battleroom "https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/battle/%5BroomId%5D"
click node_battleapi "https://github.com/haidirwf/vs-tebak/blob/main/app/api/battle/route.ts"
click node_battlestore "https://github.com/haidirwf/vs-tebak/blob/main/stores/battleStore.ts"
click node_arena "https://github.com/haidirwf/vs-tebak/blob/main/components/battle/BattleArenaStage.tsx"
click node_character "https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/character/page.tsx"
click node_roles "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/character.ts"
click node_items "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/items.ts"
click node_visual "https://github.com/haidirwf/vs-tebak/blob/main/components/character/CharacterVisual.tsx"
click node_userstore "https://github.com/haidirwf/vs-tebak/blob/main/stores/userStore.ts"
click node_xpapi "https://github.com/haidirwf/vs-tebak/blob/main/app/api/xp/route.ts"
click node_xprules "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/xp.ts"
click node_quests "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/dailyQuests.ts"
click node_questrules "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/quests.ts"
click node_streaks "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/streak.ts"
click node_badges "https://github.com/haidirwf/vs-tebak/blob/main/lib/game/badges.ts"
click node_voucherui "https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/voucher/VoucherStoreClient.tsx"
click node_voucherapi "https://github.com/haidirwf/vs-tebak/blob/main/app/api/vouchers/redeem/route.ts"
click node_leaderboard "https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/leaderboard"
click node_dashboard "https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/dashboard/page.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_modules,node_contentstore toneBlue
class node_battleui,node_practice,node_battleroom,node_battleapi,node_battlestore,node_arena toneAmber
class node_character,node_roles,node_items,node_visual,node_userstore,node_xpapi,node_xprules,node_quests,node_questrules,node_streaks,node_badges toneMint
class node_voucherui,node_voucherapi,node_leaderboard,node_dashboard toneRose
class node_landing,node_auth,node_authhelper,node_supabase,node_student toneIndigo
```

## Components

### Learning

- [Learning Modules](https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/modules): `app/(dashboard)/modules`
- [Content Cache](https://github.com/haidirwf/vs-tebak/blob/main/stores/contentStore.ts): `stores/contentStore.ts`

### Quiz Battles

- [Battle Arena](https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/battle/page.tsx): `app/(dashboard)/battle/page.tsx`
- [Computer Practice](https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/battle/computer): `app/(dashboard)/battle/computer`
- [Battle Room](https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/battle/%5BroomId%5D): `app/(dashboard)/battle/[roomId]`
- [Battle Room API](https://github.com/haidirwf/vs-tebak/blob/main/app/api/battle/route.ts): `app/api/battle/route.ts`
- [Battle State](https://github.com/haidirwf/vs-tebak/blob/main/stores/battleStore.ts): `stores/battleStore.ts`
- [Combat Stage](https://github.com/haidirwf/vs-tebak/blob/main/components/battle/BattleArenaStage.tsx): `components/battle/BattleArenaStage.tsx`

### RPG Progression

- [Character Setup](https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/character/page.tsx): `app/(dashboard)/character/page.tsx`
- [Role & Stats Rules](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/character.ts): `lib/game/character.ts`
- [Equipment Catalog](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/items.ts): `lib/game/items.ts`
- [Character Visuals](https://github.com/haidirwf/vs-tebak/blob/main/components/character/CharacterVisual.tsx): `components/character/CharacterVisual.tsx`
- [Player Cache](https://github.com/haidirwf/vs-tebak/blob/main/stores/userStore.ts): `stores/userStore.ts`
- [XP & Activity API](https://github.com/haidirwf/vs-tebak/blob/main/app/api/xp/route.ts): `app/api/xp/route.ts`
- [XP & Level Rules](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/xp.ts): `lib/game/xp.ts`
- [Daily Quests](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/dailyQuests.ts): `lib/game/dailyQuests.ts`
- [Quest Progress](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/quests.ts): `lib/game/quests.ts`
- [Streak Rules](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/streak.ts): `lib/game/streak.ts`
- [Achievement Badges](https://github.com/haidirwf/vs-tebak/blob/main/lib/game/badges.ts): `lib/game/badges.ts`

### Rewards & Rankings

- [Voucher Store](https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/voucher/VoucherStoreClient.tsx): `app/(dashboard)/voucher/VoucherStoreClient.tsx`
- [Voucher Redemption](https://github.com/haidirwf/vs-tebak/blob/main/app/api/vouchers/redeem/route.ts): `app/api/vouchers/redeem/route.ts`
- [Leaderboards](https://github.com/haidirwf/vs-tebak/tree/main/app/(dashboard)/leaderboard): `app/(dashboard)/leaderboard`
- [Progress Dashboard](https://github.com/haidirwf/vs-tebak/blob/main/app/(dashboard)/dashboard/page.tsx): `app/(dashboard)/dashboard/page.tsx`

### Identity & Data

- [Landing](https://github.com/haidirwf/vs-tebak/blob/main/components/landing/LandingClient.tsx): `components/landing/LandingClient.tsx`
- [Sign in / Register](https://github.com/haidirwf/vs-tebak/tree/main/app/(auth)): `app/(auth)`
- [Auth & Profile](https://github.com/haidirwf/vs-tebak/blob/main/lib/auth/get-user.ts): `lib/auth/get-user.ts`
- **Supabase**

### Other components

- **Student**

## Connections

- Student → Landing: visits
- Landing → Sign in / Register: links to (evidence: `components/landing/LandingClient.tsx`)
- Student → Sign in / Register: signs in
- Sign in / Register → Supabase: authenticates (evidence: `app/(auth)/login/page.tsx`)
- Auth & Profile → Supabase: reads profile (evidence: `lib/auth/get-user.ts`)
- Student → Learning Modules: studies
- Learning Modules → Content Cache: uses cache (evidence: `app/(dashboard)/modules/ModulesClient.tsx`)
- Student → Battle Arena: starts duel
- Student → Computer Practice: practices
- Battle Arena → Battle Room API: creates or joins (evidence: `app/(dashboard)/battle/page.tsx`)
- Battle Arena → Battle Room: opens room
- Battle Room → Battle State: syncs state
- Battle Room → Combat Stage: renders combat
- Computer Practice → Combat Stage: renders combat
- Battle Room API → Supabase: reads and writes (evidence: `app/api/battle/route.ts`)
- Student → Character Setup: chooses class
- Character Setup → Role & Stats Rules: uses role rules (evidence: `app/(dashboard)/character/page.tsx`)
- Character Setup → Equipment Catalog: uses catalog (evidence: `app/(dashboard)/character/page.tsx`)
- Character Setup → Player Cache: reads player state (evidence: `app/(dashboard)/character/page.tsx`)
- Character Visuals → Role & Stats Rules: renders stats (evidence: `components/character/CharacterVisual.tsx`)
- Character Visuals → Equipment Catalog: renders equipment (evidence: `components/character/CharacterVisual.tsx`)
- Learning Modules → XP & Activity API: awards completion XP
- Battle Arena → XP & Activity API: reports battle result
- XP & Activity API → Supabase: updates progress (evidence: `app/api/xp/route.ts`)
- XP & Activity API → XP & Level Rules: calculates reward (evidence: `app/api/xp/route.ts`)
- XP & Activity API → Quest Progress: updates quests (evidence: `app/api/xp/route.ts`)
- XP & Activity API → Daily Quests: ensures daily quests (evidence: `app/api/xp/route.ts`)
- XP & Activity API → Streak Rules: checks streak (evidence: `app/api/xp/route.ts`)
- XP & Activity API → Achievement Badges: ensures badges (evidence: `app/api/xp/route.ts`)
- Student → Voucher Store: spends rewards
- Voucher Store → Voucher Redemption: redeems voucher
- Voucher Redemption → Supabase: records redemption (evidence: `app/api/vouchers/redeem/route.ts`)
- Student → Leaderboards: checks rankings
- Student → Progress Dashboard: reviews progress
