# codewithnimal/nexus-edu architecture

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

- Interactive diagram: https://gitdiagram.com/codewithnimal/nexus-edu
- Repository: https://github.com/codewithnimal/nexus-edu

## Overview

NEXUS is an education-learning application with a React frontend and FastAPI backend. Its main documented workflow is course-grounded AI assistance: users interact through authenticated screens; backend generation services retrieve course context through a shared RAG pipeline, then produce structured results through a centralized LLM service. The backend also exposes authentication, course, document, summary, analysis, and YouTube capabilities. The README provides no architecture detail, and several frontend and API-route implementations were not sampled, so those connections are shown only where documented or marked unverified.

Main entry points: [`backend/app/ai/rag/pipeline.py`](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/pipeline.py) (RAG pipeline), [`backend/app/api/v1`](https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/api/v1) (API routes), [`backend/app/ai/llm/llm_service.py`](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/llm/llm_service.py) (LLM gateway), [`backend/app/services/youtube_service.py`](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/youtube_service.py) (YouTube Q&A)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_web["Authenticated web UI<br/>[_authenticated.tsx]"]
  node_webapi["Frontend API client<br/>[client.ts]"]
end

subgraph group_api["Backend API"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_routes["API routes"]
  node_auth["Authentication<br/>[auth.py]"]
end

subgraph group_generation["AI generation"]
  node_chat["Chat generation"]
  node_lecture["Lecture notes"]
  node_question["Question papers"]
  node_presentation["Presentations"]
  node_paperanalysis["Paper analysis"]
  node_summary["Summary generation"]
  node_llm["LLM gateway<br/>[llm_service.py]"]
  node_llmrouter["Model router<br/>[router.py]"]
end

subgraph group_rag["Knowledge retrieval"]
  node_ragpipeline["RAG pipeline<br/>[pipeline.py]"]
  node_loaders["Document loaders"]
  node_chunker["Chunking"]
  node_embedder["Embeddings"]
  node_retrieval["Retrievers and reranker"]
  node_vector[("Vector and lexical indexes")]
end

subgraph group_state["Persistence and integrations"]
  node_youtube["YouTube Q&amp;A<br/>[youtube_service.py]"]
  node_conversations["Conversation repository"]
  node_database[("Relational database<br/>[database.py]")]
  node_coursemodels["Domain models"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_web
node_web -.->|"requests data"| node_webapi
node_webapi -.->|"calls API"| node_backend
node_backend -->|"registers routes"| node_routes
node_backend -->|"registers"| node_auth
node_routes -.->|"dispatches"| node_chat
node_routes -.->|"dispatches"| node_lecture
node_routes -.->|"dispatches"| node_question
node_routes -.->|"dispatches"| node_presentation
node_routes -.->|"dispatches"| node_paperanalysis
node_routes -.->|"dispatches"| node_summary
node_chat -->|"retrieves context"| node_ragpipeline
node_chat -->|"generates answer"| node_llm
node_lecture -->|"retrieves context"| node_ragpipeline
node_lecture -->|"generates notes"| node_llm
node_question -->|"retrieves context"| node_ragpipeline
node_question -->|"generates paper"| node_llm
node_presentation -->|"retrieves context"| node_ragpipeline
node_presentation -->|"generates slides"| node_llm
node_paperanalysis -->|"retrieves context"| node_ragpipeline
node_paperanalysis -->|"generates analysis"| node_llm
node_summary -.->|"retrieves context"| node_ragpipeline
node_summary -.->|"generates summary"| node_llm
node_llm -->|"selects model"| node_llmrouter
node_ragpipeline -->|"loads documents"| node_loaders
node_ragpipeline -->|"chunks content"| node_chunker
node_ragpipeline -->|"creates embeddings"| node_embedder
node_ragpipeline -->|"indexes and fetches"| node_vector
node_ragpipeline -->|"retrieves and reranks"| node_retrieval
node_youtube -->|"chunks transcript"| node_chunker
node_youtube -->|"embeds transcript"| node_embedder
node_youtube -->|"stores and searches"| node_vector
node_youtube -->|"answers questions"| node_llm
node_conversations -->|"uses models"| node_coursemodels
node_conversations -.->|"reads and writes"| node_database

click node_web "https://github.com/codewithnimal/nexus-edu/blob/main/nexus-learnforge-main/src/routes/_authenticated.tsx"
click node_webapi "https://github.com/codewithnimal/nexus-edu/blob/main/nexus-learnforge-main/src/api/client.ts"
click node_backend "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/main.py"
click node_routes "https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/api/v1"
click node_auth "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/api/v1/auth.py"
click node_chat "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/chat/chat_generation_service.py"
click node_lecture "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/lecture/lecture_generation_service.py"
click node_question "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/question_paper/question_paper_generation_service.py"
click node_presentation "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/ppt/presentation_generation_service.py"
click node_paperanalysis "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/analysis/paper_analysis_service.py"
click node_summary "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/analysis/summary_generation_service.py"
click node_llm "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/llm/llm_service.py"
click node_llmrouter "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/llm/router.py"
click node_ragpipeline "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/pipeline.py"
click node_loaders "https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/ai/rag/loaders"
click node_chunker "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/chunking/recursive_chunker.py"
click node_embedder "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/embeddings/embedding_service.py"
click node_retrieval "https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/ai/rag/retrieval"
click node_vector "https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/ai/rag/indexing"
click node_youtube "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/youtube_service.py"
click node_conversations "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/repositories/conversation_repository.py"
click node_database "https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/database/database.py"
click node_coursemodels "https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/models"

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_web,node_webapi toneBlue
class node_backend,node_routes,node_auth toneAmber
class node_chat,node_lecture,node_question,node_presentation,node_paperanalysis,node_summary,node_llm,node_llmrouter toneMint
class node_ragpipeline,node_loaders,node_chunker,node_embedder,node_retrieval,node_vector toneRose
class node_youtube,node_conversations,node_database,node_coursemodels,node_learner toneIndigo
```

## Components

### Web application

- [Authenticated web UI](https://github.com/codewithnimal/nexus-edu/blob/main/nexus-learnforge-main/src/routes/_authenticated.tsx): `nexus-learnforge-main/src/routes/_authenticated.tsx`
- [Frontend API client](https://github.com/codewithnimal/nexus-edu/blob/main/nexus-learnforge-main/src/api/client.ts): `nexus-learnforge-main/src/api/client.ts`

### Backend API

- [FastAPI application](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/main.py): `backend/app/main.py`
- [API routes](https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/api/v1): `backend/app/api/v1`
- [Authentication](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/api/v1/auth.py): `backend/app/api/v1/auth.py`

### AI generation

- [Chat generation](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/chat/chat_generation_service.py): `backend/app/services/chat/chat_generation_service.py`
- [Lecture notes](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/lecture/lecture_generation_service.py): `backend/app/services/lecture/lecture_generation_service.py`
- [Question papers](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/question_paper/question_paper_generation_service.py): `backend/app/services/question_paper/question_paper_generation_service.py`
- [Presentations](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/ppt/presentation_generation_service.py): `backend/app/services/ppt/presentation_generation_service.py`
- [Paper analysis](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/analysis/paper_analysis_service.py): `backend/app/services/analysis/paper_analysis_service.py`
- [Summary generation](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/analysis/summary_generation_service.py): `backend/app/services/analysis/summary_generation_service.py`
- [LLM gateway](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/llm/llm_service.py): `backend/app/ai/llm/llm_service.py`
- [Model router](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/llm/router.py): `backend/app/ai/llm/router.py`

### Knowledge retrieval

- [RAG pipeline](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/pipeline.py): `backend/app/ai/rag/pipeline.py`
- [Document loaders](https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/ai/rag/loaders): `backend/app/ai/rag/loaders`
- [Chunking](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/chunking/recursive_chunker.py): `backend/app/ai/rag/chunking/recursive_chunker.py`
- [Embeddings](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/ai/rag/embeddings/embedding_service.py): `backend/app/ai/rag/embeddings/embedding_service.py`
- [Retrievers and reranker](https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/ai/rag/retrieval): `backend/app/ai/rag/retrieval`
- [Vector and lexical indexes](https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/ai/rag/indexing): `backend/app/ai/rag/indexing`

### Persistence and integrations

- [YouTube Q&A](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/services/youtube_service.py): `backend/app/services/youtube_service.py`
- [Conversation repository](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/repositories/conversation_repository.py): `backend/app/repositories/conversation_repository.py`
- [Relational database](https://github.com/codewithnimal/nexus-edu/blob/main/backend/app/database/database.py): `backend/app/database/database.py`
- [Domain models](https://github.com/codewithnimal/nexus-edu/tree/main/backend/app/models): `backend/app/models`

### Other components

- **Learner**

## Connections

- Learner → Authenticated web UI: uses (evidence: `nexus-learnforge-main/src/routes/_authenticated.tsx`)
- Authenticated web UI → Frontend API client: requests data
- Frontend API client → FastAPI application: calls API
- FastAPI application → API routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Authentication: registers (evidence: `backend/app/main.py`)
- API routes → Chat generation: dispatches
- API routes → Lecture notes: dispatches
- API routes → Question papers: dispatches
- API routes → Presentations: dispatches
- API routes → Paper analysis: dispatches
- API routes → Summary generation: dispatches
- Chat generation → RAG pipeline: retrieves context (evidence: `backend/app/services/chat/chat_generation_service.py`)
- Chat generation → LLM gateway: generates answer (evidence: `backend/app/services/chat/chat_generation_service.py`)
- Lecture notes → RAG pipeline: retrieves context (evidence: `backend/app/services/lecture/lecture_generation_service.py`)
- Lecture notes → LLM gateway: generates notes (evidence: `backend/app/services/lecture/lecture_generation_service.py`)
- Question papers → RAG pipeline: retrieves context (evidence: `backend/app/services/question_paper/question_paper_generation_service.py`)
- Question papers → LLM gateway: generates paper (evidence: `backend/app/services/question_paper/question_paper_generation_service.py`)
- Presentations → RAG pipeline: retrieves context (evidence: `backend/app/services/ppt/presentation_generation_service.py`)
- Presentations → LLM gateway: generates slides (evidence: `backend/app/services/ppt/presentation_generation_service.py`)
- Paper analysis → RAG pipeline: retrieves context (evidence: `backend/app/services/analysis/paper_analysis_service.py`)
- Paper analysis → LLM gateway: generates analysis (evidence: `backend/app/services/analysis/paper_analysis_service.py`)
- Summary generation → RAG pipeline: retrieves context
- Summary generation → LLM gateway: generates summary
- LLM gateway → Model router: selects model (evidence: `backend/app/ai/llm/llm_service.py`)
- RAG pipeline → Document loaders: loads documents (evidence: `backend/app/ai/rag/pipeline.py`)
- RAG pipeline → Chunking: chunks content (evidence: `backend/app/ai/rag/pipeline.py`)
- RAG pipeline → Embeddings: creates embeddings (evidence: `backend/app/ai/rag/pipeline.py`)
- RAG pipeline → Vector and lexical indexes: indexes and fetches (evidence: `backend/app/ai/rag/pipeline.py`)
- RAG pipeline → Retrievers and reranker: retrieves and reranks (evidence: `backend/app/ai/rag/pipeline.py`)
- YouTube Q&A → Chunking: chunks transcript (evidence: `backend/app/services/youtube_service.py`)
- YouTube Q&A → Embeddings: embeds transcript (evidence: `backend/app/services/youtube_service.py`)
- YouTube Q&A → Vector and lexical indexes: stores and searches (evidence: `backend/app/services/youtube_service.py`)
- YouTube Q&A → LLM gateway: answers questions (evidence: `backend/app/services/youtube_service.py`)
- Conversation repository → Domain models: uses models (evidence: `backend/app/repositories/conversation_repository.py`)
- Conversation repository → Relational database: reads and writes
