# suraj-115/trackurcodelife architecture

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

- Interactive diagram: https://gitdiagram.com/suraj-115/trackurcodelife
- Repository: https://github.com/suraj-115/trackurcodelife

## Overview

TrackUrCodeLife is a student-facing competitive-programming tracker with an administrative dashboard. Students register and authenticate, view cross-platform statistics and filtered rankings, and update profile handles; administrators manage student records, inspect contest analytics, and trigger synchronization. The backend gathers LeetCode and CodeChef data, maintains student and contest records in MongoDB, and schedules refreshes. The graph follows relationships visible in excerpts, the SOURCE INDEX, or README; some README-documented features have unsampled implementations, so their internal wiring is not asserted.

Main entry points: [`server/controllers/adminController.js`](https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/adminController.js) (Admin operations), [`server/services/sync/syncStudent.js`](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncStudent.js) (Per-student sync), [`server/app.js`](https://github.com/suraj-115/trackurcodelife/blob/main/server/app.js) (Express application), [`client/src/App.jsx`](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/App.jsx) (App navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_web_routes["App navigation<br/>[App.jsx]"]
  node_auth_ui["Sign-in and signup<br/>[Login.jsx]"]
  node_dashboard_ui["Student dashboard<br/>[Dashboard.jsx]"]
  node_profile_ui["Profile editor<br/>[EditProfile.jsx]"]
  node_admin_ui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_api_client["HTTP client<br/>[api.js]"]
end

subgraph group_api["API and identity"]
  node_api_app["Express application<br/>[app.js]"]
  node_auth_routes["Authentication routes<br/>[authRoutes.js]"]
  node_student_routes["Student routes<br/>[studentRoutes.js]"]
  node_admin_routes["Admin routes<br/>[adminRoutes.js]"]
  node_auth_controller["Authentication<br/>[authController.js]"]
  node_auth_guard["JWT protection<br/>[authMiddleware.js]"]
end

subgraph group_data["Student data"]
  node_student_controller["Student profiles and rankings"]
  node_admin_controller["Admin operations<br/>[adminController.js]"]
  node_student_model[("Student records<br/>[Student.js]")]
  node_otp_model[("OTP records<br/>[OTP.js]")]
  node_contest_model[("Contest participation")]
  node_analytics["Contest analytics"]
end

subgraph group_platforms["Platform collection"]
  node_leetcode["LeetCode data fetch<br/>[leetcodeService.js]"]
  node_codechef["CodeChef data fetch<br/>[codechefService.js]"]
end

subgraph group_sync["Synchronization"]
  node_sync_one["Per-student sync<br/>[syncStudent.js]"]
  node_contest_sync["Contest history sync"]
  node_sync_batch["Batch synchronization<br/>[syncAllStudents.js]"]
  node_scheduler["Sync scheduler<br/>[syncScheduler.js]"]
end

node_student(("Student"))
node_admin(("Administrator"))
node_mongo[("MongoDB")]
node_email["Email service"]
node_leetcode_site["LeetCode"]
node_codechef_site["CodeChef"]

node_student -->|"uses"| node_web_routes
node_admin -->|"uses"| node_web_routes
node_web_routes -->|"routes to"| node_auth_ui
node_web_routes -->|"routes to"| node_dashboard_ui
node_web_routes -->|"routes to"| node_profile_ui
node_web_routes -->|"routes to"| node_admin_ui
node_auth_ui -->|"requests through"| node_api_client
node_dashboard_ui -->|"requests through"| node_api_client
node_profile_ui -->|"requests through"| node_api_client
node_admin_ui -->|"requests through"| node_api_client
node_api_client -.->|"calls API"| node_api_app
node_api_app -->|"mounts"| node_auth_routes
node_api_app -->|"mounts"| node_student_routes
node_api_app -->|"mounts"| node_admin_routes
node_api_app -->|"connects"| node_mongo
node_api_app -->|"starts"| node_scheduler
node_auth_routes -->|"dispatches"| node_auth_controller
node_student_routes -->|"dispatches"| node_student_controller
node_admin_routes -->|"dispatches"| node_admin_controller
node_auth_routes -->|"protects profile"| node_auth_guard
node_student_routes -->|"protects requests"| node_auth_guard
node_admin_routes -->|"protects requests"| node_auth_guard
node_auth_controller -->|"reads and writes"| node_student_model
node_auth_controller -->|"uses"| node_otp_model
node_auth_controller -->|"sends OTP"| node_email
node_student_controller -->|"queries"| node_student_model
node_student_controller -->|"syncs profile"| node_sync_one
node_admin_controller -->|"manages"| node_student_model
node_admin_controller -->|"deletes records"| node_contest_model
node_admin_controller -->|"syncs student"| node_sync_one
node_admin_controller -->|"starts batch"| node_sync_batch
node_admin_controller -->|"updates sections"| node_contest_sync
node_admin_controller -->|"requests analytics"| node_analytics
node_analytics -->|"queries"| node_contest_model
node_scheduler -->|"schedules"| node_sync_batch
node_sync_batch -->|"loads students"| node_student_model
node_sync_batch -->|"syncs each"| node_sync_one
node_sync_one -->|"fetches stats"| node_leetcode
node_sync_one -->|"fetches stats"| node_codechef
node_sync_one -->|"updates stats"| node_student_model
node_sync_one -->|"stores history"| node_contest_sync
node_contest_sync -->|"writes history"| node_contest_model
node_leetcode -.->|"fetches from"| node_leetcode_site
node_codechef -->|"scrapes profile"| node_codechef_site

click node_web_routes "https://github.com/suraj-115/trackurcodelife/blob/main/client/src/App.jsx"
click node_auth_ui "https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/Login.jsx"
click node_dashboard_ui "https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/Dashboard.jsx"
click node_profile_ui "https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/EditProfile.jsx"
click node_admin_ui "https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/AdminDashboard.jsx"
click node_api_client "https://github.com/suraj-115/trackurcodelife/blob/main/client/src/services/api.js"
click node_api_app "https://github.com/suraj-115/trackurcodelife/blob/main/server/app.js"
click node_auth_routes "https://github.com/suraj-115/trackurcodelife/blob/main/server/routes/authRoutes.js"
click node_student_routes "https://github.com/suraj-115/trackurcodelife/blob/main/server/routes/studentRoutes.js"
click node_admin_routes "https://github.com/suraj-115/trackurcodelife/blob/main/server/routes/adminRoutes.js"
click node_auth_controller "https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/authController.js"
click node_auth_guard "https://github.com/suraj-115/trackurcodelife/blob/main/server/middleware/authMiddleware.js"
click node_student_controller "https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/studentController.js"
click node_admin_controller "https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/adminController.js"
click node_student_model "https://github.com/suraj-115/trackurcodelife/blob/main/server/models/Student.js"
click node_otp_model "https://github.com/suraj-115/trackurcodelife/blob/main/server/models/OTP.js"
click node_contest_model "https://github.com/suraj-115/trackurcodelife/blob/main/server/models/ContestParticipation.js"
click node_analytics "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/analytics/contestAnalytics.js"
click node_leetcode "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/leetcode/leetcodeService.js"
click node_codechef "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/codechef/codechefService.js"
click node_sync_one "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncStudent.js"
click node_contest_sync "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncContestHistory.js"
click node_sync_batch "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncAllStudents.js"
click node_scheduler "https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncScheduler.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_web_routes,node_auth_ui,node_dashboard_ui,node_profile_ui,node_admin_ui,node_api_client toneBlue
class node_api_app,node_auth_routes,node_student_routes,node_admin_routes,node_auth_controller,node_auth_guard,node_mongo toneAmber
class node_student_controller,node_admin_controller,node_student_model,node_otp_model,node_contest_model,node_analytics toneMint
class node_leetcode,node_codechef toneRose
class node_sync_one,node_contest_sync,node_sync_batch,node_scheduler,node_student,node_admin,node_email,node_leetcode_site,node_codechef_site toneIndigo
```

## Components

### Web application

- [App navigation](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Sign-in and signup](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/Login.jsx): `client/src/pages/Login.jsx`
- [Student dashboard](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/Dashboard.jsx): `client/src/pages/Dashboard.jsx`
- [Profile editor](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/EditProfile.jsx): `client/src/pages/EditProfile.jsx`
- [Admin dashboard](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/pages/AdminDashboard.jsx): `client/src/pages/AdminDashboard.jsx`
- [HTTP client](https://github.com/suraj-115/trackurcodelife/blob/main/client/src/services/api.js): `client/src/services/api.js`

### API and identity

- [Express application](https://github.com/suraj-115/trackurcodelife/blob/main/server/app.js): `server/app.js`
- [Authentication routes](https://github.com/suraj-115/trackurcodelife/blob/main/server/routes/authRoutes.js): `server/routes/authRoutes.js`
- [Student routes](https://github.com/suraj-115/trackurcodelife/blob/main/server/routes/studentRoutes.js): `server/routes/studentRoutes.js`
- [Admin routes](https://github.com/suraj-115/trackurcodelife/blob/main/server/routes/adminRoutes.js): `server/routes/adminRoutes.js`
- [Authentication](https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/authController.js): `server/controllers/authController.js`
- [JWT protection](https://github.com/suraj-115/trackurcodelife/blob/main/server/middleware/authMiddleware.js): `server/middleware/authMiddleware.js`

### Student data

- [Student profiles and rankings](https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/studentController.js): `server/controllers/studentController.js`
- [Admin operations](https://github.com/suraj-115/trackurcodelife/blob/main/server/controllers/adminController.js): `server/controllers/adminController.js`
- [Student records](https://github.com/suraj-115/trackurcodelife/blob/main/server/models/Student.js): `server/models/Student.js`
- [OTP records](https://github.com/suraj-115/trackurcodelife/blob/main/server/models/OTP.js): `server/models/OTP.js`
- [Contest participation](https://github.com/suraj-115/trackurcodelife/blob/main/server/models/ContestParticipation.js): `server/models/ContestParticipation.js`
- [Contest analytics](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/analytics/contestAnalytics.js): `server/services/analytics/contestAnalytics.js`

### Platform collection

- [LeetCode data fetch](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/leetcode/leetcodeService.js): `server/services/leetcode/leetcodeService.js`
- [CodeChef data fetch](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/codechef/codechefService.js): `server/services/codechef/codechefService.js`

### Synchronization

- [Per-student sync](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncStudent.js): `server/services/sync/syncStudent.js`
- [Contest history sync](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncContestHistory.js): `server/services/sync/syncContestHistory.js`
- [Batch synchronization](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncAllStudents.js): `server/services/sync/syncAllStudents.js`
- [Sync scheduler](https://github.com/suraj-115/trackurcodelife/blob/main/server/services/sync/syncScheduler.js): `server/services/sync/syncScheduler.js`

### Other components

- **Student**
- **Administrator**
- **MongoDB**
- **Email service**
- **LeetCode**
- **CodeChef**

## Connections

- Student → App navigation: uses (evidence: `client/src/App.jsx`)
- Administrator → App navigation: uses (evidence: `client/src/App.jsx`)
- App navigation → Sign-in and signup: routes to (evidence: `client/src/App.jsx`)
- App navigation → Student dashboard: routes to (evidence: `client/src/App.jsx`)
- App navigation → Profile editor: routes to (evidence: `client/src/App.jsx`)
- App navigation → Admin dashboard: routes to (evidence: `client/src/App.jsx`)
- Sign-in and signup → HTTP client: requests through (evidence: `client/src/pages/Login.jsx`)
- Student dashboard → HTTP client: requests through (evidence: `client/src/pages/Dashboard.jsx`)
- Profile editor → HTTP client: requests through (evidence: `client/src/pages/EditProfile.jsx`)
- Admin dashboard → HTTP client: requests through (evidence: `client/src/pages/AdminDashboard.jsx`)
- HTTP client → Express application: calls API (evidence: `README.md`)
- Express application → Authentication routes: mounts (evidence: `server/app.js`)
- Express application → Student routes: mounts (evidence: `server/app.js`)
- Express application → Admin routes: mounts (evidence: `server/app.js`)
- Express application → MongoDB: connects (evidence: `server/app.js`)
- Express application → Sync scheduler: starts (evidence: `server/app.js`)
- Authentication routes → Authentication: dispatches (evidence: `server/routes/authRoutes.js`)
- Student routes → Student profiles and rankings: dispatches (evidence: `server/routes/studentRoutes.js`)
- Admin routes → Admin operations: dispatches (evidence: `server/routes/adminRoutes.js`)
- Authentication routes → JWT protection: protects profile (evidence: `server/routes/authRoutes.js`)
- Student routes → JWT protection: protects requests (evidence: `server/routes/studentRoutes.js`)
- Admin routes → JWT protection: protects requests (evidence: `server/routes/adminRoutes.js`)
- Authentication → Student records: reads and writes (evidence: `server/controllers/authController.js`)
- Authentication → OTP records: uses (evidence: `server/controllers/authController.js`)
- Authentication → Email service: sends OTP (evidence: `server/controllers/authController.js`)
- Student profiles and rankings → Student records: queries (evidence: `server/controllers/studentController.js`)
- Student profiles and rankings → Per-student sync: syncs profile (evidence: `server/controllers/studentController.js`)
- Admin operations → Student records: manages (evidence: `server/controllers/adminController.js`)
- Admin operations → Contest participation: deletes records (evidence: `server/controllers/adminController.js`)
- Admin operations → Per-student sync: syncs student (evidence: `server/controllers/adminController.js`)
- Admin operations → Batch synchronization: starts batch (evidence: `server/controllers/adminController.js`)
- Admin operations → Contest history sync: updates sections (evidence: `server/controllers/adminController.js`)
- Admin operations → Contest analytics: requests analytics (evidence: `server/controllers/adminController.js`)
- Contest analytics → Contest participation: queries (evidence: `server/services/analytics/contestAnalytics.js`)
- Sync scheduler → Batch synchronization: schedules (evidence: `server/services/sync/syncScheduler.js`)
- Batch synchronization → Student records: loads students (evidence: `server/services/sync/syncAllStudents.js`)
- Batch synchronization → Per-student sync: syncs each (evidence: `server/services/sync/syncAllStudents.js`)
- Per-student sync → LeetCode data fetch: fetches stats (evidence: `server/services/sync/syncStudent.js`)
- Per-student sync → CodeChef data fetch: fetches stats (evidence: `server/services/sync/syncStudent.js`)
- Per-student sync → Student records: updates stats (evidence: `server/services/sync/syncStudent.js`)
- Per-student sync → Contest history sync: stores history (evidence: `server/services/sync/syncStudent.js`)
- Contest history sync → Contest participation: writes history (evidence: `server/services/sync/syncContestHistory.js`)
- LeetCode data fetch → LeetCode: fetches from
- CodeChef data fetch → CodeChef: scrapes profile (evidence: `server/services/codechef/codechefService.js`)
