# anantsinghtanwar-ux/doubtless architecture

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

- Interactive diagram: https://gitdiagram.com/anantsinghtanwar-ux/doubtless
- Repository: https://github.com/anantsinghtanwar-ux/doubtless

## Overview

Doubtless is an AI-assisted education platform whose central workflow routes a student’s doubt toward an explanation, practice, or human teaching. Its broader product includes document-based study, solver and speaking assessments, teacher onboarding and matching, and live sessions. The graph combines documented capabilities with source-visible calls; some page-to-API wiring and unsampled feature internals are not verified, so those links are omitted or marked unverified.

Main entry points: [`src/lib/aiProvider.ts`](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/aiProvider.ts) (AI Provider), [`src/lib/firestore.ts`](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/firestore.ts) (Firestore), [`src/app/api/doubt/route/route.ts`](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/doubt/route/route.ts) (Doubt Router), [`src/app/api/vault/upload/route.ts`](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/vault/upload/route.ts) (PDF Ingestion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_learning["Learning and AI"]
  node_doubt_ui["Ask Doubt<br/>[page.tsx]"]
  node_doubt_router["Doubt Router<br/>[route.ts]"]
  node_explanation["AI Explanation<br/>[route.ts]"]
  node_practice["Adaptive Practice<br/>[route.ts]"]
  node_solver["Step Solver<br/>[route.ts]"]
  node_voice["Voice Explain<br/>[route.ts]"]
  node_speech["Speech Capture"]
  node_viva["AI Viva<br/>[route.ts]"]
  node_ai["AI Provider<br/>[aiProvider.ts]"]
end

subgraph group_study["Study Materials"]
  node_vault_ui["Study Vault<br/>[page.tsx]"]
  node_ingestion["PDF Ingestion<br/>[route.ts]"]
  node_chunking["PDF Chunking<br/>[chunker.ts]"]
  node_retrieval["Vault Retrieval<br/>[embeddings.ts]"]
  node_cowork["CoWork Study<br/>[route.ts]"]
end

subgraph group_teaching["Human Teaching"]
  node_onboarding["Teacher Onboarding<br/>[page.tsx]"]
  node_application["Teacher Application<br/>[route.ts]"]
  node_verification["Teacher Screening"]
  node_matching["Teacher Matching<br/>[route.ts]"]
  node_session["Live Session<br/>[VideoCall.tsx]"]
  node_chat["Session Chat<br/>[SessionChat.tsx]"]
end

subgraph group_platform["Identity and Data"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_firebase["Firebase Client<br/>[firebase.ts]"]
  node_store[("Firestore<br/>[firestore.ts]")]
  node_media["Media Store<br/>[mediaStore.ts]"]
end

node_student(("Student"))
node_teacher(("Teacher"))
node_firebase_service["Firebase Services"]

node_student -->|"asks doubt"| node_doubt_ui
node_doubt_ui -.->|"routes doubt"| node_doubt_router
node_doubt_router -->|"generates routing"| node_ai
node_doubt_router -->|"formats context"| node_retrieval
node_doubt_router -.->|"routes to"| node_explanation
node_doubt_router -.->|"routes to"| node_practice
node_doubt_router -.->|"routes to"| node_matching
node_explanation -->|"generates answer"| node_ai
node_practice -->|"generates set"| node_ai
node_solver -->|"evaluates steps"| node_ai
node_voice -->|"evaluates speech"| node_ai
node_speech -.->|"submits transcript"| node_voice
node_viva -->|"generates questions"| node_ai
node_student -->|"uploads materials"| node_vault_ui
node_vault_ui -.->|"submits PDF"| node_ingestion
node_ingestion -->|"chunks pages"| node_chunking
node_ingestion -->|"embeds chunks"| node_ai
node_ingestion -->|"saves documents"| node_store
node_ingestion -->|"stores PDF"| node_media
node_retrieval -->|"embeds query"| node_ai
node_retrieval -->|"loads chunks"| node_store
node_cowork -->|"loads past papers"| node_retrieval
node_cowork -->|"builds overview"| node_ai
node_teacher -->|"applies"| node_onboarding
node_onboarding -.->|"submits application"| node_application
node_application -->|"runs screening"| node_verification
node_application -->|"checks uploaded files"| node_media
node_application -->|"saves teacher records"| node_store
node_student -->|"seeks teacher"| node_matching
node_matching -->|"reads teachers"| node_store
node_teacher -->|"joins tutoring"| node_session
node_student -->|"joins tutoring"| node_session
node_session -.->|"offers chat"| node_chat
node_chat -->|"reads session messages"| node_store
node_auth -->|"uses auth"| node_firebase
node_auth -->|"loads profiles"| node_store
node_firebase -->|"initializes"| node_firebase_service
node_store -->|"persists records"| node_firebase_service
node_session -->|"signals video calls"| node_firebase_service

click node_doubt_ui "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/ask/page.tsx"
click node_doubt_router "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/doubt/route/route.ts"
click node_explanation "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/doubt/explain/route.ts"
click node_practice "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/practice/generate/route.ts"
click node_solver "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/solve/evaluate/route.ts"
click node_voice "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/voice/evaluate/route.ts"
click node_speech "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/hooks/useSpeechRecognition.ts"
click node_viva "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/viva/question/route.ts"
click node_ai "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/aiProvider.ts"
click node_vault_ui "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/vault/page.tsx"
click node_ingestion "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/vault/upload/route.ts"
click node_chunking "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/chunker.ts"
click node_retrieval "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/embeddings.ts"
click node_cowork "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/cowork/overview/route.ts"
click node_onboarding "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/teacher/onboarding/page.tsx"
click node_application "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/teacher/application/route.ts"
click node_verification "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/teacherVerification.ts"
click node_matching "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/teachers/match/route.ts"
click node_session "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/components/session/VideoCall.tsx"
click node_chat "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/components/teachers/SessionChat.tsx"
click node_auth "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/contexts/AuthContext.tsx"
click node_firebase "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/firebase.ts"
click node_store "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/firestore.ts"
click node_media "https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/mediaStore.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_doubt_ui,node_doubt_router,node_explanation,node_practice,node_solver,node_voice,node_speech,node_viva,node_ai toneBlue
class node_vault_ui,node_ingestion,node_chunking,node_retrieval,node_cowork toneAmber
class node_onboarding,node_application,node_verification,node_matching,node_session,node_chat toneMint
class node_auth,node_firebase,node_store,node_media toneRose
class node_student,node_teacher,node_firebase_service toneIndigo
```

## Components

### Learning and AI

- [Ask Doubt](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/ask/page.tsx): `src/app/ask/page.tsx`
- [Doubt Router](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/doubt/route/route.ts): `src/app/api/doubt/route/route.ts`
- [AI Explanation](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/doubt/explain/route.ts): `src/app/api/doubt/explain/route.ts`
- [Adaptive Practice](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/practice/generate/route.ts): `src/app/api/practice/generate/route.ts`
- [Step Solver](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/solve/evaluate/route.ts): `src/app/api/solve/evaluate/route.ts`
- [Voice Explain](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/voice/evaluate/route.ts): `src/app/api/voice/evaluate/route.ts`
- [Speech Capture](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/hooks/useSpeechRecognition.ts): `src/hooks/useSpeechRecognition.ts`
- [AI Viva](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/viva/question/route.ts): `src/app/api/viva/question/route.ts`
- [AI Provider](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/aiProvider.ts): `src/lib/aiProvider.ts`

### Study Materials

- [Study Vault](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/vault/page.tsx): `src/app/vault/page.tsx`
- [PDF Ingestion](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/vault/upload/route.ts): `src/app/api/vault/upload/route.ts`
- [PDF Chunking](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/chunker.ts): `src/lib/chunker.ts`
- [Vault Retrieval](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/embeddings.ts): `src/lib/embeddings.ts`
- [CoWork Study](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/cowork/overview/route.ts): `src/app/api/cowork/overview/route.ts`

### Human Teaching

- [Teacher Onboarding](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/teacher/onboarding/page.tsx): `src/app/teacher/onboarding/page.tsx`
- [Teacher Application](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/teacher/application/route.ts): `src/app/api/teacher/application/route.ts`
- [Teacher Screening](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/teacherVerification.ts): `src/lib/teacherVerification.ts`
- [Teacher Matching](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/app/api/teachers/match/route.ts): `src/app/api/teachers/match/route.ts`
- [Live Session](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/components/session/VideoCall.tsx): `src/components/session/VideoCall.tsx`
- [Session Chat](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/components/teachers/SessionChat.tsx): `src/components/teachers/SessionChat.tsx`

### Identity and Data

- [Authentication](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Firebase Client](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Firestore](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/firestore.ts): `src/lib/firestore.ts`
- [Media Store](https://github.com/anantsinghtanwar-ux/doubtless/blob/main/src/lib/mediaStore.ts): `src/lib/mediaStore.ts`

### Other components

- **Student**
- **Teacher**
- **Firebase Services**

## Connections

- Student → Ask Doubt: asks doubt (evidence: `README.md`)
- Ask Doubt → Doubt Router: routes doubt
- Doubt Router → AI Provider: generates routing (evidence: `src/app/api/doubt/route/route.ts`)
- Doubt Router → Vault Retrieval: formats context (evidence: `src/app/api/doubt/route/route.ts`)
- Doubt Router → AI Explanation: routes to
- Doubt Router → Adaptive Practice: routes to
- Doubt Router → Teacher Matching: routes to
- AI Explanation → AI Provider: generates answer (evidence: `src/app/api/doubt/explain/route.ts`)
- Adaptive Practice → AI Provider: generates set (evidence: `src/app/api/practice/generate/route.ts`)
- Step Solver → AI Provider: evaluates steps (evidence: `src/app/api/solve/evaluate/route.ts`)
- Voice Explain → AI Provider: evaluates speech (evidence: `src/app/api/voice/evaluate/route.ts`)
- Speech Capture → Voice Explain: submits transcript
- AI Viva → AI Provider: generates questions (evidence: `src/app/api/viva/question/route.ts`)
- Student → Study Vault: uploads materials (evidence: `README.md`)
- Study Vault → PDF Ingestion: submits PDF
- PDF Ingestion → PDF Chunking: chunks pages (evidence: `src/app/api/vault/upload/route.ts`)
- PDF Ingestion → AI Provider: embeds chunks (evidence: `src/app/api/vault/upload/route.ts`)
- PDF Ingestion → Firestore: saves documents (evidence: `src/app/api/vault/upload/route.ts`)
- PDF Ingestion → Media Store: stores PDF (evidence: `src/app/api/vault/upload/route.ts`)
- Vault Retrieval → AI Provider: embeds query (evidence: `src/lib/embeddings.ts`)
- Vault Retrieval → Firestore: loads chunks (evidence: `src/lib/embeddings.ts`)
- CoWork Study → Vault Retrieval: loads past papers (evidence: `src/app/api/cowork/overview/route.ts`)
- CoWork Study → AI Provider: builds overview (evidence: `src/app/api/cowork/overview/route.ts`)
- Teacher → Teacher Onboarding: applies (evidence: `README.md`)
- Teacher Onboarding → Teacher Application: submits application
- Teacher Application → Teacher Screening: runs screening (evidence: `src/app/api/teacher/application/route.ts`)
- Teacher Application → Media Store: checks uploaded files (evidence: `src/app/api/teacher/application/route.ts`)
- Teacher Application → Firestore: saves teacher records (evidence: `src/app/api/teacher/application/route.ts`)
- Student → Teacher Matching: seeks teacher (evidence: `README.md`)
- Teacher Matching → Firestore: reads teachers (evidence: `src/app/api/teachers/match/route.ts`)
- Teacher → Live Session: joins tutoring (evidence: `README.md`)
- Student → Live Session: joins tutoring (evidence: `README.md`)
- Live Session → Session Chat: offers chat
- Session Chat → Firestore: reads session messages (evidence: `src/components/teachers/SessionChat.tsx`)
- Authentication → Firebase Client: uses auth (evidence: `src/contexts/AuthContext.tsx`)
- Authentication → Firestore: loads profiles (evidence: `src/contexts/AuthContext.tsx`)
- Firebase Client → Firebase Services: initializes (evidence: `src/lib/firebase.ts`)
- Firestore → Firebase Services: persists records (evidence: `src/lib/firestore.ts`)
- Live Session → Firebase Services: signals video calls (evidence: `README.md`)
