# koushiksoma5/codeorbit architecture

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

- Interactive diagram: https://gitdiagram.com/koushiksoma5/codeorbit
- Repository: https://github.com/koushiksoma5/codeorbit

## Overview

CodeOrbit combines platform-stat collection with interview-readiness analysis. Users register and link LeetCode/Codeforces handles, then view a dashboard of platform metrics, leaderboard, history, topic mastery, charts, and readiness recommendations; settings update their profile. The Express API also supports scheduled hourly snapshots and LeetCode problem caching. The graph reflects documented capabilities and shown calls; some dashboard/API and integration details are documented in the README, while unsampled implementation details are not assumed.

Main entry points: [`server/index.js`](https://github.com/koushiksoma5/codeorbit/blob/master/server/index.js) (Express routes), [`server/cron/updateStats.js`](https://github.com/koushiksoma5/codeorbit/blob/master/server/cron/updateStats.js) (Hourly collection), [`client/src/App.js`](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/App.js) (App routing), [`client/src/pages/Dashboard.js`](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Dashboard.js) (Stats dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["React client"]
  node_app["App routing<br/>[App.js]"]
  node_signup["Sign up<br/>[Signup.js]"]
  node_login["Login<br/>[Login.js]"]
  node_dashboard["Stats dashboard<br/>[Dashboard.js]"]
  node_settings["Profile settings<br/>[Settings.js]"]
end

subgraph group_api["REST API"]
  node_api["Express routes<br/>[index.js]"]
  node_auth["JWT auth<br/>[auth.js]"]
end

subgraph group_analysis["Analysis and persistence"]
  node_readiness["Readiness scoring<br/>[readinessEngine.js]"]
  node_scoringconfig["Scoring rules<br/>[readinessConfig.js]"]
  node_scheduler["Hourly collection<br/>[updateStats.js]"]
  node_users[("User records<br/>[User.js]")]
  node_history[("Stat history<br/>[StatHistory.js]")]
  node_problemcache[("Problem cache<br/>[LeetCodeProblem.js]")]
end

subgraph group_integrations["Platform integrations"]
  node_leetcode{{"LeetCode APIs"}}
  node_codeforces{{"Codeforces API"}}
end

node_user(("User"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_settings
node_signup -->|"registers via"| node_api
node_login -->|"authenticates via"| node_api
node_dashboard -->|"requests stats"| node_api
node_settings -->|"updates profile"| node_api
node_api -->|"guards routes"| node_auth
node_api -->|"reads and writes"| node_users
node_api -->|"reads history"| node_history
node_api -->|"computes readiness"| node_readiness
node_readiness -->|"uses weights"| node_scoringconfig
node_api -->|"caches problems"| node_problemcache
node_api -->|"fetches profile data"| node_leetcode
node_api -->|"fetches submissions"| node_codeforces
node_scheduler -->|"loads accounts"| node_users
node_scheduler -->|"writes snapshots"| node_history
node_scheduler -->|"pre-caches problems"| node_problemcache
node_scheduler -->|"fetches problems"| node_leetcode
node_scheduler -->|"fetches stats"| node_codeforces
node_dashboard -->|"loads trend data"| node_history
node_dashboard -->|"requests report"| node_readiness

click node_app "https://github.com/koushiksoma5/codeorbit/blob/master/client/src/App.js"
click node_signup "https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Signup.js"
click node_login "https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Login.js"
click node_dashboard "https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Dashboard.js"
click node_settings "https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Settings.js"
click node_api "https://github.com/koushiksoma5/codeorbit/blob/master/server/index.js"
click node_auth "https://github.com/koushiksoma5/codeorbit/blob/master/server/middleware/auth.js"
click node_readiness "https://github.com/koushiksoma5/codeorbit/blob/master/server/utils/readinessEngine.js"
click node_scoringconfig "https://github.com/koushiksoma5/codeorbit/blob/master/server/config/readinessConfig.js"
click node_scheduler "https://github.com/koushiksoma5/codeorbit/blob/master/server/cron/updateStats.js"
click node_users "https://github.com/koushiksoma5/codeorbit/blob/master/server/models/User.js"
click node_history "https://github.com/koushiksoma5/codeorbit/blob/master/server/models/StatHistory.js"
click node_problemcache "https://github.com/koushiksoma5/codeorbit/blob/master/server/models/LeetCodeProblem.js"

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,node_signup,node_login,node_dashboard,node_settings,node_user toneBlue
class node_api,node_auth toneAmber
class node_readiness,node_scoringconfig,node_scheduler,node_users,node_history,node_problemcache toneMint
class node_leetcode,node_codeforces toneRose
```

## Components

### React client

- [App routing](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/App.js): `client/src/App.js`
- [Sign up](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Signup.js): `client/src/pages/Signup.js`
- [Login](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Login.js): `client/src/pages/Login.js`
- [Stats dashboard](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Dashboard.js): `client/src/pages/Dashboard.js`
- [Profile settings](https://github.com/koushiksoma5/codeorbit/blob/master/client/src/pages/Settings.js): `client/src/pages/Settings.js`

### REST API

- [Express routes](https://github.com/koushiksoma5/codeorbit/blob/master/server/index.js): `server/index.js`
- [JWT auth](https://github.com/koushiksoma5/codeorbit/blob/master/server/middleware/auth.js): `server/middleware/auth.js`

### Analysis and persistence

- [Readiness scoring](https://github.com/koushiksoma5/codeorbit/blob/master/server/utils/readinessEngine.js): `server/utils/readinessEngine.js`
- [Scoring rules](https://github.com/koushiksoma5/codeorbit/blob/master/server/config/readinessConfig.js): `server/config/readinessConfig.js`
- [Hourly collection](https://github.com/koushiksoma5/codeorbit/blob/master/server/cron/updateStats.js): `server/cron/updateStats.js`
- [User records](https://github.com/koushiksoma5/codeorbit/blob/master/server/models/User.js): `server/models/User.js`
- [Stat history](https://github.com/koushiksoma5/codeorbit/blob/master/server/models/StatHistory.js): `server/models/StatHistory.js`
- [Problem cache](https://github.com/koushiksoma5/codeorbit/blob/master/server/models/LeetCodeProblem.js): `server/models/LeetCodeProblem.js`

### Platform integrations

- **LeetCode APIs**
- **Codeforces API**

### Other components

- **User**

## Connections

- User → App routing: uses (evidence: `README.md`)
- App routing → Sign up: routes to (evidence: `client/src/App.js`)
- App routing → Login: routes to (evidence: `client/src/App.js`)
- App routing → Stats dashboard: routes to (evidence: `client/src/App.js`)
- App routing → Profile settings: routes to (evidence: `client/src/App.js`)
- Sign up → Express routes: registers via (evidence: `README.md`)
- Login → Express routes: authenticates via (evidence: `README.md`)
- Stats dashboard → Express routes: requests stats (evidence: `client/src/pages/Dashboard.js`)
- Profile settings → Express routes: updates profile (evidence: `client/src/pages/Settings.js`)
- Express routes → JWT auth: guards routes (evidence: `server/index.js`)
- Express routes → User records: reads and writes (evidence: `server/index.js`)
- Express routes → Stat history: reads history (evidence: `server/index.js`)
- Express routes → Readiness scoring: computes readiness (evidence: `server/index.js`)
- Readiness scoring → Scoring rules: uses weights (evidence: `server/utils/readinessEngine.js`)
- Express routes → Problem cache: caches problems (evidence: `server/index.js`)
- Express routes → LeetCode APIs: fetches profile data (evidence: `server/index.js`)
- Express routes → Codeforces API: fetches submissions (evidence: `server/index.js`)
- Hourly collection → User records: loads accounts (evidence: `server/cron/updateStats.js`)
- Hourly collection → Stat history: writes snapshots (evidence: `server/cron/updateStats.js`)
- Hourly collection → Problem cache: pre-caches problems (evidence: `server/cron/updateStats.js`)
- Hourly collection → LeetCode APIs: fetches problems (evidence: `server/cron/updateStats.js`)
- Hourly collection → Codeforces API: fetches stats (evidence: `server/cron/updateStats.js`)
- Stats dashboard → Stat history: loads trend data (evidence: `client/src/pages/Dashboard.js`)
- Stats dashboard → Readiness scoring: requests report (evidence: `README.md`)
