# nikhilpundir108/dsaprogresstracker architecture

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

- Interactive diagram: https://gitdiagram.com/nikhilpundir108/dsaprogresstracker
- Repository: https://github.com/nikhilpundir108/dsaprogresstracker

## Overview

DSATrack tracks college students’ DSA activity across LeetCode and GeeksforGeeks, with separate student, instructor, and administrator experiences. The main workflow is: instructors organize batches and assign questions; students join batches and connect platform handles; synchronization gathers solving activity and updates assignment submissions; dashboards expose progress and leaderboards. Authentication and MongoDB-backed domain records support these flows. The source index confirms many API-to-model dependencies, but most pages and some routes were not sampled, so their specific request paths are not asserted.

Main entry points: [`src/lib/platforms/sync.js`](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/sync.js) (Progress synchronizer), [`src/lib/auth.js`](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/auth.js) (Token and access), [`src/app/api/assignments`](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/assignments) (Assignment API), [`src/lib/models/User.js`](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/User.js) (User records)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Role experiences"]
  node_portal["Role portals"]
  node_auth_ui["Auth context<br/>[AuthContext.jsx]"]
end

subgraph group_api["Application API"]
  node_auth_api["Authentication API"]
  node_admin_api["Administration API"]
  node_batch_api["Batch API"]
  node_assignment_api["Assignment API"]
  node_student_api["Student API"]
  node_student_detail["Student records API<br/>[route.js]"]
end

subgraph group_tracking["Progress tracking"]
  node_sync["Progress synchronizer<br/>[sync.js]"]
  node_leetcode["LeetCode adapter<br/>[leetcode.js]"]
  node_gfg["GeeksforGeeks adapter<br/>[gfg.js]"]
end

subgraph group_data["Identity and data"]
  node_auth_service["Token and access<br/>[auth.js]"]
  node_database["MongoDB connection<br/>[db.js]"]
  node_user_model[("User records<br/>[User.js]")]
  node_batch_model[("Batch records<br/>[Batch.js]")]
  node_join_model[("Join requests")]
  node_assignment_model[("Assignments<br/>[Assignment.js]")]
  node_submission_model[("Submissions<br/>[Submission.js]")]
  node_seed_data["Sample domain data<br/>[seedData.js]"]
end

node_users(("Platform users"))
node_platforms["Coding platforms"]

node_users -.->|"use role views"| node_portal
node_portal -.->|"uses auth state"| node_auth_ui
node_auth_ui -->|"requests login"| node_auth_api
node_auth_api -->|"verifies identity"| node_auth_service
node_auth_service -->|"looks up users"| node_user_model
node_auth_service -->|"connects database"| node_database
node_admin_api -->|"checks access"| node_auth_service
node_admin_api -->|"reads users"| node_user_model
node_admin_api -->|"reads batches"| node_batch_model
node_admin_api -->|"reads assignments"| node_assignment_model
node_batch_api -->|"checks access"| node_auth_service
node_batch_api -->|"manages batches"| node_batch_model
node_batch_api -->|"counts assignments"| node_assignment_model
node_batch_api -->|"counts requests"| node_join_model
node_assignment_api -->|"checks access"| node_auth_service
node_assignment_api -->|"finds enrolled batches"| node_batch_model
node_assignment_api -->|"creates assignments"| node_assignment_model
node_assignment_api -->|"counts completions"| node_submission_model
node_assignment_api -->|"loads students"| node_user_model
node_student_api -->|"checks access"| node_auth_service
node_student_api -->|"starts sync"| node_sync
node_student_api -->|"checks handles"| node_leetcode
node_student_api -->|"checks handles"| node_gfg
node_student_detail -->|"reads student"| node_user_model
node_sync -->|"connects database"| node_database
node_sync -->|"loads and updates"| node_user_model
node_sync -->|"finds enrollments"| node_batch_model
node_sync -->|"loads questions"| node_assignment_model
node_sync -->|"records progress"| node_submission_model
node_sync -->|"fetches activity"| node_leetcode
node_sync -->|"fetches activity"| node_gfg
node_leetcode -.->|"fetches profile data"| node_platforms
node_gfg -.->|"fetches profile data"| node_platforms
node_seed_data -->|"seeds records"| node_user_model
node_seed_data -->|"seeds records"| node_batch_model
node_seed_data -->|"seeds records"| node_join_model
node_seed_data -->|"seeds records"| node_assignment_model
node_seed_data -->|"seeds records"| node_submission_model

click node_portal "https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app"
click node_auth_ui "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/components/AuthContext.jsx"
click node_auth_api "https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/auth"
click node_admin_api "https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/admin"
click node_batch_api "https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/batches"
click node_assignment_api "https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/assignments"
click node_student_api "https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/student"
click node_student_detail "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/app/api/students/%5Bid%5D/route.js"
click node_auth_service "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/auth.js"
click node_database "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/db.js"
click node_user_model "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/User.js"
click node_batch_model "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/Batch.js"
click node_join_model "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/BatchJoinRequest.js"
click node_assignment_model "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/Assignment.js"
click node_submission_model "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/Submission.js"
click node_sync "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/sync.js"
click node_leetcode "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/leetcode.js"
click node_gfg "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/gfg.js"
click node_seed_data "https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/seedData.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_portal,node_auth_ui,node_users toneBlue
class node_auth_api,node_admin_api,node_batch_api,node_assignment_api,node_student_api,node_student_detail toneAmber
class node_sync,node_leetcode,node_gfg toneMint
class node_auth_service,node_database,node_user_model,node_batch_model,node_join_model,node_assignment_model,node_submission_model,node_seed_data toneRose
class node_platforms toneIndigo
```

## Components

### Role experiences

- [Role portals](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app): `src/app`
- [Auth context](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/components/AuthContext.jsx): `src/components/AuthContext.jsx`

### Application API

- [Authentication API](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/auth): `src/app/api/auth`
- [Administration API](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/admin): `src/app/api/admin`
- [Batch API](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/batches): `src/app/api/batches`
- [Assignment API](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/assignments): `src/app/api/assignments`
- [Student API](https://github.com/nikhilpundir108/dsaprogresstracker/tree/main/src/app/api/student): `src/app/api/student`
- [Student records API](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/app/api/students/%5Bid%5D/route.js): `src/app/api/students/[id]/route.js`

### Progress tracking

- [Progress synchronizer](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/sync.js): `src/lib/platforms/sync.js`
- [LeetCode adapter](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/leetcode.js): `src/lib/platforms/leetcode.js`
- [GeeksforGeeks adapter](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/platforms/gfg.js): `src/lib/platforms/gfg.js`

### Identity and data

- [Token and access](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/auth.js): `src/lib/auth.js`
- [MongoDB connection](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/db.js): `src/lib/db.js`
- [User records](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/User.js): `src/lib/models/User.js`
- [Batch records](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/Batch.js): `src/lib/models/Batch.js`
- [Join requests](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/BatchJoinRequest.js): `src/lib/models/BatchJoinRequest.js`
- [Assignments](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/Assignment.js): `src/lib/models/Assignment.js`
- [Submissions](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/models/Submission.js): `src/lib/models/Submission.js`
- [Sample domain data](https://github.com/nikhilpundir108/dsaprogresstracker/blob/main/src/lib/seedData.js): `src/lib/seedData.js`

### Other components

- **Platform users**
- **Coding platforms**

## Connections

- Platform users → Role portals: use role views (evidence: `README.md`)
- Role portals → Auth context: uses auth state
- Auth context → Authentication API: requests login (evidence: `src/components/AuthContext.jsx`)
- Authentication API → Token and access: verifies identity (evidence: `src/app/api/auth/login/route.js`)
- Token and access → User records: looks up users (evidence: `src/lib/auth.js`)
- Token and access → MongoDB connection: connects database (evidence: `src/lib/auth.js`)
- Administration API → Token and access: checks access (evidence: `src/app/api/admin/stats/route.js`)
- Administration API → User records: reads users (evidence: `src/app/api/admin/stats/route.js`)
- Administration API → Batch records: reads batches (evidence: `src/app/api/admin/stats/route.js`)
- Administration API → Assignments: reads assignments (evidence: `src/app/api/admin/stats/route.js`)
- Batch API → Token and access: checks access (evidence: `src/app/api/batches/route.js`)
- Batch API → Batch records: manages batches (evidence: `src/app/api/batches/route.js`)
- Batch API → Assignments: counts assignments (evidence: `src/app/api/batches/route.js`)
- Batch API → Join requests: counts requests (evidence: `src/app/api/batches/route.js`)
- Assignment API → Token and access: checks access (evidence: `src/app/api/assignments/route.js`)
- Assignment API → Batch records: finds enrolled batches (evidence: `src/app/api/assignments/route.js`)
- Assignment API → Assignments: creates assignments (evidence: `src/app/api/assignments/route.js`)
- Assignment API → Submissions: counts completions (evidence: `src/app/api/assignments/route.js`)
- Assignment API → User records: loads students (evidence: `src/app/api/assignments/[id]/route.js`)
- Student API → Token and access: checks access (evidence: `src/app/api/student/sync/route.js`)
- Student API → Progress synchronizer: starts sync (evidence: `src/app/api/student/sync/route.js`)
- Student API → LeetCode adapter: checks handles (evidence: `src/app/api/student/verify-handle/route.js`)
- Student API → GeeksforGeeks adapter: checks handles (evidence: `src/app/api/student/verify-handle/route.js`)
- Student records API → User records: reads student (evidence: `src/app/api/students/[id]/route.js`)
- Progress synchronizer → MongoDB connection: connects database (evidence: `src/lib/platforms/sync.js`)
- Progress synchronizer → User records: loads and updates (evidence: `src/lib/platforms/sync.js`)
- Progress synchronizer → Batch records: finds enrollments (evidence: `src/lib/platforms/sync.js`)
- Progress synchronizer → Assignments: loads questions (evidence: `src/lib/platforms/sync.js`)
- Progress synchronizer → Submissions: records progress (evidence: `src/lib/platforms/sync.js`)
- Progress synchronizer → LeetCode adapter: fetches activity (evidence: `src/lib/platforms/sync.js`)
- Progress synchronizer → GeeksforGeeks adapter: fetches activity (evidence: `src/lib/platforms/sync.js`)
- LeetCode adapter → Coding platforms: fetches profile data (evidence: `README.md`)
- GeeksforGeeks adapter → Coding platforms: fetches profile data (evidence: `README.md`)
- Sample domain data → User records: seeds records (evidence: `src/lib/seedData.js`)
- Sample domain data → Batch records: seeds records (evidence: `src/lib/seedData.js`)
- Sample domain data → Join requests: seeds records (evidence: `src/lib/seedData.js`)
- Sample domain data → Assignments: seeds records (evidence: `src/lib/seedData.js`)
- Sample domain data → Submissions: seeds records (evidence: `src/lib/seedData.js`)
