# sankho1769/irl-xp architecture

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

- Interactive diagram: https://gitdiagram.com/sankho1769/irl-xp
- Repository: https://github.com/sankho1769/irl-xp

## Overview

IRL XP gamifies personal productivity through a user workflow of signing in, managing quests and focus sessions, and earning character progression and rewards. Protected pages present quest, character, story, focus, and shop experiences; DashboardContext coordinates server actions, while a presentation adapter shapes backend records for the UI. README documents additional profile, theme, achievement, boss, streak, and penalty capabilities. Some pages and actions were not sampled, so their internal call paths are not inferred.

Main entry points: [`app/protected/DashboardContext.tsx`](https://github.com/sankho1769/irl-xp/blob/main/app/protected/DashboardContext.tsx) (Dashboard State), [`app/actions/quests.ts`](https://github.com/sankho1769/irl-xp/blob/main/app/actions/quests.ts) (Quest Actions), [`app/protected/quests/page.tsx`](https://github.com/sankho1769/irl-xp/blob/main/app/protected/quests/page.tsx) (Quest Log), [`lib/supabase/server.ts`](https://github.com/sankho1769/irl-xp/blob/main/lib/supabase/server.ts) (Supabase Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access &amp; Shell"]
  node_login["Sign-in<br/>[page.tsx]"]
  node_middleware["Session Guard<br/>[middleware.ts]"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_context["Dashboard State"]
end

subgraph group_play["Quest &amp; Focus"]
  node_questpage["Quest Log<br/>[page.tsx]"]
  node_board["Guild Board<br/>[QuestBoardView.tsx]"]
  node_boardcard["Board Quest Card<br/>[QuestBoardCard.tsx]"]
  node_questcard["Quest Card<br/>[QuestCard.tsx]"]
  node_questlist["Quest List<br/>[QuestList.tsx]"]
  node_newquest["Quest Creation<br/>[NewQuestModal.tsx]"]
  node_focus["Focus Mode<br/>[page.tsx]"]
  node_empty["Empty State<br/>[EmptyState.tsx]"]
  node_scribe["Scribe Animation"]
end

subgraph group_progress["Character &amp; Rewards"]
  node_characterpage["Character Sheet<br/>[page.tsx]"]
  node_characterstatus["Character Status"]
  node_story["Story Chapters<br/>[page.tsx]"]
  node_shop["Shop<br/>[page.tsx]"]
  node_shopcard["Shop Item Card<br/>[ShopItemCard.tsx]"]
  node_achievements["Achievements<br/>[achievements.ts]"]
  node_achievementui["Achievement Overlay"]
  node_profile["Profile &amp; Themes<br/>[profile.ts]"]
  node_animated["Number Animation"]
end

subgraph group_backend["Actions &amp; Data"]
  node_questactions["Quest Actions<br/>[quests.ts]"]
  node_characteractions["Character Actions<br/>[character.ts]"]
  node_shopactions["Shop Actions<br/>[shop.ts]"]
  node_adapter["Data Adapter"]
  node_types["Dashboard Types<br/>[dashboard.ts]"]
  node_supabase["Supabase Client<br/>[server.ts]"]
end

node_player(("Player"))
node_database[("Supabase Database")]

node_player -->|"signs in"| node_login
node_player -->|"uses"| node_dashboard
node_middleware -.->|"checks session"| node_supabase
node_dashboard -->|"reads state"| node_context
node_questpage -->|"reads state"| node_context
node_questpage -->|"renders"| node_board
node_questpage -->|"renders"| node_questcard
node_questpage -.->|"renders"| node_questlist
node_questpage -->|"renders"| node_empty
node_questpage -->|"uses"| node_scribe
node_board -->|"renders"| node_boardcard
node_board -->|"calls"| node_questactions
node_questcard -->|"calls"| node_questactions
node_newquest -->|"calls"| node_questactions
node_focus -->|"reads state"| node_context
node_focus -.->|"completes quest"| node_questactions
node_context -->|"calls"| node_questactions
node_context -->|"loads character"| node_characteractions
node_context -->|"purchases item"| node_shopactions
node_context -->|"updates profile"| node_profile
node_context -->|"loads achievements"| node_achievements
node_questactions -->|"imports type"| node_achievements
node_questactions -->|"creates client"| node_supabase
node_characteractions -->|"creates client"| node_supabase
node_profile -->|"creates client"| node_supabase
node_shopactions -->|"creates client"| node_supabase
node_achievements -->|"creates client"| node_supabase
node_supabase -->|"queries data"| node_database
node_context -->|"maps records"| node_adapter
node_adapter -->|"maps character"| node_characteractions
node_adapter -->|"maps quests"| node_questactions
node_adapter -->|"maps items"| node_shopactions
node_adapter -->|"shapes data"| node_types
node_characterpage -->|"reads state"| node_context
node_characterpage -.->|"renders"| node_characterstatus
node_dashboard -->|"renders"| node_characterstatus
node_characterstatus -->|"animates values"| node_animated
node_shop -->|"reads state"| node_context
node_shop -->|"renders"| node_shopcard
node_achievementui -.->|"uses actions"| node_achievements
node_story -->|"reads state"| node_context

click node_login "https://github.com/sankho1769/irl-xp/blob/main/app/login/page.tsx"
click node_middleware "https://github.com/sankho1769/irl-xp/blob/main/middleware.ts"
click node_dashboard "https://github.com/sankho1769/irl-xp/blob/main/app/protected/page.tsx"
click node_context "https://github.com/sankho1769/irl-xp/blob/main/app/protected/DashboardContext.tsx"
click node_questpage "https://github.com/sankho1769/irl-xp/blob/main/app/protected/quests/page.tsx"
click node_board "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestBoardView.tsx"
click node_boardcard "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestBoardCard.tsx"
click node_questcard "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestCard.tsx"
click node_questlist "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestList.tsx"
click node_newquest "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/NewQuestModal.tsx"
click node_focus "https://github.com/sankho1769/irl-xp/blob/main/app/protected/focus/page.tsx"
click node_questactions "https://github.com/sankho1769/irl-xp/blob/main/app/actions/quests.ts"
click node_characterpage "https://github.com/sankho1769/irl-xp/blob/main/app/protected/character/page.tsx"
click node_characterstatus "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/CharacterStatus.tsx"
click node_story "https://github.com/sankho1769/irl-xp/blob/main/app/protected/story/page.tsx"
click node_shop "https://github.com/sankho1769/irl-xp/blob/main/app/protected/shop/page.tsx"
click node_shopcard "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/ShopItemCard.tsx"
click node_achievements "https://github.com/sankho1769/irl-xp/blob/main/app/actions/achievements.ts"
click node_achievementui "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/AchievementUnlockOverlay.tsx"
click node_profile "https://github.com/sankho1769/irl-xp/blob/main/app/actions/profile.ts"
click node_characteractions "https://github.com/sankho1769/irl-xp/blob/main/app/actions/character.ts"
click node_shopactions "https://github.com/sankho1769/irl-xp/blob/main/app/actions/shop.ts"
click node_adapter "https://github.com/sankho1769/irl-xp/blob/main/lib/dashboard/character-adapter.ts"
click node_types "https://github.com/sankho1769/irl-xp/blob/main/types/dashboard.ts"
click node_supabase "https://github.com/sankho1769/irl-xp/blob/main/lib/supabase/server.ts"
click node_animated "https://github.com/sankho1769/irl-xp/blob/main/lib/hooks/useAnimatedNumber.ts"
click node_empty "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/EmptyState.tsx"
click node_scribe "https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuillScribeAnimation.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_login,node_middleware,node_dashboard,node_context toneBlue
class node_questpage,node_board,node_boardcard,node_questcard,node_questlist,node_newquest,node_focus,node_empty,node_scribe,node_database toneAmber
class node_characterpage,node_characterstatus,node_story,node_shop,node_shopcard,node_achievements,node_achievementui,node_profile,node_animated toneMint
class node_questactions,node_characteractions,node_shopactions,node_adapter,node_types,node_supabase toneRose
class node_player toneIndigo
```

## Components

### Access & Shell

- [Sign-in](https://github.com/sankho1769/irl-xp/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Session Guard](https://github.com/sankho1769/irl-xp/blob/main/middleware.ts): `middleware.ts`
- [Dashboard](https://github.com/sankho1769/irl-xp/blob/main/app/protected/page.tsx): `app/protected/page.tsx`
- [Dashboard State](https://github.com/sankho1769/irl-xp/blob/main/app/protected/DashboardContext.tsx): `app/protected/DashboardContext.tsx`

### Quest & Focus

- [Quest Log](https://github.com/sankho1769/irl-xp/blob/main/app/protected/quests/page.tsx): `app/protected/quests/page.tsx`
- [Guild Board](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestBoardView.tsx): `components/dashboard/QuestBoardView.tsx`
- [Board Quest Card](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestBoardCard.tsx): `components/dashboard/QuestBoardCard.tsx`
- [Quest Card](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestCard.tsx): `components/dashboard/QuestCard.tsx`
- [Quest List](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuestList.tsx): `components/dashboard/QuestList.tsx`
- [Quest Creation](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/NewQuestModal.tsx): `components/dashboard/NewQuestModal.tsx`
- [Focus Mode](https://github.com/sankho1769/irl-xp/blob/main/app/protected/focus/page.tsx): `app/protected/focus/page.tsx`
- [Empty State](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/EmptyState.tsx): `components/dashboard/EmptyState.tsx`
- [Scribe Animation](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/QuillScribeAnimation.tsx): `components/dashboard/QuillScribeAnimation.tsx`

### Character & Rewards

- [Character Sheet](https://github.com/sankho1769/irl-xp/blob/main/app/protected/character/page.tsx): `app/protected/character/page.tsx`
- [Character Status](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/CharacterStatus.tsx): `components/dashboard/CharacterStatus.tsx`
- [Story Chapters](https://github.com/sankho1769/irl-xp/blob/main/app/protected/story/page.tsx): `app/protected/story/page.tsx`
- [Shop](https://github.com/sankho1769/irl-xp/blob/main/app/protected/shop/page.tsx): `app/protected/shop/page.tsx`
- [Shop Item Card](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/ShopItemCard.tsx): `components/dashboard/ShopItemCard.tsx`
- [Achievements](https://github.com/sankho1769/irl-xp/blob/main/app/actions/achievements.ts): `app/actions/achievements.ts`
- [Achievement Overlay](https://github.com/sankho1769/irl-xp/blob/main/components/dashboard/AchievementUnlockOverlay.tsx): `components/dashboard/AchievementUnlockOverlay.tsx`
- [Profile & Themes](https://github.com/sankho1769/irl-xp/blob/main/app/actions/profile.ts): `app/actions/profile.ts`
- [Number Animation](https://github.com/sankho1769/irl-xp/blob/main/lib/hooks/useAnimatedNumber.ts): `lib/hooks/useAnimatedNumber.ts`

### Actions & Data

- [Quest Actions](https://github.com/sankho1769/irl-xp/blob/main/app/actions/quests.ts): `app/actions/quests.ts`
- [Character Actions](https://github.com/sankho1769/irl-xp/blob/main/app/actions/character.ts): `app/actions/character.ts`
- [Shop Actions](https://github.com/sankho1769/irl-xp/blob/main/app/actions/shop.ts): `app/actions/shop.ts`
- [Data Adapter](https://github.com/sankho1769/irl-xp/blob/main/lib/dashboard/character-adapter.ts): `lib/dashboard/character-adapter.ts`
- [Dashboard Types](https://github.com/sankho1769/irl-xp/blob/main/types/dashboard.ts): `types/dashboard.ts`
- [Supabase Client](https://github.com/sankho1769/irl-xp/blob/main/lib/supabase/server.ts): `lib/supabase/server.ts`

### Other components

- **Player**
- **Supabase Database**

## Connections

- Player → Sign-in: signs in (evidence: `README.md`)
- Player → Dashboard: uses (evidence: `README.md`)
- Session Guard → Supabase Client: checks session
- Dashboard → Dashboard State: reads state (evidence: `app/protected/page.tsx`)
- Quest Log → Dashboard State: reads state (evidence: `app/protected/quests/page.tsx`)
- Quest Log → Guild Board: renders (evidence: `app/protected/quests/page.tsx`)
- Quest Log → Quest Card: renders (evidence: `app/protected/quests/page.tsx`)
- Quest Log → Quest List: renders
- Quest Log → Empty State: renders (evidence: `app/protected/quests/page.tsx`)
- Quest Log → Scribe Animation: uses (evidence: `app/protected/quests/page.tsx`)
- Guild Board → Board Quest Card: renders (evidence: `components/dashboard/QuestBoardView.tsx`)
- Guild Board → Quest Actions: calls (evidence: `components/dashboard/QuestBoardView.tsx`)
- Quest Card → Quest Actions: calls (evidence: `components/dashboard/QuestCard.tsx`)
- Quest Creation → Quest Actions: calls (evidence: `components/dashboard/NewQuestModal.tsx`)
- Focus Mode → Dashboard State: reads state (evidence: `app/protected/focus/page.tsx`)
- Focus Mode → Quest Actions: completes quest
- Dashboard State → Quest Actions: calls (evidence: `app/protected/DashboardContext.tsx`)
- Dashboard State → Character Actions: loads character (evidence: `app/protected/DashboardContext.tsx`)
- Dashboard State → Shop Actions: purchases item (evidence: `app/protected/DashboardContext.tsx`)
- Dashboard State → Profile & Themes: updates profile (evidence: `app/protected/DashboardContext.tsx`)
- Dashboard State → Achievements: loads achievements (evidence: `app/protected/DashboardContext.tsx`)
- Quest Actions → Achievements: imports type (evidence: `app/actions/quests.ts`)
- Quest Actions → Supabase Client: creates client (evidence: `app/actions/quests.ts`)
- Character Actions → Supabase Client: creates client (evidence: `app/actions/character.ts`)
- Profile & Themes → Supabase Client: creates client (evidence: `app/actions/profile.ts`)
- Shop Actions → Supabase Client: creates client (evidence: `app/actions/shop.ts`)
- Achievements → Supabase Client: creates client (evidence: `app/actions/achievements.ts`)
- Supabase Client → Supabase Database: queries data
- Dashboard State → Data Adapter: maps records (evidence: `app/protected/DashboardContext.tsx`)
- Data Adapter → Character Actions: maps character (evidence: `lib/dashboard/character-adapter.ts`)
- Data Adapter → Quest Actions: maps quests (evidence: `lib/dashboard/character-adapter.ts`)
- Data Adapter → Shop Actions: maps items (evidence: `lib/dashboard/character-adapter.ts`)
- Data Adapter → Dashboard Types: shapes data (evidence: `lib/dashboard/character-adapter.ts`)
- Character Sheet → Dashboard State: reads state (evidence: `app/protected/character/page.tsx`)
- Character Sheet → Character Status: renders
- Dashboard → Character Status: renders (evidence: `app/protected/page.tsx`)
- Character Status → Number Animation: animates values (evidence: `components/dashboard/CharacterStatus.tsx`)
- Shop → Dashboard State: reads state (evidence: `app/protected/shop/page.tsx`)
- Shop → Shop Item Card: renders (evidence: `app/protected/shop/page.tsx`)
- Achievement Overlay → Achievements: uses actions (evidence: `components/dashboard/AchievementUnlockOverlay.tsx`)
- Story Chapters → Dashboard State: reads state (evidence: `app/protected/story/page.tsx`)
