# rituraj2003/leetrev architecture

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

- Interactive diagram: https://gitdiagram.com/rituraj2003/leetrev
- Repository: https://github.com/rituraj2003/leetrev

## Overview

LeetRev imports accepted LeetCode solutions from a user-selected GitHub repository, stores problem and solution records, and schedules reviews. Users browse due reviews, rate them to advance or complete the schedule, and can inspect solutions and AI analysis. The graph includes the documented dashboard/report and AI capabilities; their detailed implementation was not sampled, so those links are limited to the documented service boundaries.

Main entry points: [`src/index.ts`](https://github.com/rituraj2003/leetrev/blob/main/src/index.ts) (Express API), [`frontend/src/services/api.ts`](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/services/api.ts) (API client), [`frontend/src/App.tsx`](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/App.tsx) (App routing), [`src/db.ts`](https://github.com/rituraj2003/leetrev/blob/main/src/db.ts) (Prisma database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web app"]
  node_app["App routing<br/>[App.tsx]"]
  node_setup["Repository setup"]
  node_reviews["Review queue<br/>[Reviews.tsx]"]
  node_reviewcard["Review card<br/>[ReviewCard.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_workspace["Problem workspace"]
  node_clientapi["API client<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_server["Express API<br/>[index.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_authmw["JWT middleware<br/>[auth.ts]"]
  node_githubroute["GitHub routes<br/>[github.ts]"]
  node_reportroute["Report routes<br/>[report.ts]"]
  node_reviewroute["Review routes<br/>[review.ts]"]
  node_problemroute["Problem routes<br/>[problem.ts]"]
  node_solutionroute["Solution routes<br/>[solution.ts]"]
end

subgraph group_learning["Import and revision"]
  node_ingestion["GitHub ingestion<br/>[ingestion.ts]"]
  node_revision["Revision scheduling<br/>[revision.ts]"]
  node_reportsvc["Report service<br/>[report.ts]"]
  node_aireview["AI review<br/>[aiReview.ts]"]
  node_prompt["Prompt builder<br/>[prompt.ts]"]
end

subgraph group_data["Persistence and AI"]
  node_db[("Prisma database<br/>[db.ts]")]
end

node_user(("Learner"))
node_github["GitHub API"]
node_gemini["Gemini API"]

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_setup
node_app -->|"routes to"| node_reviews
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_workspace
node_setup -->|"requests"| node_clientapi
node_reviews -->|"requests"| node_clientapi
node_reviewcard -->|"rates review"| node_clientapi
node_reviews -->|"renders"| node_reviewcard
node_dashboard -->|"requests"| node_clientapi
node_workspace -->|"requests"| node_clientapi
node_clientapi -->|"HTTP requests"| node_server
node_server -->|"dispatches"| node_auth
node_server -->|"protects API"| node_authmw
node_server -->|"dispatches"| node_githubroute
node_server -->|"dispatches"| node_reportroute
node_server -->|"dispatches"| node_reviewroute
node_server -->|"dispatches"| node_problemroute
node_server -->|"dispatches"| node_solutionroute
node_githubroute -->|"syncs via"| node_ingestion
node_ingestion -->|"fetches commits"| node_github
node_ingestion -->|"upserts records"| node_db
node_reviewroute -->|"calls"| node_revision
node_revision -->|"reads and updates"| node_db
node_reportroute -->|"serves reports"| node_reportsvc
node_reportsvc -->|"reads data"| node_db
node_problemroute -->|"reads problems"| node_db
node_solutionroute -->|"requests analysis"| node_aireview
node_aireview -->|"loads and saves"| node_db
node_aireview -->|"builds prompt"| node_prompt
node_aireview -->|"generates analysis"| node_gemini

click node_app "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/App.tsx"
click node_setup "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/RepositorySetup.tsx"
click node_reviews "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/Reviews.tsx"
click node_reviewcard "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/components/ReviewCard.tsx"
click node_dashboard "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/Dashboard.tsx"
click node_workspace "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/ProblemWorkspace.tsx"
click node_clientapi "https://github.com/rituraj2003/leetrev/blob/main/frontend/src/services/api.ts"
click node_server "https://github.com/rituraj2003/leetrev/blob/main/src/index.ts"
click node_auth "https://github.com/rituraj2003/leetrev/blob/main/src/routes/auth.ts"
click node_authmw "https://github.com/rituraj2003/leetrev/blob/main/src/middleware/auth.ts"
click node_githubroute "https://github.com/rituraj2003/leetrev/blob/main/src/routes/github.ts"
click node_reportroute "https://github.com/rituraj2003/leetrev/blob/main/src/routes/report.ts"
click node_reviewroute "https://github.com/rituraj2003/leetrev/blob/main/src/routes/review.ts"
click node_problemroute "https://github.com/rituraj2003/leetrev/blob/main/src/routes/problem.ts"
click node_solutionroute "https://github.com/rituraj2003/leetrev/blob/main/src/routes/solution.ts"
click node_ingestion "https://github.com/rituraj2003/leetrev/blob/main/src/services/ingestion.ts"
click node_revision "https://github.com/rituraj2003/leetrev/blob/main/src/services/revision.ts"
click node_reportsvc "https://github.com/rituraj2003/leetrev/blob/main/src/services/report.ts"
click node_aireview "https://github.com/rituraj2003/leetrev/blob/main/src/services/aiReview.ts"
click node_prompt "https://github.com/rituraj2003/leetrev/blob/main/src/services/prompt.ts"
click node_db "https://github.com/rituraj2003/leetrev/blob/main/src/db.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,node_setup,node_reviews,node_reviewcard,node_dashboard,node_workspace,node_clientapi toneBlue
class node_server,node_auth,node_authmw,node_githubroute,node_reportroute,node_reviewroute,node_problemroute,node_solutionroute toneAmber
class node_ingestion,node_revision,node_reportsvc,node_aireview,node_prompt,node_github,node_gemini toneMint
class node_db toneRose
class node_user toneIndigo
```

## Components

### Web app

- [App routing](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Repository setup](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/RepositorySetup.tsx): `frontend/src/pages/RepositorySetup.tsx`
- [Review queue](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/Reviews.tsx): `frontend/src/pages/Reviews.tsx`
- [Review card](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/components/ReviewCard.tsx): `frontend/src/components/ReviewCard.tsx`
- [Dashboard](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Problem workspace](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/pages/ProblemWorkspace.tsx): `frontend/src/pages/ProblemWorkspace.tsx`
- [API client](https://github.com/rituraj2003/leetrev/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### API and identity

- [Express API](https://github.com/rituraj2003/leetrev/blob/main/src/index.ts): `src/index.ts`
- [Authentication](https://github.com/rituraj2003/leetrev/blob/main/src/routes/auth.ts): `src/routes/auth.ts`
- [JWT middleware](https://github.com/rituraj2003/leetrev/blob/main/src/middleware/auth.ts): `src/middleware/auth.ts`
- [GitHub routes](https://github.com/rituraj2003/leetrev/blob/main/src/routes/github.ts): `src/routes/github.ts`
- [Report routes](https://github.com/rituraj2003/leetrev/blob/main/src/routes/report.ts): `src/routes/report.ts`
- [Review routes](https://github.com/rituraj2003/leetrev/blob/main/src/routes/review.ts): `src/routes/review.ts`
- [Problem routes](https://github.com/rituraj2003/leetrev/blob/main/src/routes/problem.ts): `src/routes/problem.ts`
- [Solution routes](https://github.com/rituraj2003/leetrev/blob/main/src/routes/solution.ts): `src/routes/solution.ts`

### Import and revision

- [GitHub ingestion](https://github.com/rituraj2003/leetrev/blob/main/src/services/ingestion.ts): `src/services/ingestion.ts`
- [Revision scheduling](https://github.com/rituraj2003/leetrev/blob/main/src/services/revision.ts): `src/services/revision.ts`
- [Report service](https://github.com/rituraj2003/leetrev/blob/main/src/services/report.ts): `src/services/report.ts`
- [AI review](https://github.com/rituraj2003/leetrev/blob/main/src/services/aiReview.ts): `src/services/aiReview.ts`
- [Prompt builder](https://github.com/rituraj2003/leetrev/blob/main/src/services/prompt.ts): `src/services/prompt.ts`

### Persistence and AI

- [Prisma database](https://github.com/rituraj2003/leetrev/blob/main/src/db.ts): `src/db.ts`

### Other components

- **Learner**
- **GitHub API**
- **Gemini API**

## Connections

- Learner → App routing: uses
- App routing → Repository setup: routes to
- App routing → Review queue: routes to
- App routing → Dashboard: routes to
- App routing → Problem workspace: routes to
- Repository setup → API client: requests
- Review queue → API client: requests
- Review card → API client: rates review
- Review queue → Review card: renders
- Dashboard → API client: requests
- Problem workspace → API client: requests
- API client → Express API: HTTP requests
- Express API → Authentication: dispatches
- Express API → JWT middleware: protects API
- Express API → GitHub routes: dispatches
- Express API → Report routes: dispatches
- Express API → Review routes: dispatches
- Express API → Problem routes: dispatches
- Express API → Solution routes: dispatches
- GitHub routes → GitHub ingestion: syncs via
- GitHub ingestion → GitHub API: fetches commits
- GitHub ingestion → Prisma database: upserts records
- Review routes → Revision scheduling: calls
- Revision scheduling → Prisma database: reads and updates
- Report routes → Report service: serves reports
- Report service → Prisma database: reads data
- Problem routes → Prisma database: reads problems
- Solution routes → AI review: requests analysis
- AI review → Prisma database: loads and saves
- AI review → Prompt builder: builds prompt
- AI review → Gemini API: generates analysis
