# narayana276/overthinking architecture

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

- Interactive diagram: https://gitdiagram.com/narayana276/overthinking
- Repository: https://github.com/narayana276/overthinking

## Overview

Overthink is a study and revision application: learners authenticate, organize topics and notes (including uploaded documents), then use scheduled review and question attempts; an AI chat and retrieval-based document/content indexing provide study assistance. The graph captures the client routes, server domain APIs, and background review/RAG processing. Many modules are named only in the source index or tree, and no README is present, so uncertain wiring is omitted rather than inferred.

Main entry points: [`client/src/App.tsx`](https://github.com/narayana276/overthinking/blob/master/client/src/App.tsx) (App routing), [`server/src/configs/prisma.ts`](https://github.com/narayana276/overthinking/blob/master/server/src/configs/prisma.ts) (Application database), [`client/src/modules/notes/Notes.tsx`](https://github.com/narayana276/overthinking/blob/master/client/src/modules/notes/Notes.tsx) (Notes workspace), [`server/src/bull/rag/rag.worker.ts`](https://github.com/narayana276/overthinking/blob/master/server/src/bull/rag/rag.worker.ts) (RAG indexing worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Study client"]
  node_app["App routing<br/>[App.tsx]"]
  node_landing["Landing and login<br/>[LandingPage.tsx]"]
  node_topic_ui["Topic workspace<br/>[Topic.tsx]"]
  node_notes_ui["Notes workspace<br/>[Notes.tsx]"]
  node_chat_ui["AI chat panel<br/>[ChatbotModal.tsx]"]
  node_revision_ui["Revision workflow<br/>[RevisionPage.tsx]"]
  node_attempt_ui["Revision attempt"]
  node_local_notes[("Local note cache<br/>[db.helper.ts]")]
end

subgraph group_api["Application API"]
  node_auth_api["Authentication API<br/>[auth.controler.ts]"]
  node_topic_api["Topic API<br/>[topic.controler.ts]"]
  node_notes_api["Notes API<br/>[notes.controler.ts]"]
  node_documents_api["Document API"]
  node_chat_api["Chatbot API"]
  node_review_api["Review API"]
  node_history_api["Question history"]
  node_attempt_api["Attempt API"]
end

subgraph group_jobs["Background study jobs"]
  node_rag_worker["RAG indexing worker<br/>[rag.worker.ts]"]
  node_review_worker["Review scheduler worker<br/>[review.worker.ts]"]
  node_question_worker["Question generation worker"]
end

subgraph group_infra["Persistence and integrations"]
  node_prisma[("Application database<br/>[prisma.ts]")]
  node_redis["Redis queues<br/>[redis.ts]"]
  node_vector[("Vector store<br/>[supabaseVector.ts]")]
  node_ocr["OCR and text extraction<br/>[ocr.ts]"]
  node_cloudinary["File storage<br/>[cloudinary.ts]"]
end

node_learner(("Learner"))
node_llm{{"Language model"}}

node_learner -->|"visits"| node_landing
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_topic_ui
node_app -->|"routes to"| node_notes_ui
node_app -->|"routes to"| node_revision_ui
node_app -->|"routes to"| node_attempt_ui
node_landing -.->|"authenticates via"| node_auth_api
node_topic_ui -.->|"requests topics"| node_topic_api
node_notes_ui -->|"requests notes"| node_notes_api
node_notes_ui -->|"caches notes"| node_local_notes
node_notes_ui -.->|"manages files"| node_documents_api
node_notes_ui -->|"opens chat"| node_chat_ui
node_chat_ui -.->|"sends prompts"| node_chat_api
node_revision_ui -.->|"loads reviews"| node_review_api
node_attempt_ui -.->|"submits answers"| node_attempt_api
node_attempt_ui -.->|"loads questions"| node_history_api
node_notes_api -.->|"reads and writes"| node_prisma
node_topic_api -.->|"reads and writes"| node_prisma
node_auth_api -.->|"reads and writes"| node_prisma
node_documents_api -.->|"reads and writes"| node_prisma
node_review_worker -->|"updates reviews"| node_prisma
node_review_worker -->|"schedules questions"| node_question_worker
node_review_worker -->|"evaluates answers"| node_llm
node_rag_worker -->|"extracts text"| node_ocr
node_rag_worker -->|"indexes content"| node_vector
node_rag_worker -->|"loads and marks records"| node_prisma
node_rag_worker -->|"connects worker"| node_redis
node_review_worker -->|"connects worker"| node_redis
node_documents_api -.->|"stores uploads"| node_cloudinary

click node_app "https://github.com/narayana276/overthinking/blob/master/client/src/App.tsx"
click node_landing "https://github.com/narayana276/overthinking/blob/master/client/src/pages/LandingPage.tsx"
click node_topic_ui "https://github.com/narayana276/overthinking/blob/master/client/src/modules/topic/Topic.tsx"
click node_notes_ui "https://github.com/narayana276/overthinking/blob/master/client/src/modules/notes/Notes.tsx"
click node_chat_ui "https://github.com/narayana276/overthinking/blob/master/client/src/modules/notes/components/ChatbotModal.tsx"
click node_revision_ui "https://github.com/narayana276/overthinking/blob/master/client/src/modules/revision/RevisionPage.tsx"
click node_attempt_ui "https://github.com/narayana276/overthinking/blob/master/client/src/modules/revision/Revisionattempt.tsx"
click node_local_notes "https://github.com/narayana276/overthinking/blob/master/client/src/indexdb/db.helper.ts"
click node_auth_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/auth/auth.controler.ts"
click node_topic_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/topic/topic.controler.ts"
click node_notes_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/notes/notes.controler.ts"
click node_documents_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/document/document.controler.ts"
click node_chat_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/chatbot/chatbot.controler.ts"
click node_review_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/review/review.controler.ts"
click node_history_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/questionHistory/question.controller.ts"
click node_attempt_api "https://github.com/narayana276/overthinking/blob/master/server/src/modules/revisionAttempt/revisionAttempt.controler.ts"
click node_rag_worker "https://github.com/narayana276/overthinking/blob/master/server/src/bull/rag/rag.worker.ts"
click node_review_worker "https://github.com/narayana276/overthinking/blob/master/server/src/bull/review/review.worker.ts"
click node_question_worker "https://github.com/narayana276/overthinking/blob/master/server/src/bull/questions/question.bull.worker.ts"
click node_prisma "https://github.com/narayana276/overthinking/blob/master/server/src/configs/prisma.ts"
click node_redis "https://github.com/narayana276/overthinking/blob/master/server/src/configs/redis.ts"
click node_vector "https://github.com/narayana276/overthinking/blob/master/server/src/configs/supabaseVector.ts"
click node_ocr "https://github.com/narayana276/overthinking/blob/master/server/src/configs/ocr.ts"
click node_cloudinary "https://github.com/narayana276/overthinking/blob/master/server/src/configs/cloudinary.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_landing,node_topic_ui,node_notes_ui,node_chat_ui,node_revision_ui,node_attempt_ui,node_local_notes toneBlue
class node_auth_api,node_topic_api,node_notes_api,node_documents_api,node_chat_api,node_review_api,node_history_api,node_attempt_api toneAmber
class node_rag_worker,node_review_worker,node_question_worker toneMint
class node_prisma,node_redis,node_vector,node_ocr,node_cloudinary toneRose
class node_learner,node_llm toneIndigo
```

## Components

### Study client

- [App routing](https://github.com/narayana276/overthinking/blob/master/client/src/App.tsx): `client/src/App.tsx`
- [Landing and login](https://github.com/narayana276/overthinking/blob/master/client/src/pages/LandingPage.tsx): `client/src/pages/LandingPage.tsx`
- [Topic workspace](https://github.com/narayana276/overthinking/blob/master/client/src/modules/topic/Topic.tsx): `client/src/modules/topic/Topic.tsx`
- [Notes workspace](https://github.com/narayana276/overthinking/blob/master/client/src/modules/notes/Notes.tsx): `client/src/modules/notes/Notes.tsx`
- [AI chat panel](https://github.com/narayana276/overthinking/blob/master/client/src/modules/notes/components/ChatbotModal.tsx): `client/src/modules/notes/components/ChatbotModal.tsx`
- [Revision workflow](https://github.com/narayana276/overthinking/blob/master/client/src/modules/revision/RevisionPage.tsx): `client/src/modules/revision/RevisionPage.tsx`
- [Revision attempt](https://github.com/narayana276/overthinking/blob/master/client/src/modules/revision/Revisionattempt.tsx): `client/src/modules/revision/Revisionattempt.tsx`
- [Local note cache](https://github.com/narayana276/overthinking/blob/master/client/src/indexdb/db.helper.ts): `client/src/indexdb/db.helper.ts`

### Application API

- [Authentication API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/auth/auth.controler.ts): `server/src/modules/auth/auth.controler.ts`
- [Topic API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/topic/topic.controler.ts): `server/src/modules/topic/topic.controler.ts`
- [Notes API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/notes/notes.controler.ts): `server/src/modules/notes/notes.controler.ts`
- [Document API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/document/document.controler.ts): `server/src/modules/document/document.controler.ts`
- [Chatbot API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/chatbot/chatbot.controler.ts): `server/src/modules/chatbot/chatbot.controler.ts`
- [Review API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/review/review.controler.ts): `server/src/modules/review/review.controler.ts`
- [Question history](https://github.com/narayana276/overthinking/blob/master/server/src/modules/questionHistory/question.controller.ts): `server/src/modules/questionHistory/question.controller.ts`
- [Attempt API](https://github.com/narayana276/overthinking/blob/master/server/src/modules/revisionAttempt/revisionAttempt.controler.ts): `server/src/modules/revisionAttempt/revisionAttempt.controler.ts`

### Background study jobs

- [RAG indexing worker](https://github.com/narayana276/overthinking/blob/master/server/src/bull/rag/rag.worker.ts): `server/src/bull/rag/rag.worker.ts`
- [Review scheduler worker](https://github.com/narayana276/overthinking/blob/master/server/src/bull/review/review.worker.ts): `server/src/bull/review/review.worker.ts`
- [Question generation worker](https://github.com/narayana276/overthinking/blob/master/server/src/bull/questions/question.bull.worker.ts): `server/src/bull/questions/question.bull.worker.ts`

### Persistence and integrations

- [Application database](https://github.com/narayana276/overthinking/blob/master/server/src/configs/prisma.ts): `server/src/configs/prisma.ts`
- [Redis queues](https://github.com/narayana276/overthinking/blob/master/server/src/configs/redis.ts): `server/src/configs/redis.ts`
- [Vector store](https://github.com/narayana276/overthinking/blob/master/server/src/configs/supabaseVector.ts): `server/src/configs/supabaseVector.ts`
- [OCR and text extraction](https://github.com/narayana276/overthinking/blob/master/server/src/configs/ocr.ts): `server/src/configs/ocr.ts`
- [File storage](https://github.com/narayana276/overthinking/blob/master/server/src/configs/cloudinary.ts): `server/src/configs/cloudinary.ts`

### Other components

- **Learner**
- **Language model**

## Connections

- Learner → Landing and login: visits
- App routing → Landing and login: routes to (evidence: `client/src/App.tsx`)
- App routing → Topic workspace: routes to (evidence: `client/src/App.tsx`)
- App routing → Notes workspace: routes to (evidence: `client/src/App.tsx`)
- App routing → Revision workflow: routes to (evidence: `client/src/App.tsx`)
- App routing → Revision attempt: routes to (evidence: `client/src/App.tsx`)
- Landing and login → Authentication API: authenticates via
- Topic workspace → Topic API: requests topics
- Notes workspace → Notes API: requests notes (evidence: `client/src/modules/notes/Notes.tsx`)
- Notes workspace → Local note cache: caches notes (evidence: `client/src/modules/notes/Notes.tsx`)
- Notes workspace → Document API: manages files
- Notes workspace → AI chat panel: opens chat (evidence: `client/src/modules/notes/Notes.tsx`)
- AI chat panel → Chatbot API: sends prompts
- Revision workflow → Review API: loads reviews
- Revision attempt → Attempt API: submits answers
- Revision attempt → Question history: loads questions
- Notes API → Application database: reads and writes
- Topic API → Application database: reads and writes
- Authentication API → Application database: reads and writes
- Document API → Application database: reads and writes
- Review scheduler worker → Application database: updates reviews (evidence: `server/src/bull/review/review.worker.ts`)
- Review scheduler worker → Question generation worker: schedules questions (evidence: `server/src/bull/review/review.worker.ts`)
- Review scheduler worker → Language model: evaluates answers (evidence: `server/src/bull/review/review.worker.ts`)
- RAG indexing worker → OCR and text extraction: extracts text (evidence: `server/src/bull/rag/rag.worker.ts`)
- RAG indexing worker → Vector store: indexes content (evidence: `server/src/bull/rag/rag.worker.ts`)
- RAG indexing worker → Application database: loads and marks records (evidence: `server/src/bull/rag/rag.worker.ts`)
- RAG indexing worker → Redis queues: connects worker (evidence: `server/src/bull/rag/rag.worker.ts`)
- Review scheduler worker → Redis queues: connects worker (evidence: `server/src/bull/review/review.worker.ts`)
- Document API → File storage: stores uploads
