# dharshan-gangadhar/student-help-desk architecture

> Architecture diagram of the GitHub repository dharshan-gangadhar/student-help-desk, 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/dharshan-gangadhar/student-help-desk
- Repository: https://github.com/dharshan-gangadhar/student-help-desk

## Overview

Student Helpdesk is a RAG-powered university policy assistant. Administrators upload PDF/TXT knowledge through the frontend; the backend extracts and chunks it, then embeds the chunks into an in-memory vector store. Students submit questions through the same interface; the backend retrieves similar chunks and asks Gemini to generate a grounded response. Source excerpts show the routes, security middleware, and RAG implementation; the frontend upload/chat requests and README document the user-facing capabilities.

Main entry points: [`backend/server.js`](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/server.js) (API Server), [`frontend/app/page.tsx`](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/frontend/app/page.tsx) (Upload and Chat UI), [`backend/routes/upload.js`](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/upload.js) (Upload Route), [`backend/services/ragService.js`](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.js) (Chunk Embedding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Student Interface"]
  node_ui["Upload and Chat UI<br/>[page.tsx]"]
end

subgraph group_api["Backend API"]
  node_server["API Server<br/>[server.js]"]
  node_rate["Rate Limiting<br/>[server.js]"]
end

subgraph group_ingestion["Knowledge Ingestion"]
  node_upload["Upload Route<br/>[upload.js]"]
  node_extract["File Extraction and Chunking<br/>[upload.js]"]
  node_rag_ingest["Chunk Embedding<br/>[ragService.js]"]
end

subgraph group_rag["RAG Answering"]
  node_chat["Chat Route<br/>[chat.js]"]
  node_rag_query["Question Retrieval and Answering<br/>[ragService.js]"]
  node_store[("In-Memory Vector Store<br/>[ragService.js]")]
end

node_admin(("Administrator"))
node_student(("Student"))
node_gemini["Google Gemini API"]

node_admin -->|"uploads document"| node_ui
node_student -->|"asks question"| node_ui
node_ui -->|"sends API requests"| node_server
node_server -->|"limits requests"| node_rate
node_server -->|"dispatches upload"| node_upload
node_server -->|"dispatches chat"| node_chat
node_upload -->|"extracts and chunks"| node_extract
node_upload -->|"stores chunks"| node_rag_ingest
node_rag_ingest -->|"creates embeddings"| node_gemini
node_rag_ingest -->|"writes vectors"| node_store
node_chat -->|"queries helpdesk"| node_rag_query
node_rag_query -->|"embeds and generates"| node_gemini
node_rag_query -->|"searches vectors"| node_store
node_chat -->|"returns answer"| node_server
node_server -->|"returns API response"| node_ui

click node_ui "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/frontend/app/page.tsx"
click node_server "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/server.js"
click node_rate "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/server.js"
click node_upload "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/upload.js"
click node_extract "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/upload.js"
click node_chat "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/chat.js"
click node_rag_ingest "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.js"
click node_rag_query "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.js"
click node_store "https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.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_ui toneBlue
class node_server,node_rate toneAmber
class node_upload,node_extract,node_rag_ingest,node_gemini toneMint
class node_chat,node_rag_query,node_store toneRose
class node_admin,node_student toneIndigo
```

## Components

### Student Interface

- [Upload and Chat UI](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/frontend/app/page.tsx): `frontend/app/page.tsx`

### Backend API

- [API Server](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/server.js): `backend/server.js`
- [Rate Limiting](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/server.js): `backend/server.js`

### Knowledge Ingestion

- [Upload Route](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/upload.js): `backend/routes/upload.js`
- [File Extraction and Chunking](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/upload.js): `backend/routes/upload.js`
- [Chunk Embedding](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.js): `backend/services/ragService.js`

### RAG Answering

- [Chat Route](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/routes/chat.js): `backend/routes/chat.js`
- [Question Retrieval and Answering](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.js): `backend/services/ragService.js`
- [In-Memory Vector Store](https://github.com/dharshan-gangadhar/student-help-desk/blob/main/backend/services/ragService.js): `backend/services/ragService.js`

### Other components

- **Administrator**
- **Student**
- **Google Gemini API**

## Connections

- Administrator → Upload and Chat UI: uploads document
- Student → Upload and Chat UI: asks question
- Upload and Chat UI → API Server: sends API requests
- API Server → Rate Limiting: limits requests
- API Server → Upload Route: dispatches upload
- API Server → Chat Route: dispatches chat
- Upload Route → File Extraction and Chunking: extracts and chunks
- Upload Route → Chunk Embedding: stores chunks
- Chunk Embedding → Google Gemini API: creates embeddings
- Chunk Embedding → In-Memory Vector Store: writes vectors
- Chat Route → Question Retrieval and Answering: queries helpdesk
- Question Retrieval and Answering → Google Gemini API: embeds and generates
- Question Retrieval and Answering → In-Memory Vector Store: searches vectors
- Chat Route → API Server: returns answer
- API Server → Upload and Chat UI: returns API response
