# mesit-rathnayake/my_academia architecture

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

- Interactive diagram: https://gitdiagram.com/mesit-rathnayake/my_academia
- Repository: https://github.com/mesit-rathnayake/my_academia

## Overview

My Academia is a student-management application with a web UI, an Express/Prisma backend, and a separate Python RAG service. Students use the UI to manage modules and academic work; for the tutor workflow, they upload course PDFs, create chat sessions, and ask questions grounded in indexed documents. The README also describes module/progress tracking, scheduling, exams, GPA, and notifications. Arrows reflect shown routes, imports, and documented service calls; unsampled frontend-to-backend wiring is left unverified.

Main entry points: [`frontend/src/App.js`](https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/App.js) (UI routes), [`backend/routes/moduleRoutes.js`](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/routes/moduleRoutes.js) (Module routes), [`ai-service/app/services/vector_store_service.py`](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/vector_store_service.py) (Vector indexing), [`backend/server.js`](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/server.js) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web experience"]
  node_app["UI routes<br/>[App.js]"]
  node_home["Modules dashboard<br/>[Home.jsx]"]
  node_chatui["Tutor chat UI<br/>[Chat.jsx]"]
  node_scheduleui["Schedule UI<br/>[Schedule.jsx]"]
  node_performanceui["Performance UI<br/>[Performance.jsx]"]
end

subgraph group_backend["Student management"]
  node_authroutes["Authentication routes<br/>[authRoutes.js]"]
  node_authcontroller["Authentication<br/>[authController.js]"]
  node_authmw["JWT verification<br/>[auth.js]"]
  node_modroutes["Module routes<br/>[moduleRoutes.js]"]
  node_modulecontroller["Module management"]
  node_documentcontroller["Document handling"]
  node_chatcontroller["Chat sessions<br/>[chatController.js]"]
  node_academicroutes["Academic routes"]
  node_academiccontrollers["Academic operations"]
  node_server["Express API<br/>[server.js]"]
end

subgraph group_ai["AI tutor"]
  node_aiapi["RAG API<br/>[main.py]"]
  node_docroute["PDF indexing<br/>[documents.py]"]
  node_searchroute["Semantic search<br/>[search.py]"]
  node_chatroute["RAG chat endpoint<br/>[chat.py]"]
  node_pdfservice["PDF extraction<br/>[pdf_service.py]"]
  node_chatservice["Answer generation<br/>[chat_service.py]"]
  node_embedding["Text embeddings"]
  node_vector["Vector indexing"]
end

subgraph group_storage["Persistence"]
  node_db[("Relational database")]
  node_chromadb[("Chroma vector store")]
end

node_student(("Student"))

node_student -->|"uses"| node_app
node_app -->|"routes"| node_home
node_app -->|"routes"| node_chatui
node_app -->|"routes"| node_scheduleui
node_app -->|"routes"| node_performanceui
node_student -.->|"manages coursework"| node_home
node_student -.->|"asks questions"| node_chatui
node_student -.->|"plans schedule"| node_scheduleui
node_student -.->|"tracks progress"| node_performanceui
node_server -->|"mounts"| node_authroutes
node_server -->|"mounts"| node_modroutes
node_server -->|"mounts"| node_academicroutes
node_authroutes -->|"dispatches"| node_authcontroller
node_authroutes -->|"protects"| node_authmw
node_modroutes -->|"protects"| node_authmw
node_modroutes -->|"dispatches"| node_modulecontroller
node_modroutes -->|"dispatches"| node_documentcontroller
node_modroutes -->|"dispatches"| node_chatcontroller
node_academicroutes -.->|"dispatches"| node_academiccontrollers
node_authcontroller -->|"reads/writes"| node_db
node_modulecontroller -->|"reads/writes"| node_db
node_documentcontroller -->|"records documents"| node_db
node_chatcontroller -->|"stores sessions"| node_db
node_documentcontroller -->|"indexes PDF"| node_docroute
node_chatcontroller -->|"proxies questions"| node_chatroute
node_aiapi -->|"registers routes"| node_docroute
node_aiapi -->|"registers routes"| node_searchroute
node_aiapi -->|"registers routes"| node_chatroute
node_docroute -->|"extracts text"| node_pdfservice
node_docroute -->|"indexes chunks"| node_vector
node_searchroute -->|"retrieves chunks"| node_vector
node_chatroute -->|"generates answer"| node_chatservice
node_chatservice -->|"retrieves context"| node_vector
node_vector -->|"embeds text"| node_embedding
node_vector -.->|"reads/writes"| node_chromadb
node_student -.->|"uses academic services"| node_server

click node_app "https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/App.js"
click node_home "https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Home.jsx"
click node_chatui "https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Chat.jsx"
click node_scheduleui "https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Schedule.jsx"
click node_performanceui "https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Performance.jsx"
click node_authroutes "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/routes/authRoutes.js"
click node_authcontroller "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/authController.js"
click node_authmw "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/middlewares/auth.js"
click node_modroutes "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/routes/moduleRoutes.js"
click node_modulecontroller "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/moduleController.js"
click node_documentcontroller "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/documentController.js"
click node_chatcontroller "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/chatController.js"
click node_academicroutes "https://github.com/mesit-rathnayake/my_academia/tree/main/backend/routes"
click node_academiccontrollers "https://github.com/mesit-rathnayake/my_academia/tree/main/backend/controllers"
click node_server "https://github.com/mesit-rathnayake/my_academia/blob/main/backend/server.js"
click node_aiapi "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/main.py"
click node_docroute "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/routes/documents.py"
click node_searchroute "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/routes/search.py"
click node_chatroute "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/routes/chat.py"
click node_pdfservice "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/pdf_service.py"
click node_chatservice "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/chat_service.py"
click node_embedding "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/embedding_service.py"
click node_vector "https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/vector_store_service.py"

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_home,node_chatui,node_scheduleui,node_performanceui toneBlue
class node_authroutes,node_authcontroller,node_authmw,node_modroutes,node_modulecontroller,node_documentcontroller,node_chatcontroller,node_academicroutes,node_academiccontrollers,node_server toneAmber
class node_aiapi,node_docroute,node_searchroute,node_chatroute,node_pdfservice,node_chatservice,node_embedding,node_vector toneMint
class node_db,node_chromadb toneRose
class node_student toneIndigo
```

## Components

### Web experience

- [UI routes](https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Modules dashboard](https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Home.jsx): `frontend/src/pages/Home.jsx`
- [Tutor chat UI](https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Schedule UI](https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Schedule.jsx): `frontend/src/pages/Schedule.jsx`
- [Performance UI](https://github.com/mesit-rathnayake/my_academia/blob/main/frontend/src/pages/Performance.jsx): `frontend/src/pages/Performance.jsx`

### Student management

- [Authentication routes](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`
- [Authentication](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT verification](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/middlewares/auth.js): `backend/middlewares/auth.js`
- [Module routes](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/routes/moduleRoutes.js): `backend/routes/moduleRoutes.js`
- [Module management](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/moduleController.js): `backend/controllers/moduleController.js`
- [Document handling](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/documentController.js): `backend/controllers/documentController.js`
- [Chat sessions](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/controllers/chatController.js): `backend/controllers/chatController.js`
- [Academic routes](https://github.com/mesit-rathnayake/my_academia/tree/main/backend/routes): `backend/routes`
- [Academic operations](https://github.com/mesit-rathnayake/my_academia/tree/main/backend/controllers): `backend/controllers`
- [Express API](https://github.com/mesit-rathnayake/my_academia/blob/main/backend/server.js): `backend/server.js`

### AI tutor

- [RAG API](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/main.py): `ai-service/app/main.py`
- [PDF indexing](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/routes/documents.py): `ai-service/app/routes/documents.py`
- [Semantic search](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/routes/search.py): `ai-service/app/routes/search.py`
- [RAG chat endpoint](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/routes/chat.py): `ai-service/app/routes/chat.py`
- [PDF extraction](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/pdf_service.py): `ai-service/app/services/pdf_service.py`
- [Answer generation](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/chat_service.py): `ai-service/app/services/chat_service.py`
- [Text embeddings](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/embedding_service.py): `ai-service/app/services/embedding_service.py`
- [Vector indexing](https://github.com/mesit-rathnayake/my_academia/blob/main/ai-service/app/services/vector_store_service.py): `ai-service/app/services/vector_store_service.py`

### Persistence

- **Relational database**
- **Chroma vector store**

### Other components

- **Student**

## Connections

- Student → UI routes: uses (evidence: `frontend/src/App.js`)
- UI routes → Modules dashboard: routes (evidence: `frontend/src/App.js`)
- UI routes → Tutor chat UI: routes (evidence: `frontend/src/App.js`)
- UI routes → Schedule UI: routes (evidence: `frontend/src/App.js`)
- UI routes → Performance UI: routes (evidence: `frontend/src/App.js`)
- Student → Modules dashboard: manages coursework (evidence: `README.md`)
- Student → Tutor chat UI: asks questions (evidence: `README.md`)
- Student → Schedule UI: plans schedule (evidence: `README.md`)
- Student → Performance UI: tracks progress (evidence: `README.md`)
- Express API → Authentication routes: mounts (evidence: `backend/server.js`)
- Express API → Module routes: mounts (evidence: `backend/server.js`)
- Express API → Academic routes: mounts (evidence: `backend/server.js`)
- Authentication routes → Authentication: dispatches (evidence: `backend/routes/authRoutes.js`)
- Authentication routes → JWT verification: protects (evidence: `backend/routes/authRoutes.js`)
- Module routes → JWT verification: protects (evidence: `backend/routes/moduleRoutes.js`)
- Module routes → Module management: dispatches (evidence: `backend/routes/moduleRoutes.js`)
- Module routes → Document handling: dispatches (evidence: `backend/routes/moduleRoutes.js`)
- Module routes → Chat sessions: dispatches (evidence: `backend/routes/moduleRoutes.js`)
- Academic routes → Academic operations: dispatches (evidence: `backend/routes/moduleRoutes.js`)
- Authentication → Relational database: reads/writes (evidence: `backend/controllers/authController.js`)
- Module management → Relational database: reads/writes (evidence: `backend/controllers/moduleController.js`)
- Document handling → Relational database: records documents (evidence: `backend/controllers/documentController.js`)
- Chat sessions → Relational database: stores sessions (evidence: `backend/controllers/chatController.js`)
- Document handling → PDF indexing: indexes PDF (evidence: `backend/controllers/documentController.js`)
- Chat sessions → RAG chat endpoint: proxies questions (evidence: `backend/controllers/chatController.js`)
- RAG API → PDF indexing: registers routes (evidence: `ai-service/app/main.py`)
- RAG API → Semantic search: registers routes (evidence: `ai-service/app/main.py`)
- RAG API → RAG chat endpoint: registers routes (evidence: `ai-service/app/main.py`)
- PDF indexing → PDF extraction: extracts text (evidence: `ai-service/app/routes/documents.py`)
- PDF indexing → Vector indexing: indexes chunks (evidence: `ai-service/app/routes/documents.py`)
- Semantic search → Vector indexing: retrieves chunks (evidence: `ai-service/app/routes/search.py`)
- RAG chat endpoint → Answer generation: generates answer (evidence: `ai-service/app/routes/chat.py`)
- Answer generation → Vector indexing: retrieves context (evidence: `ai-service/app/services/chat_service.py`)
- Vector indexing → Text embeddings: embeds text (evidence: `ai-service/app/services/vector_store_service.py`)
- Vector indexing → Chroma vector store: reads/writes (evidence: `README.md`)
- Student → Express API: uses academic services (evidence: `README.md`)
