# fmfalgun/prepclash architecture

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

- Interactive diagram: https://gitdiagram.com/fmfalgun/prepclash
- Repository: https://github.com/fmfalgun/prepclash

## Overview

PrepClash is a gamified personal preparation tracker, with competitive programming, skill-tree progression, study and reading logs, workouts, and social features. The user enters through the app shell, selects a screen, and records or reviews progress backed by shared application state; the store also syncs cloud data and connects competitive-programming integrations. The README describes an older vanilla-JS version, so this map follows the current React/TypeScript tree. Some screen and integration links rely on the SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`src/store/useStore.ts`](https://github.com/fmfalgun/prepclash/blob/main/src/store/useStore.ts) (App state), [`src/App.tsx`](https://github.com/fmfalgun/prepclash/blob/main/src/App.tsx) (App shell), [`src/screens/Arena.tsx`](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Arena.tsx) (Problem arena), [`src/components/PlayerDetailModal.tsx`](https://github.com/fmfalgun/prepclash/blob/main/src/components/PlayerDetailModal.tsx) (Player profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_app["App shell<br/>[App.tsx]"]
end

subgraph group_progress["Progress and practice"]
  node_home["Dashboard<br/>[Home.tsx]"]
  node_village["Skill village<br/>[Village.tsx]"]
  node_arena["Problem arena<br/>[Arena.tsx]"]
  node_questionbank["Question data<br/>[dsa450.ts]"]
  node_a2oj["A2OJ ladders<br/>[a2oj.ts]"]
end

subgraph group_tracking["Personal tracking"]
  node_reading["Reading tracker<br/>[Reading.tsx]"]
  node_study["Study tracker<br/>[Study.tsx]"]
  node_workout["Workout tracker<br/>[Workout.tsx]"]
  node_sessionmodal["Log session"]
  node_workoutstats["Workout metrics<br/>[workoutStats.ts]"]
end

subgraph group_shared["State and services"]
  node_store["App state<br/>[useStore.ts]"]
  node_selectors["Progress selectors<br/>[selectors.ts]"]
  node_firebase["Cloud services<br/>[firebase.ts]"]
  node_dates["Date metrics<br/>[dates.ts]"]
  node_grades["Rank grading<br/>[grades.ts]"]
  node_codeforces["Codeforces client<br/>[codeforces.ts]"]
  node_codechef["CodeChef client<br/>[codechef.ts]"]
  node_leetcode["LeetCode client<br/>[leetcode.ts]"]
  node_monkeytype["Monkeytype client<br/>[monkeytype.ts]"]
  node_github["GitHub client<br/>[github.ts]"]
end

subgraph group_social["Social competition"]
  node_clan["Clan roadmap<br/>[Clan.tsx]"]
  node_ladder["Player ladder<br/>[Ladder.tsx]"]
  node_playerdetail["Player profile"]
end

node_user(("Player"))

node_user -->|"uses"| node_app
node_app -->|"reads state"| node_store
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_village
node_app -->|"routes to"| node_arena
node_app -->|"routes to"| node_clan
node_app -->|"routes to"| node_ladder
node_app -->|"routes to"| node_workout
node_app -->|"routes to"| node_study
node_app -->|"routes to"| node_reading
node_app -->|"shows modal"| node_playerdetail
node_app -->|"initializes"| node_firebase
node_home -->|"reads state"| node_store
node_village -->|"reads state"| node_store
node_arena -->|"reads state"| node_store
node_arena -->|"uses questions"| node_questionbank
node_arena -->|"uses ladders"| node_a2oj
node_reading -->|"reads state"| node_store
node_study -->|"reads state"| node_store
node_workout -->|"reads state"| node_store
node_workout -->|"uses metrics"| node_workoutstats
node_sessionmodal -->|"submits session"| node_store
node_sessionmodal -->|"computes session"| node_workoutstats
node_clan -->|"reads state"| node_store
node_ladder -->|"reads state"| node_store
node_playerdetail -->|"reads state"| node_store
node_playerdetail -->|"joins clan"| node_firebase
node_playerdetail -.->|"renders radar"| node_home
node_store -->|"saves cloud data"| node_firebase
node_store -->|"syncs profile"| node_codeforces
node_store -->|"syncs profile"| node_codechef
node_store -->|"syncs profile"| node_leetcode
node_store -->|"syncs profile"| node_monkeytype
node_store -->|"uses integration"| node_github
node_selectors -->|"computes streaks"| node_dates
node_selectors -->|"computes ranks"| node_grades
node_store -.->|"derives progress"| node_selectors
node_firebase -->|"assigns rank"| node_grades

click node_app "https://github.com/fmfalgun/prepclash/blob/main/src/App.tsx"
click node_home "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Home.tsx"
click node_village "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Village.tsx"
click node_arena "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Arena.tsx"
click node_questionbank "https://github.com/fmfalgun/prepclash/blob/main/src/data/dsa450.ts"
click node_a2oj "https://github.com/fmfalgun/prepclash/blob/main/src/data/a2oj.ts"
click node_reading "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Reading.tsx"
click node_study "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Study.tsx"
click node_workout "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Workout.tsx"
click node_sessionmodal "https://github.com/fmfalgun/prepclash/blob/main/src/components/modals/LogSessionModal.tsx"
click node_workoutstats "https://github.com/fmfalgun/prepclash/blob/main/src/lib/workoutStats.ts"
click node_clan "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Clan.tsx"
click node_ladder "https://github.com/fmfalgun/prepclash/blob/main/src/screens/Ladder.tsx"
click node_playerdetail "https://github.com/fmfalgun/prepclash/blob/main/src/components/PlayerDetailModal.tsx"
click node_store "https://github.com/fmfalgun/prepclash/blob/main/src/store/useStore.ts"
click node_selectors "https://github.com/fmfalgun/prepclash/blob/main/src/store/selectors.ts"
click node_firebase "https://github.com/fmfalgun/prepclash/blob/main/src/lib/firebase.ts"
click node_dates "https://github.com/fmfalgun/prepclash/blob/main/src/lib/dates.ts"
click node_grades "https://github.com/fmfalgun/prepclash/blob/main/src/lib/grades.ts"
click node_codeforces "https://github.com/fmfalgun/prepclash/blob/main/src/lib/codeforces.ts"
click node_codechef "https://github.com/fmfalgun/prepclash/blob/main/src/lib/codechef.ts"
click node_leetcode "https://github.com/fmfalgun/prepclash/blob/main/src/lib/leetcode.ts"
click node_monkeytype "https://github.com/fmfalgun/prepclash/blob/main/src/lib/monkeytype.ts"
click node_github "https://github.com/fmfalgun/prepclash/blob/main/src/lib/github.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_app toneBlue
class node_home,node_village,node_arena,node_questionbank,node_a2oj toneAmber
class node_reading,node_study,node_workout,node_sessionmodal,node_workoutstats toneMint
class node_store,node_selectors,node_firebase,node_dates,node_grades,node_codeforces,node_codechef,node_leetcode,node_monkeytype,node_github toneRose
class node_clan,node_ladder,node_playerdetail,node_user toneIndigo
```

## Components

### App shell

- [App shell](https://github.com/fmfalgun/prepclash/blob/main/src/App.tsx): `src/App.tsx`

### Progress and practice

- [Dashboard](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Home.tsx): `src/screens/Home.tsx`
- [Skill village](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Village.tsx): `src/screens/Village.tsx`
- [Problem arena](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Arena.tsx): `src/screens/Arena.tsx`
- [Question data](https://github.com/fmfalgun/prepclash/blob/main/src/data/dsa450.ts): `src/data/dsa450.ts`
- [A2OJ ladders](https://github.com/fmfalgun/prepclash/blob/main/src/data/a2oj.ts): `src/data/a2oj.ts`

### Personal tracking

- [Reading tracker](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Reading.tsx): `src/screens/Reading.tsx`
- [Study tracker](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Study.tsx): `src/screens/Study.tsx`
- [Workout tracker](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Workout.tsx): `src/screens/Workout.tsx`
- [Log session](https://github.com/fmfalgun/prepclash/blob/main/src/components/modals/LogSessionModal.tsx): `src/components/modals/LogSessionModal.tsx`
- [Workout metrics](https://github.com/fmfalgun/prepclash/blob/main/src/lib/workoutStats.ts): `src/lib/workoutStats.ts`

### State and services

- [App state](https://github.com/fmfalgun/prepclash/blob/main/src/store/useStore.ts): `src/store/useStore.ts`
- [Progress selectors](https://github.com/fmfalgun/prepclash/blob/main/src/store/selectors.ts): `src/store/selectors.ts`
- [Cloud services](https://github.com/fmfalgun/prepclash/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Date metrics](https://github.com/fmfalgun/prepclash/blob/main/src/lib/dates.ts): `src/lib/dates.ts`
- [Rank grading](https://github.com/fmfalgun/prepclash/blob/main/src/lib/grades.ts): `src/lib/grades.ts`
- [Codeforces client](https://github.com/fmfalgun/prepclash/blob/main/src/lib/codeforces.ts): `src/lib/codeforces.ts`
- [CodeChef client](https://github.com/fmfalgun/prepclash/blob/main/src/lib/codechef.ts): `src/lib/codechef.ts`
- [LeetCode client](https://github.com/fmfalgun/prepclash/blob/main/src/lib/leetcode.ts): `src/lib/leetcode.ts`
- [Monkeytype client](https://github.com/fmfalgun/prepclash/blob/main/src/lib/monkeytype.ts): `src/lib/monkeytype.ts`
- [GitHub client](https://github.com/fmfalgun/prepclash/blob/main/src/lib/github.ts): `src/lib/github.ts`

### Social competition

- [Clan roadmap](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Clan.tsx): `src/screens/Clan.tsx`
- [Player ladder](https://github.com/fmfalgun/prepclash/blob/main/src/screens/Ladder.tsx): `src/screens/Ladder.tsx`
- [Player profile](https://github.com/fmfalgun/prepclash/blob/main/src/components/PlayerDetailModal.tsx): `src/components/PlayerDetailModal.tsx`

### Other components

- **Player**

## Connections

- Player → App shell: uses (evidence: `src/App.tsx`)
- App shell → App state: reads state (evidence: `src/App.tsx`)
- App shell → Dashboard: routes to (evidence: `src/App.tsx`)
- App shell → Skill village: routes to (evidence: `src/App.tsx`)
- App shell → Problem arena: routes to (evidence: `src/App.tsx`)
- App shell → Clan roadmap: routes to (evidence: `src/App.tsx`)
- App shell → Player ladder: routes to (evidence: `src/App.tsx`)
- App shell → Workout tracker: routes to (evidence: `src/App.tsx`)
- App shell → Study tracker: routes to (evidence: `src/App.tsx`)
- App shell → Reading tracker: routes to (evidence: `src/App.tsx`)
- App shell → Player profile: shows modal (evidence: `src/App.tsx`)
- App shell → Cloud services: initializes (evidence: `src/App.tsx`)
- Dashboard → App state: reads state (evidence: `src/screens/Home.tsx`)
- Skill village → App state: reads state (evidence: `src/screens/Village.tsx`)
- Problem arena → App state: reads state (evidence: `src/screens/Arena.tsx`)
- Problem arena → Question data: uses questions (evidence: `src/screens/Arena.tsx`)
- Problem arena → A2OJ ladders: uses ladders (evidence: `src/screens/Arena.tsx`)
- Reading tracker → App state: reads state (evidence: `src/screens/Reading.tsx`)
- Study tracker → App state: reads state (evidence: `src/App.tsx`)
- Workout tracker → App state: reads state (evidence: `src/screens/Workout.tsx`)
- Workout tracker → Workout metrics: uses metrics (evidence: `src/screens/Workout.tsx`)
- Log session → App state: submits session (evidence: `src/components/modals/LogSessionModal.tsx`)
- Log session → Workout metrics: computes session (evidence: `src/components/modals/LogSessionModal.tsx`)
- Clan roadmap → App state: reads state (evidence: `src/App.tsx`)
- Player ladder → App state: reads state (evidence: `src/App.tsx`)
- Player profile → App state: reads state (evidence: `src/components/PlayerDetailModal.tsx`)
- Player profile → Cloud services: joins clan (evidence: `src/components/PlayerDetailModal.tsx`)
- Player profile → Dashboard: renders radar
- App state → Cloud services: saves cloud data (evidence: `src/store/useStore.ts`)
- App state → Codeforces client: syncs profile (evidence: `src/store/useStore.ts`)
- App state → CodeChef client: syncs profile (evidence: `src/store/useStore.ts`)
- App state → LeetCode client: syncs profile (evidence: `src/store/useStore.ts`)
- App state → Monkeytype client: syncs profile (evidence: `src/store/useStore.ts`)
- App state → GitHub client: uses integration (evidence: `src/store/useStore.ts`)
- Progress selectors → Date metrics: computes streaks (evidence: `src/store/selectors.ts`)
- Progress selectors → Rank grading: computes ranks (evidence: `src/store/selectors.ts`)
- App state → Progress selectors: derives progress
- Cloud services → Rank grading: assigns rank (evidence: `src/lib/firebase.ts`)
