# pepper-candy/milestone architecture

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

- Interactive diagram: https://gitdiagram.com/pepper-candy/milestone
- Repository: https://github.com/pepper-candy/milestone

## Overview

MILESTONE is a mentor–mentee study tracker: users enter via invitation codes, then mentees complete tasks and study sessions while mentors review work and manage rewards. The dashboard brings together task progress, sessions, and prize milestones; profiles support family links and invitations. The map preserves those documented product areas, with sampled API handlers and Supabase helpers shown as the internal service layer. Some UI-to-API wiring and unsampled routes are not visible in the excerpts, so those links are omitted.

Main entry points: [`src/lib/supabase/server.ts`](https://github.com/pepper-candy/milestone/blob/main/src/lib/supabase/server.ts) (Server client), [`src/components/dashboard/DashboardClient.tsx`](https://github.com/pepper-candy/milestone/blob/main/src/components/dashboard/DashboardClient.tsx) (Dashboard), [`src/lib/supabase/admin.ts`](https://github.com/pepper-candy/milestone/blob/main/src/lib/supabase/admin.ts) (Admin client), [`src/components/tasks/TaskList.tsx`](https://github.com/pepper-candy/milestone/blob/main/src/components/tasks/TaskList.tsx) (Task workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access &amp; family"]
  node_login["Invitation login<br/>[page.tsx]"]
  node_profileui["Family profile"]
end

subgraph group_dashboard["Progress dashboard"]
  node_dashboardui["Dashboard"]
  node_taskui["Task workflow<br/>[TaskList.tsx]"]
  node_taskcard["Task details<br/>[TaskCard.tsx]"]
  node_sessionui["Study sessions<br/>[SessionTimer.tsx]"]
  node_milestonesui["Prize path"]
  node_milestoneview["Milestone display<br/>[MilestonePath.tsx]"]
  node_usersync["Family live sync<br/>[family-sync.ts]"]
end

subgraph group_services["Application services"]
  node_authapi["Auth endpoints<br/>[route.ts]"]
  node_firstchild["First mentee setup<br/>[route.ts]"]
  node_inviteapi["Family invitations<br/>[route.ts]"]
  node_profileapi["Profile API<br/>[route.ts]"]
  node_taskapi["Task operations<br/>[route.ts]"]
  node_sessionapi["Session operations<br/>[route.ts]"]
  node_sessionitem["Session updates<br/>[route.ts]"]
  node_milestoneapi["Milestone operations<br/>[route.ts]"]
  node_gemsapi["EXP to Gems<br/>[route.ts]"]
  node_communityapi["Community tasks<br/>[route.ts]"]
  node_uploadapi["Photo upload<br/>[route.ts]"]
end

subgraph group_persistence["Persistence"]
  node_supabaseserver["Server client<br/>[server.ts]"]
  node_supabaseadmin["Admin client<br/>[admin.ts]"]
  node_database[("Supabase database")]
end

node_people(("Mentors &amp; mentees"))
node_blob[("Vercel Blob")]

node_people -->|"enter code"| node_login
node_login -.->|"authenticate"| node_authapi
node_authapi -->|"creates client"| node_supabaseserver
node_authapi -->|"provisions account"| node_supabaseadmin
node_people -->|"track progress"| node_dashboardui
node_dashboardui -->|"renders"| node_taskui
node_taskui -->|"renders"| node_taskcard
node_taskui -.->|"manages tasks"| node_taskapi
node_dashboardui -->|"renders"| node_sessionui
node_dashboardui -->|"renders editor"| node_milestonesui
node_dashboardui -->|"renders path"| node_milestoneview
node_sessionui -->|"loads session"| node_sessionapi
node_sessionui -.->|"updates session"| node_sessionitem
node_milestonesui -.->|"edits path"| node_milestoneapi
node_profileui -->|"loads and saves"| node_profileapi
node_profileui -.->|"manages invites"| node_inviteapi
node_people -->|"manage family"| node_profileui
node_firstchild -->|"creates client"| node_supabaseserver
node_firstchild -->|"provisions mentee"| node_supabaseadmin
node_taskapi -->|"queries data"| node_supabaseserver
node_profileapi -->|"queries data"| node_supabaseserver
node_inviteapi -->|"uses session"| node_supabaseserver
node_inviteapi -->|"uses admin"| node_supabaseadmin
node_sessionapi -->|"queries data"| node_supabaseserver
node_sessionitem -->|"queries data"| node_supabaseserver
node_milestoneapi -->|"uses session"| node_supabaseserver
node_milestoneapi -->|"uses admin"| node_supabaseadmin
node_gemsapi -->|"uses session"| node_supabaseserver
node_communityapi -->|"uses session"| node_supabaseserver
node_uploadapi -->|"uses session"| node_supabaseserver
node_supabaseserver -.->|"reads and writes"| node_database
node_supabaseadmin -.->|"admin access"| node_database
node_uploadapi -.->|"stores photos"| node_blob
node_dashboardui -->|"subscribes"| node_usersync

click node_login "https://github.com/pepper-candy/milestone/blob/main/src/app/(auth)/login/page.tsx"
click node_authapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/auth/route.ts"
click node_firstchild "https://github.com/pepper-candy/milestone/blob/main/src/app/api/auth/first-child/route.ts"
click node_profileui "https://github.com/pepper-candy/milestone/blob/main/src/components/profile/ProfilePageClient.tsx"
click node_inviteapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/invite/route.ts"
click node_profileapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/profile/route.ts"
click node_dashboardui "https://github.com/pepper-candy/milestone/blob/main/src/components/dashboard/DashboardClient.tsx"
click node_taskui "https://github.com/pepper-candy/milestone/blob/main/src/components/tasks/TaskList.tsx"
click node_taskcard "https://github.com/pepper-candy/milestone/blob/main/src/components/tasks/TaskCard.tsx"
click node_taskapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/tasks/route.ts"
click node_sessionui "https://github.com/pepper-candy/milestone/blob/main/src/components/timer/SessionTimer.tsx"
click node_sessionapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/session/route.ts"
click node_sessionitem "https://github.com/pepper-candy/milestone/blob/main/src/app/api/session/%5Bid%5D/route.ts"
click node_milestonesui "https://github.com/pepper-candy/milestone/blob/main/src/components/progress/PrizePathEditor.tsx"
click node_milestoneview "https://github.com/pepper-candy/milestone/blob/main/src/components/progress/MilestonePath.tsx"
click node_milestoneapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/milestones/route.ts"
click node_gemsapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/gems/convert/route.ts"
click node_communityapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/community/route.ts"
click node_uploadapi "https://github.com/pepper-candy/milestone/blob/main/src/app/api/upload/route.ts"
click node_supabaseserver "https://github.com/pepper-candy/milestone/blob/main/src/lib/supabase/server.ts"
click node_supabaseadmin "https://github.com/pepper-candy/milestone/blob/main/src/lib/supabase/admin.ts"
click node_usersync "https://github.com/pepper-candy/milestone/blob/main/src/lib/family-sync.ts"

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_profileui toneBlue
class node_dashboardui,node_taskui,node_taskcard,node_sessionui,node_milestonesui,node_milestoneview,node_usersync,node_blob toneAmber
class node_authapi,node_firstchild,node_inviteapi,node_profileapi,node_taskapi,node_sessionapi,node_sessionitem,node_milestoneapi,node_gemsapi,node_communityapi,node_uploadapi toneMint
class node_supabaseserver,node_supabaseadmin,node_database toneRose
class node_people toneIndigo
```

## Components

### Access & family

- [Invitation login](https://github.com/pepper-candy/milestone/blob/main/src/app/(auth)/login/page.tsx): `src/app/(auth)/login/page.tsx`
- [Family profile](https://github.com/pepper-candy/milestone/blob/main/src/components/profile/ProfilePageClient.tsx): `src/components/profile/ProfilePageClient.tsx`

### Progress dashboard

- [Dashboard](https://github.com/pepper-candy/milestone/blob/main/src/components/dashboard/DashboardClient.tsx): `src/components/dashboard/DashboardClient.tsx`
- [Task workflow](https://github.com/pepper-candy/milestone/blob/main/src/components/tasks/TaskList.tsx): `src/components/tasks/TaskList.tsx`
- [Task details](https://github.com/pepper-candy/milestone/blob/main/src/components/tasks/TaskCard.tsx): `src/components/tasks/TaskCard.tsx`
- [Study sessions](https://github.com/pepper-candy/milestone/blob/main/src/components/timer/SessionTimer.tsx): `src/components/timer/SessionTimer.tsx`
- [Prize path](https://github.com/pepper-candy/milestone/blob/main/src/components/progress/PrizePathEditor.tsx): `src/components/progress/PrizePathEditor.tsx`
- [Milestone display](https://github.com/pepper-candy/milestone/blob/main/src/components/progress/MilestonePath.tsx): `src/components/progress/MilestonePath.tsx`
- [Family live sync](https://github.com/pepper-candy/milestone/blob/main/src/lib/family-sync.ts): `src/lib/family-sync.ts`

### Application services

- [Auth endpoints](https://github.com/pepper-candy/milestone/blob/main/src/app/api/auth/route.ts): `src/app/api/auth/route.ts`
- [First mentee setup](https://github.com/pepper-candy/milestone/blob/main/src/app/api/auth/first-child/route.ts): `src/app/api/auth/first-child/route.ts`
- [Family invitations](https://github.com/pepper-candy/milestone/blob/main/src/app/api/invite/route.ts): `src/app/api/invite/route.ts`
- [Profile API](https://github.com/pepper-candy/milestone/blob/main/src/app/api/profile/route.ts): `src/app/api/profile/route.ts`
- [Task operations](https://github.com/pepper-candy/milestone/blob/main/src/app/api/tasks/route.ts): `src/app/api/tasks/route.ts`
- [Session operations](https://github.com/pepper-candy/milestone/blob/main/src/app/api/session/route.ts): `src/app/api/session/route.ts`
- [Session updates](https://github.com/pepper-candy/milestone/blob/main/src/app/api/session/%5Bid%5D/route.ts): `src/app/api/session/[id]/route.ts`
- [Milestone operations](https://github.com/pepper-candy/milestone/blob/main/src/app/api/milestones/route.ts): `src/app/api/milestones/route.ts`
- [EXP to Gems](https://github.com/pepper-candy/milestone/blob/main/src/app/api/gems/convert/route.ts): `src/app/api/gems/convert/route.ts`
- [Community tasks](https://github.com/pepper-candy/milestone/blob/main/src/app/api/community/route.ts): `src/app/api/community/route.ts`
- [Photo upload](https://github.com/pepper-candy/milestone/blob/main/src/app/api/upload/route.ts): `src/app/api/upload/route.ts`

### Persistence

- [Server client](https://github.com/pepper-candy/milestone/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Admin client](https://github.com/pepper-candy/milestone/blob/main/src/lib/supabase/admin.ts): `src/lib/supabase/admin.ts`
- **Supabase database**

### Other components

- **Mentors & mentees**
- **Vercel Blob**

## Connections

- Mentors & mentees → Invitation login: enter code (evidence: `README.md`)
- Invitation login → Auth endpoints: authenticate
- Auth endpoints → Server client: creates client (evidence: `src/app/api/auth/route.ts`)
- Auth endpoints → Admin client: provisions account (evidence: `src/app/api/auth/route.ts`)
- Mentors & mentees → Dashboard: track progress (evidence: `README.md`)
- Dashboard → Task workflow: renders (evidence: `src/components/dashboard/DashboardClient.tsx`)
- Task workflow → Task details: renders (evidence: `src/components/tasks/TaskList.tsx`)
- Task workflow → Task operations: manages tasks
- Dashboard → Study sessions: renders (evidence: `src/components/dashboard/DashboardClient.tsx`)
- Dashboard → Prize path: renders editor (evidence: `src/components/dashboard/DashboardClient.tsx`)
- Dashboard → Milestone display: renders path (evidence: `src/components/dashboard/DashboardClient.tsx`)
- Study sessions → Session operations: loads session
- Study sessions → Session updates: updates session
- Prize path → Milestone operations: edits path
- Family profile → Profile API: loads and saves (evidence: `src/components/profile/ProfilePageClient.tsx`)
- Family profile → Family invitations: manages invites
- Mentors & mentees → Family profile: manage family (evidence: `README.md`)
- First mentee setup → Server client: creates client (evidence: `src/app/api/auth/first-child/route.ts`)
- First mentee setup → Admin client: provisions mentee (evidence: `src/app/api/auth/first-child/route.ts`)
- Task operations → Server client: queries data (evidence: `src/app/api/tasks/route.ts`)
- Profile API → Server client: queries data (evidence: `src/app/api/profile/route.ts`)
- Family invitations → Server client: uses session (evidence: `src/app/api/invite/route.ts`)
- Family invitations → Admin client: uses admin (evidence: `src/app/api/invite/route.ts`)
- Session operations → Server client: queries data (evidence: `src/app/api/session/route.ts`)
- Session updates → Server client: queries data (evidence: `src/app/api/session/[id]/route.ts`)
- Milestone operations → Server client: uses session (evidence: `src/app/api/milestones/route.ts`)
- Milestone operations → Admin client: uses admin (evidence: `src/app/api/milestones/route.ts`)
- EXP to Gems → Server client: uses session (evidence: `src/app/api/gems/convert/route.ts`)
- Community tasks → Server client: uses session (evidence: `src/app/api/community/route.ts`)
- Photo upload → Server client: uses session (evidence: `src/app/api/upload/route.ts`)
- Server client → Supabase database: reads and writes
- Admin client → Supabase database: admin access
- Photo upload → Vercel Blob: stores photos
- Dashboard → Family live sync: subscribes (evidence: `src/components/dashboard/DashboardClient.tsx`)
