# yust777/icpchue architecture

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

- Interactive diagram: https://gitdiagram.com/yust777/icpchue
- Repository: https://github.com/yust777/icpchue

## Overview

ICPC HUE is a competitive-programming learning and practice platform. A user can open Mirror Mode, enter a Codeforces problem, and work in an integrated editor with tests and a whiteboard; the README also describes session review, curriculum, analytics, and gamification. The sampled problem-data hook calls the problem-stats API, while the drawer excerpt shows URL parsing. Other product branches are retained from the README and route tree; their internal wiring is not asserted where source was not sampled.

Main entry points: [`next-app/app/api/auth/register/route.ts`](https://github.com/yust777/icpchue/blob/main/next-app/app/api/auth/register/route.ts) (Registration), [`next-app/components/mirror/problem/ProblemDrawer.tsx`](https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/problem/ProblemDrawer.tsx) (Problem picker), [`next-app/hooks/contest/useProblemData.ts`](https://github.com/yust777/icpchue/blob/main/next-app/hooks/contest/useProblemData.ts) (Problem data), [`next-app/app/api/discipline/route.ts`](https://github.com/yust777/icpchue/blob/main/next-app/app/api/discipline/route.ts) (Practice tracking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_practice["Mirror Practice"]
  node_mirror["Mirror workspace<br/>[Whiteboard.tsx]"]
  node_problem_drawer["Problem picker<br/>[ProblemDrawer.tsx]"]
  node_problem_data["Problem data<br/>[useProblemData.ts]"]
  node_problem_stats["Problem statistics API<br/>[route.ts]"]
  node_editor["Code editor<br/>[CodeWorkspace.tsx]"]
  node_whiteboard["Whiteboard"]
  node_submissions["Submission analysis<br/>[route.ts]"]
end

subgraph group_learning["Learning Content"]
  node_sessions["Session library<br/>[sessionData.tsx]"]
  node_session_content["Session lessons"]
  node_curriculum["Curriculum<br/>[curriculum.ts]"]
  node_devlog["Devlog<br/>[devlog.ts]"]
end

subgraph group_progress["Progress and Mentoring"]
  node_achievements["Achievements<br/>[achievements.ts]"]
  node_leaderboard["Leaderboards<br/>[route.ts]"]
  node_mentor["Mentor tools<br/>[route.ts]"]
  node_discipline["Practice tracking<br/>[route.ts]"]
end

subgraph group_identity["Identity and Platform"]
  node_auth["Registration<br/>[route.ts]"]
  node_rate_limit["Rate limiting<br/>[rate-limit.ts]"]
  node_database[("Application database<br/>[db.ts]")]
end

node_learner(("Learner"))
node_codeforces["Codeforces"]

node_learner -->|"chooses problem"| node_problem_drawer
node_problem_drawer -.->|"opens workspace"| node_problem_data
node_problem_data -->|"fetches stats"| node_problem_stats
node_mirror -.->|"loads problems"| node_codeforces
node_learner -->|"writes solution"| node_editor
node_learner -->|"draws ideas"| node_whiteboard
node_learner -.->|"reviews submissions"| node_submissions
node_sessions -->|"renders lesson"| node_session_content
node_learner -->|"follows path"| node_curriculum
node_learner -.->|"reads updates"| node_devlog
node_learner -->|"earns rewards"| node_achievements
node_learner -->|"checks ranking"| node_leaderboard
node_mentor -.->|"reviews practice"| node_discipline
node_auth -->|"limits requests"| node_rate_limit
node_auth -->|"queries records"| node_database
node_discipline -->|"reads and writes"| node_database

click node_mirror "https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/Whiteboard.tsx"
click node_problem_drawer "https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/problem/ProblemDrawer.tsx"
click node_problem_data "https://github.com/yust777/icpchue/blob/main/next-app/hooks/contest/useProblemData.ts"
click node_problem_stats "https://github.com/yust777/icpchue/blob/main/next-app/app/api/codeforces/problem-stats/route.ts"
click node_editor "https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/editor/CodeWorkspace.tsx"
click node_whiteboard "https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/WhiteboardEditor.tsx"
click node_submissions "https://github.com/yust777/icpchue/blob/main/next-app/app/api/submissions/route.ts"
click node_sessions "https://github.com/yust777/icpchue/blob/main/next-app/lib/sessionData.tsx"
click node_session_content "https://github.com/yust777/icpchue/blob/main/next-app/lib/content/sessions/Session5Content.tsx"
click node_curriculum "https://github.com/yust777/icpchue/blob/main/next-app/lib/content/curriculum.ts"
click node_devlog "https://github.com/yust777/icpchue/blob/main/next-app/lib/content/devlog.ts"
click node_achievements "https://github.com/yust777/icpchue/blob/main/next-app/lib/services/achievements.ts"
click node_leaderboard "https://github.com/yust777/icpchue/blob/main/next-app/app/api/leaderboard/route.ts"
click node_mentor "https://github.com/yust777/icpchue/blob/main/next-app/app/api/mentor/trainee/%5Bid%5D/route.ts"
click node_discipline "https://github.com/yust777/icpchue/blob/main/next-app/app/api/discipline/route.ts"
click node_auth "https://github.com/yust777/icpchue/blob/main/next-app/app/api/auth/register/route.ts"
click node_rate_limit "https://github.com/yust777/icpchue/blob/main/next-app/lib/cache/rate-limit.ts"
click node_database "https://github.com/yust777/icpchue/blob/main/next-app/lib/db/db.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_mirror,node_problem_drawer,node_problem_data,node_problem_stats,node_editor,node_whiteboard,node_submissions toneBlue
class node_sessions,node_session_content,node_curriculum,node_devlog toneAmber
class node_achievements,node_leaderboard,node_mentor,node_discipline toneMint
class node_auth,node_rate_limit,node_database toneRose
class node_learner,node_codeforces toneIndigo
```

## Components

### Mirror Practice

- [Mirror workspace](https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/Whiteboard.tsx): `next-app/components/mirror/Whiteboard.tsx`
- [Problem picker](https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/problem/ProblemDrawer.tsx): `next-app/components/mirror/problem/ProblemDrawer.tsx`
- [Problem data](https://github.com/yust777/icpchue/blob/main/next-app/hooks/contest/useProblemData.ts): `next-app/hooks/contest/useProblemData.ts`
- [Problem statistics API](https://github.com/yust777/icpchue/blob/main/next-app/app/api/codeforces/problem-stats/route.ts): `next-app/app/api/codeforces/problem-stats/route.ts`
- [Code editor](https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/editor/CodeWorkspace.tsx): `next-app/components/mirror/editor/CodeWorkspace.tsx`
- [Whiteboard](https://github.com/yust777/icpchue/blob/main/next-app/components/mirror/WhiteboardEditor.tsx): `next-app/components/mirror/WhiteboardEditor.tsx`
- [Submission analysis](https://github.com/yust777/icpchue/blob/main/next-app/app/api/submissions/route.ts): `next-app/app/api/submissions/route.ts`

### Learning Content

- [Session library](https://github.com/yust777/icpchue/blob/main/next-app/lib/sessionData.tsx): `next-app/lib/sessionData.tsx`
- [Session lessons](https://github.com/yust777/icpchue/blob/main/next-app/lib/content/sessions/Session5Content.tsx): `next-app/lib/content/sessions/Session5Content.tsx`
- [Curriculum](https://github.com/yust777/icpchue/blob/main/next-app/lib/content/curriculum.ts): `next-app/lib/content/curriculum.ts`
- [Devlog](https://github.com/yust777/icpchue/blob/main/next-app/lib/content/devlog.ts): `next-app/lib/content/devlog.ts`

### Progress and Mentoring

- [Achievements](https://github.com/yust777/icpchue/blob/main/next-app/lib/services/achievements.ts): `next-app/lib/services/achievements.ts`
- [Leaderboards](https://github.com/yust777/icpchue/blob/main/next-app/app/api/leaderboard/route.ts): `next-app/app/api/leaderboard/route.ts`
- [Mentor tools](https://github.com/yust777/icpchue/blob/main/next-app/app/api/mentor/trainee/%5Bid%5D/route.ts): `next-app/app/api/mentor/trainee/[id]/route.ts`
- [Practice tracking](https://github.com/yust777/icpchue/blob/main/next-app/app/api/discipline/route.ts): `next-app/app/api/discipline/route.ts`

### Identity and Platform

- [Registration](https://github.com/yust777/icpchue/blob/main/next-app/app/api/auth/register/route.ts): `next-app/app/api/auth/register/route.ts`
- [Rate limiting](https://github.com/yust777/icpchue/blob/main/next-app/lib/cache/rate-limit.ts): `next-app/lib/cache/rate-limit.ts`
- [Application database](https://github.com/yust777/icpchue/blob/main/next-app/lib/db/db.ts): `next-app/lib/db/db.ts`

### Other components

- **Learner**
- **Codeforces**

## Connections

- Learner → Problem picker: chooses problem
- Problem picker → Problem data: opens workspace
- Problem data → Problem statistics API: fetches stats (evidence: `next-app/hooks/contest/useProblemData.ts`)
- Mirror workspace → Codeforces: loads problems
- Learner → Code editor: writes solution
- Learner → Whiteboard: draws ideas
- Learner → Submission analysis: reviews submissions
- Session library → Session lessons: renders lesson (evidence: `next-app/lib/sessionData.tsx`)
- Learner → Curriculum: follows path
- Learner → Devlog: reads updates
- Learner → Achievements: earns rewards
- Learner → Leaderboards: checks ranking
- Mentor tools → Practice tracking: reviews practice
- Registration → Rate limiting: limits requests (evidence: `next-app/app/api/auth/register/route.ts`)
- Registration → Application database: queries records (evidence: `next-app/app/api/auth/register/route.ts`)
- Practice tracking → Application database: reads and writes (evidence: `next-app/app/api/discipline/route.ts`)
