# aravind007e/edureach-chatbot architecture

> Architecture diagram of the GitHub repository aravind007e/edureach-chatbot, 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/aravind007e/edureach-chatbot
- Repository: https://github.com/aravind007e/edureach-chatbot

## Overview

EduReach is a college information and counseling product: visitors explore institutional content, ask grounded academic questions through chat or voice, and can create accounts. The main answer flow runs from the chat UI through the API/controller into intent routing, vector retrieval, grounded generation, and citation-bearing responses. The README also documents offline knowledge ingestion, authentication, and Vapi voice/call support. Source excerpts establish key calls; some route-to-controller and voice wiring is documented rather than sampled, so those links are marked dashed.

Main entry points: [`server/src/services/rag.service.ts`](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/rag.service.ts) (RAG orchestrator), [`server/src/app.ts`](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/app.ts) (Express application), [`src/App.tsx`](https://github.com/aravind007e/edureach-chatbot/blob/main/src/App.tsx) (App and routes), [`server/src/routes/auth.routes.ts`](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/auth.routes.ts) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Student experience"]
  node_app["App and routes<br/>[App.tsx]"]
  node_college["College content<br/>[content.ts]"]
  node_chat_ui["Chat drawer<br/>[ChatDrawer.tsx]"]
  node_chat_state["Chat state<br/>[ChatContext.tsx]"]
  node_chat_client["Chat client<br/>[chat.service.ts]"]
  node_auth_ui["Login and signup<br/>[LoginPage.tsx]"]
  node_auth_state["Auth state<br/>[AuthContext.tsx]"]
  node_auth_client["Auth client<br/>[auth.service.ts]"]
  node_api["HTTP API<br/>[api.ts]"]
end

subgraph group_api["API and identity"]
  node_express["Express application<br/>[app.ts]"]
  node_chat_routes["Chat routes<br/>[chat.routes.ts]"]
  node_chat_controller["Chat controller<br/>[chat.controller.ts]"]
  node_auth_routes["Auth routes<br/>[auth.routes.ts]"]
  node_auth_controller["Auth controller<br/>[auth.controller.ts]"]
  node_auth_middleware["JWT middleware<br/>[auth.middleware.ts]"]
  node_user_store[("User records<br/>[user.model.ts]")]
  node_jwt["JWT utilities<br/>[jwt.util.ts]"]
end

subgraph group_knowledge["Knowledge answering"]
  node_router["Intent router<br/>[router.service.ts]"]
  node_rag["RAG orchestrator<br/>[rag.service.ts]"]
  node_documents["Chunking and ingestion"]
  node_embeddings["Embedding service"]
  node_retrieval["Vector retrieval"]
  node_knowledge_store[("Knowledge chunks")]
  node_ollama["Ollama models"]
end

subgraph group_voice["Voice counseling"]
  node_voice_ui["Voice interface<br/>[CallPopup.tsx]"]
  node_voice_client["Vapi client<br/>[vapi.service.ts]"]
  node_voice_routes["Voice routes<br/>[vapi.routes.ts]"]
  node_voice_controller["Voice controller<br/>[vapi.controller.ts]"]
  node_voice_service["Vapi service<br/>[vapi.service.ts]"]
end

node_student(("Student"))
node_vapi["Vapi service"]

node_student -.->|"opens"| node_app
node_app -.->|"presents"| node_college
node_app -->|"mounts"| node_chat_ui
node_student -.->|"asks"| node_chat_ui
node_chat_ui -->|"uses"| node_chat_state
node_chat_state -->|"sends"| node_chat_client
node_chat_client -->|"posts"| node_api
node_api -.->|"requests"| node_express
node_express -->|"mounts"| node_chat_routes
node_chat_routes -.->|"dispatches"| node_chat_controller
node_chat_controller -.->|"queries"| node_rag
node_rag -->|"classifies"| node_router
node_rag -->|"retrieves"| node_retrieval
node_retrieval -->|"embeds query"| node_embeddings
node_retrieval -->|"loads chunks"| node_knowledge_store
node_rag -->|"chunks source"| node_documents
node_rag -->|"embeds chunks"| node_embeddings
node_rag -->|"stores chunks"| node_knowledge_store
node_embeddings -->|"requests vectors"| node_ollama
node_rag -->|"generates answer"| node_ollama
node_rag -.->|"returns answer"| node_chat_controller
node_student -.->|"registers"| node_auth_ui
node_auth_ui -->|"authenticates"| node_auth_client
node_auth_state -->|"loads profile"| node_auth_client
node_auth_client -->|"requests"| node_api
node_express -->|"mounts"| node_auth_routes
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_controller -->|"reads writes"| node_user_store
node_auth_controller -->|"issues token"| node_jwt
node_auth_routes -->|"protects routes"| node_auth_middleware
node_auth_middleware -->|"verifies token"| node_jwt
node_student -.->|"starts voice"| node_voice_ui
node_voice_ui -.->|"uses"| node_voice_client
node_voice_client -.->|"connects"| node_vapi
node_voice_ui -.->|"requests call"| node_voice_routes
node_express -.->|"mounts"| node_voice_routes
node_voice_routes -->|"dispatches"| node_voice_controller
node_voice_controller -->|"delegates"| node_voice_service
node_voice_service -.->|"integrates"| node_vapi

click node_app "https://github.com/aravind007e/edureach-chatbot/blob/main/src/App.tsx"
click node_college "https://github.com/aravind007e/edureach-chatbot/blob/main/src/data/content.ts"
click node_chat_ui "https://github.com/aravind007e/edureach-chatbot/blob/main/src/components/ChatDrawer.tsx"
click node_chat_state "https://github.com/aravind007e/edureach-chatbot/blob/main/src/context/ChatContext.tsx"
click node_chat_client "https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/chat.service.ts"
click node_auth_ui "https://github.com/aravind007e/edureach-chatbot/blob/main/src/pages/LoginPage.tsx"
click node_auth_state "https://github.com/aravind007e/edureach-chatbot/blob/main/src/context/AuthContext.tsx"
click node_auth_client "https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/auth.service.ts"
click node_api "https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/api.ts"
click node_express "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/app.ts"
click node_chat_routes "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/chat.routes.ts"
click node_chat_controller "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/controllers/chat.controller.ts"
click node_auth_routes "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/auth.routes.ts"
click node_auth_controller "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/controllers/auth.controller.ts"
click node_auth_middleware "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/middleware/auth.middleware.ts"
click node_user_store "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/models/user.model.ts"
click node_jwt "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/utils/jwt.util.ts"
click node_router "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/router.service.ts"
click node_rag "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/rag.service.ts"
click node_documents "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/document.service.ts"
click node_embeddings "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/embedding.service.ts"
click node_retrieval "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/retrieval.service.ts"
click node_knowledge_store "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/models/knowladge-doc.model.ts"
click node_voice_ui "https://github.com/aravind007e/edureach-chatbot/blob/main/src/components/CallPopup.tsx"
click node_voice_client "https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/vapi.service.ts"
click node_voice_routes "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/vapi.routes.ts"
click node_voice_controller "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/controllers/vapi.controller.ts"
click node_voice_service "https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/vapi.service.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_college,node_chat_ui,node_chat_state,node_chat_client,node_auth_ui,node_auth_state,node_auth_client,node_api toneBlue
class node_express,node_chat_routes,node_chat_controller,node_auth_routes,node_auth_controller,node_auth_middleware,node_user_store,node_jwt toneAmber
class node_router,node_rag,node_documents,node_embeddings,node_retrieval,node_knowledge_store,node_ollama,node_vapi toneMint
class node_voice_ui,node_voice_client,node_voice_routes,node_voice_controller,node_voice_service toneRose
class node_student toneIndigo
```

## Components

### Student experience

- [App and routes](https://github.com/aravind007e/edureach-chatbot/blob/main/src/App.tsx): `src/App.tsx`
- [College content](https://github.com/aravind007e/edureach-chatbot/blob/main/src/data/content.ts): `src/data/content.ts`
- [Chat drawer](https://github.com/aravind007e/edureach-chatbot/blob/main/src/components/ChatDrawer.tsx): `src/components/ChatDrawer.tsx`
- [Chat state](https://github.com/aravind007e/edureach-chatbot/blob/main/src/context/ChatContext.tsx): `src/context/ChatContext.tsx`
- [Chat client](https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/chat.service.ts): `src/services/chat.service.ts`
- [Login and signup](https://github.com/aravind007e/edureach-chatbot/blob/main/src/pages/LoginPage.tsx): `src/pages/LoginPage.tsx`
- [Auth state](https://github.com/aravind007e/edureach-chatbot/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Auth client](https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/auth.service.ts): `src/services/auth.service.ts`
- [HTTP API](https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/api.ts): `src/services/api.ts`

### API and identity

- [Express application](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/app.ts): `server/src/app.ts`
- [Chat routes](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/chat.routes.ts): `server/src/routes/chat.routes.ts`
- [Chat controller](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/controllers/chat.controller.ts): `server/src/controllers/chat.controller.ts`
- [Auth routes](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/auth.routes.ts): `server/src/routes/auth.routes.ts`
- [Auth controller](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/controllers/auth.controller.ts): `server/src/controllers/auth.controller.ts`
- [JWT middleware](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/middleware/auth.middleware.ts): `server/src/middleware/auth.middleware.ts`
- [User records](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/models/user.model.ts): `server/src/models/user.model.ts`
- [JWT utilities](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/utils/jwt.util.ts): `server/src/utils/jwt.util.ts`

### Knowledge answering

- [Intent router](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/router.service.ts): `server/src/services/router.service.ts`
- [RAG orchestrator](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/rag.service.ts): `server/src/services/rag.service.ts`
- [Chunking and ingestion](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/document.service.ts): `server/src/services/document.service.ts`
- [Embedding service](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/embedding.service.ts): `server/src/services/embedding.service.ts`
- [Vector retrieval](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/retrieval.service.ts): `server/src/services/retrieval.service.ts`
- [Knowledge chunks](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/models/knowladge-doc.model.ts): `server/src/models/knowladge-doc.model.ts`
- **Ollama models**

### Voice counseling

- [Voice interface](https://github.com/aravind007e/edureach-chatbot/blob/main/src/components/CallPopup.tsx): `src/components/CallPopup.tsx`
- [Vapi client](https://github.com/aravind007e/edureach-chatbot/blob/main/src/services/vapi.service.ts): `src/services/vapi.service.ts`
- [Voice routes](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/routes/vapi.routes.ts): `server/src/routes/vapi.routes.ts`
- [Voice controller](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/controllers/vapi.controller.ts): `server/src/controllers/vapi.controller.ts`
- [Vapi service](https://github.com/aravind007e/edureach-chatbot/blob/main/server/src/services/vapi.service.ts): `server/src/services/vapi.service.ts`

### Other components

- **Student**
- **Vapi service**

## Connections

- Student → App and routes: opens
- App and routes → College content: presents
- App and routes → Chat drawer: mounts (evidence: `src/App.tsx`)
- Student → Chat drawer: asks
- Chat drawer → Chat state: uses (evidence: `src/components/ChatDrawer.tsx`)
- Chat state → Chat client: sends (evidence: `src/context/ChatContext.tsx`)
- Chat client → HTTP API: posts (evidence: `src/services/chat.service.ts`)
- HTTP API → Express application: requests (evidence: `README.md`)
- Express application → Chat routes: mounts (evidence: `server/src/app.ts`)
- Chat routes → Chat controller: dispatches
- Chat controller → RAG orchestrator: queries
- RAG orchestrator → Intent router: classifies (evidence: `server/src/services/rag.service.ts`)
- RAG orchestrator → Vector retrieval: retrieves (evidence: `server/src/services/rag.service.ts`)
- Vector retrieval → Embedding service: embeds query (evidence: `server/src/services/retrieval.service.ts`)
- Vector retrieval → Knowledge chunks: loads chunks (evidence: `server/src/services/retrieval.service.ts`)
- RAG orchestrator → Chunking and ingestion: chunks source (evidence: `server/src/services/rag.service.ts`)
- RAG orchestrator → Embedding service: embeds chunks (evidence: `server/src/services/rag.service.ts`)
- RAG orchestrator → Knowledge chunks: stores chunks (evidence: `server/src/services/rag.service.ts`)
- Embedding service → Ollama models: requests vectors (evidence: `server/src/services/embedding.service.ts`)
- RAG orchestrator → Ollama models: generates answer (evidence: `server/src/services/rag.service.ts`)
- RAG orchestrator → Chat controller: returns answer
- Student → Login and signup: registers
- Login and signup → Auth client: authenticates (evidence: `src/pages/LoginPage.tsx`)
- Auth state → Auth client: loads profile (evidence: `src/context/AuthContext.tsx`)
- Auth client → HTTP API: requests (evidence: `src/services/auth.service.ts`)
- Express application → Auth routes: mounts (evidence: `server/src/app.ts`)
- Auth routes → Auth controller: dispatches (evidence: `server/src/routes/auth.routes.ts`)
- Auth controller → User records: reads writes (evidence: `server/src/controllers/auth.controller.ts`)
- Auth controller → JWT utilities: issues token (evidence: `server/src/controllers/auth.controller.ts`)
- Auth routes → JWT middleware: protects routes (evidence: `server/src/routes/auth.routes.ts`)
- JWT middleware → JWT utilities: verifies token (evidence: `server/src/middleware/auth.middleware.ts`)
- Student → Voice interface: starts voice
- Voice interface → Vapi client: uses
- Vapi client → Vapi service: connects (evidence: `README.md`)
- Voice interface → Voice routes: requests call (evidence: `README.md`)
- Express application → Voice routes: mounts
- Voice routes → Voice controller: dispatches (evidence: `server/src/routes/vapi.routes.ts`)
- Voice controller → Vapi service: delegates (evidence: `server/src/controllers/vapi.controller.ts`)
- Vapi service → Vapi service: integrates
