# whowon2/why-runner architecture

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

- Interactive diagram: https://gitdiagram.com/whowon2/why-runner
- Repository: https://github.com/whowon2/why-runner

## Overview

Why Runner is a programming-learning platform: learners practice and submit problems, take classroom lessons, and participate in contests; instructors create and review learning material. Submissions are processed by a separate Rust judge that grades test cases and applies exercise structural constraints. The tree also shows authentication, profiles, notifications, AI assistance, and personalization. The README is empty and most web routes/actions were not sampled, so those areas are represented as capabilities without guessed runtime links; judge and sampled component relationships have direct evidence.

Main entry points: [`web/app/[locale]/user/_components/tabs.tsx`](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/tabs.tsx) (Profile activity), [`judge/src/main.rs`](https://github.com/whowon2/why-runner/blob/main/judge/src/main.rs) (Judge worker), [`web/drizzle/schemas/lessons.ts`](https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/lessons.ts) (Lesson schema), [`judge/src/runner.rs`](https://github.com/whowon2/why-runner/blob/main/judge/src/runner.rs) (Code grading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning workflows"]
  node_problem_practice["Problem practice"]
  node_problem_catalog["Problem catalog"]
  node_class_lessons["Classes and lessons"]
  node_lesson_review["Lesson review<br/>[lesson-review.tsx]"]
end

subgraph group_competition["Contests and profiles"]
  node_contest_workflows["Contest workflows"]
  node_user_profile["User profiles<br/>[profile.tsx]"]
  node_profile_tabs["Profile activity<br/>[tabs.tsx]"]
  node_my_contests["User contests<br/>[my-contests.tsx]"]
  node_my_problems["User problems<br/>[my-problems.tsx]"]
end

subgraph group_platform["Web platform"]
  node_authentication["Authentication<br/>[page.tsx]"]
  node_sign_in["Sign-in form<br/>[sign-in-tab.tsx]"]
  node_sign_up["Sign-up form<br/>[sign-up-tab.tsx]"]
  node_ai_features["AI assistance"]
  node_notifications["Notifications"]
  node_theme_tokens["Theme preferences"]
  node_theme_storage["Theme storage<br/>[storage.ts]"]
end

subgraph group_judge["Submission judge"]
  node_judge_worker["Judge worker<br/>[main.rs]"]
  node_judge_database["Judge database client<br/>[db.rs]"]
  node_grading["Code grading<br/>[runner.rs]"]
  node_sandbox["Execution isolation<br/>[isolate.rs]"]
  node_structural_checks["Structural checks<br/>[constraints.rs]"]
  node_judge_models["Judge data models<br/>[models.rs]"]
end

subgraph group_persistence["Persistent data"]
  node_web_schema[("Web data schema<br/>[schema.ts]")]
  node_lesson_schema[("Lesson schema<br/>[lessons.ts]")]
  node_problem_schema[("Problem schema<br/>[problems.ts]")]
  node_submission_schema[("Submission schema<br/>[submissions.ts]")]
  node_user_schema[("User schema<br/>[users.ts]")]
end

node_learner(("Learner"))

node_authentication -->|"renders"| node_sign_in
node_authentication -->|"renders"| node_sign_up
node_user_profile -->|"renders"| node_profile_tabs
node_profile_tabs -->|"renders"| node_my_contests
node_profile_tabs -->|"renders"| node_my_problems
node_user_profile -->|"uses"| node_profile_tabs
node_theme_tokens -->|"reads and writes"| node_theme_storage
node_judge_worker -->|"fetches jobs"| node_judge_database
node_judge_worker -->|"runs code"| node_grading
node_judge_worker -->|"imports"| node_structural_checks
node_judge_database -->|"uses models"| node_judge_models
node_grading -->|"uses isolation"| node_sandbox
node_grading -->|"uses models"| node_judge_models
node_lesson_schema -->|"references"| node_problem_schema
node_lesson_schema -->|"references"| node_submission_schema
node_lesson_schema -->|"references"| node_user_schema

click node_problem_practice "https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/problems/_components/workspace"
click node_problem_catalog "https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/problems"
click node_class_lessons "https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/classes"
click node_lesson_review "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/classes/_components/lesson-review.tsx"
click node_contest_workflows "https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/contests"
click node_user_profile "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/profile.tsx"
click node_profile_tabs "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/tabs.tsx"
click node_my_contests "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/my-contests.tsx"
click node_my_problems "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/my-problems.tsx"
click node_authentication "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/auth/signin/page.tsx"
click node_sign_in "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/auth/signin/_components/sign-in-tab.tsx"
click node_sign_up "https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/auth/signin/_components/sign-up-tab.tsx"
click node_ai_features "https://github.com/whowon2/why-runner/tree/main/web/lib/actions"
click node_notifications "https://github.com/whowon2/why-runner/tree/main/web/lib/actions/notifications"
click node_theme_tokens "https://github.com/whowon2/why-runner/blob/main/web/providers/theme-tokens-provider.tsx"
click node_theme_storage "https://github.com/whowon2/why-runner/blob/main/web/lib/themes/storage.ts"
click node_judge_worker "https://github.com/whowon2/why-runner/blob/main/judge/src/main.rs"
click node_judge_database "https://github.com/whowon2/why-runner/blob/main/judge/src/db.rs"
click node_grading "https://github.com/whowon2/why-runner/blob/main/judge/src/runner.rs"
click node_sandbox "https://github.com/whowon2/why-runner/blob/main/judge/src/isolate.rs"
click node_structural_checks "https://github.com/whowon2/why-runner/blob/main/judge/src/constraints.rs"
click node_judge_models "https://github.com/whowon2/why-runner/blob/main/judge/src/models.rs"
click node_web_schema "https://github.com/whowon2/why-runner/blob/main/web/drizzle/schema.ts"
click node_lesson_schema "https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/lessons.ts"
click node_problem_schema "https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/problems.ts"
click node_submission_schema "https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/submissions.ts"
click node_user_schema "https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/users.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_problem_practice,node_problem_catalog,node_class_lessons,node_lesson_review toneBlue
class node_contest_workflows,node_user_profile,node_profile_tabs,node_my_contests,node_my_problems toneAmber
class node_authentication,node_sign_in,node_sign_up,node_ai_features,node_notifications,node_theme_tokens,node_theme_storage toneMint
class node_judge_worker,node_judge_database,node_grading,node_sandbox,node_structural_checks,node_judge_models toneRose
class node_web_schema,node_lesson_schema,node_problem_schema,node_submission_schema,node_user_schema,node_learner toneIndigo
```

## Components

### Learning workflows

- [Problem practice](https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/problems/_components/workspace): `web/app/[locale]/problems/_components/workspace`
- [Problem catalog](https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/problems): `web/app/[locale]/problems`
- [Classes and lessons](https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/classes): `web/app/[locale]/classes`
- [Lesson review](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/classes/_components/lesson-review.tsx): `web/app/[locale]/classes/_components/lesson-review.tsx`

### Contests and profiles

- [Contest workflows](https://github.com/whowon2/why-runner/tree/main/web/app/%5Blocale%5D/contests): `web/app/[locale]/contests`
- [User profiles](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/profile.tsx): `web/app/[locale]/user/_components/profile.tsx`
- [Profile activity](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/tabs.tsx): `web/app/[locale]/user/_components/tabs.tsx`
- [User contests](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/my-contests.tsx): `web/app/[locale]/user/_components/my-contests.tsx`
- [User problems](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/user/_components/my-problems.tsx): `web/app/[locale]/user/_components/my-problems.tsx`

### Web platform

- [Authentication](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/auth/signin/page.tsx): `web/app/[locale]/auth/signin/page.tsx`
- [Sign-in form](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/auth/signin/_components/sign-in-tab.tsx): `web/app/[locale]/auth/signin/_components/sign-in-tab.tsx`
- [Sign-up form](https://github.com/whowon2/why-runner/blob/main/web/app/%5Blocale%5D/auth/signin/_components/sign-up-tab.tsx): `web/app/[locale]/auth/signin/_components/sign-up-tab.tsx`
- [AI assistance](https://github.com/whowon2/why-runner/tree/main/web/lib/actions): `web/lib/actions`
- [Notifications](https://github.com/whowon2/why-runner/tree/main/web/lib/actions/notifications): `web/lib/actions/notifications`
- [Theme preferences](https://github.com/whowon2/why-runner/blob/main/web/providers/theme-tokens-provider.tsx): `web/providers/theme-tokens-provider.tsx`
- [Theme storage](https://github.com/whowon2/why-runner/blob/main/web/lib/themes/storage.ts): `web/lib/themes/storage.ts`

### Submission judge

- [Judge worker](https://github.com/whowon2/why-runner/blob/main/judge/src/main.rs): `judge/src/main.rs`
- [Judge database client](https://github.com/whowon2/why-runner/blob/main/judge/src/db.rs): `judge/src/db.rs`
- [Code grading](https://github.com/whowon2/why-runner/blob/main/judge/src/runner.rs): `judge/src/runner.rs`
- [Execution isolation](https://github.com/whowon2/why-runner/blob/main/judge/src/isolate.rs): `judge/src/isolate.rs`
- [Structural checks](https://github.com/whowon2/why-runner/blob/main/judge/src/constraints.rs): `judge/src/constraints.rs`
- [Judge data models](https://github.com/whowon2/why-runner/blob/main/judge/src/models.rs): `judge/src/models.rs`

### Persistent data

- [Web data schema](https://github.com/whowon2/why-runner/blob/main/web/drizzle/schema.ts): `web/drizzle/schema.ts`
- [Lesson schema](https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/lessons.ts): `web/drizzle/schemas/lessons.ts`
- [Problem schema](https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/problems.ts): `web/drizzle/schemas/problems.ts`
- [Submission schema](https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/submissions.ts): `web/drizzle/schemas/submissions.ts`
- [User schema](https://github.com/whowon2/why-runner/blob/main/web/drizzle/schemas/users.ts): `web/drizzle/schemas/users.ts`

### Other components

- **Learner**

## Connections

- Authentication → Sign-in form: renders (evidence: `web/app/[locale]/auth/signin/page.tsx`)
- Authentication → Sign-up form: renders (evidence: `web/app/[locale]/auth/signin/page.tsx`)
- User profiles → Profile activity: renders (evidence: `web/app/[locale]/user/page.tsx`)
- Profile activity → User contests: renders (evidence: `web/app/[locale]/user/_components/tabs.tsx`)
- Profile activity → User problems: renders (evidence: `web/app/[locale]/user/_components/tabs.tsx`)
- User profiles → Profile activity: uses (evidence: `web/app/[locale]/user/page.tsx`)
- Theme preferences → Theme storage: reads and writes (evidence: `web/providers/theme-tokens-provider.tsx`)
- Judge worker → Judge database client: fetches jobs (evidence: `judge/src/main.rs`)
- Judge worker → Code grading: runs code (evidence: `judge/src/main.rs`)
- Judge worker → Structural checks: imports (evidence: `judge/src/main.rs`)
- Judge database client → Judge data models: uses models (evidence: `judge/src/db.rs`)
- Code grading → Execution isolation: uses isolation (evidence: `judge/src/runner.rs`)
- Code grading → Judge data models: uses models (evidence: `judge/src/runner.rs`)
- Lesson schema → Problem schema: references (evidence: `web/drizzle/schemas/lessons.ts`)
- Lesson schema → Submission schema: references (evidence: `web/drizzle/schemas/lessons.ts`)
- Lesson schema → User schema: references (evidence: `web/drizzle/schemas/lessons.ts`)
