# karthikeya39g-af/nnrg_website architecture

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

- Interactive diagram: https://gitdiagram.com/karthikeya39g-af/nnrg_website
- Repository: https://github.com/karthikeya39g-af/nnrg_website

## Overview

NNRG Campus Navigator is a college information website with an AI question-answering chatbot and backend forms. Visitors browse institutional, academic, placement, research and facilities content; chatbot messages travel through the frontend service to the FastAPI chat service, which handles simple intents or retrieves context for an LLM response. Forms are handled by separate backend endpoints and stored in SQLite. Evidence is strongest for the sampled chat, facilities and backend wiring; unsampled page and RAG-ingestion details are represented only where documented.

Main entry points: [`backend/app/services/chat_service.py`](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/services/chat_service.py) (Chat Orchestrator), [`backend/app/api/contact.py`](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/api/contact.py) (Contact, Apply, Tour APIs), [`src/app/facilities/page.tsx`](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/facilities/page.tsx) (Facilities and Campus), [`backend/app/rag/pipeline.py`](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/pipeline.py) (RAG Generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Campus Website"]
  node_navigation["Site Navigation<br/>[Navbar.tsx]"]
  node_institution["Institution Pages<br/>[page.tsx]"]
  node_academics["Academic Content<br/>[page.tsx]"]
  node_programs["Programs and Curriculum<br/>[page.tsx]"]
  node_placements["Placements<br/>[page.tsx]"]
  node_research["Research<br/>[page.tsx]"]
  node_campus["Facilities and Campus<br/>[page.tsx]"]
  node_book["Interactive Book<br/>[Book.tsx]"]
  node_bookpages["Book Spreads<br/>[BookPages.tsx]"]
  node_bookpage["Animated Page<br/>[Page.tsx]"]
  node_legacydata["Department Directory Data<br/>[departments.ts]"]
end

subgraph group_chatui["Chat Experience"]
  node_chatui["Chat Interface<br/>[ChatContext.tsx]"]
  node_chatservice["Chat HTTP Client<br/>[chat.service.ts]"]
end

subgraph group_chatbackend["Chat Backend"]
  node_chatapi["Chat API<br/>[chat.py]"]
  node_chatlogic["Chat Orchestrator<br/>[chat_service.py]"]
  node_intent["Intent Detection<br/>[intent.py]"]
  node_memory["Conversation Memory<br/>[memory.py]"]
  node_chattypes["Chat Schemas<br/>[chat.py]"]
end

subgraph group_knowledge["Knowledge Retrieval"]
  node_ragpipeline["RAG Generation<br/>[pipeline.py]"]
  node_retriever["Document Retriever<br/>[retriever.py]"]
  node_embedder["Text Embeddings<br/>[embedder.py]"]
  node_chunker["Document Chunking<br/>[chunker.py]"]
  node_vectorstore[("Vector Store<br/>[vector_store.py]")]
end

subgraph group_operations["Forms and Storage"]
  node_formapi["Contact, Apply, Tour APIs<br/>[contact.py]"]
  node_database[("SQLite Database<br/>[database.py]")]
  node_dbmodels["Form Data Models<br/>[models.py]"]
  node_appentry["FastAPI Application<br/>[main.py]"]
end

node_visitor(("Prospective Student"))
node_ollama{{"Ollama Model"}}

node_visitor -->|"browses"| node_navigation
node_navigation -->|"navigates"| node_institution
node_visitor -->|"browses"| node_academics
node_visitor -->|"browses"| node_programs
node_visitor -->|"browses"| node_placements
node_visitor -->|"browses"| node_research
node_visitor -->|"browses"| node_campus
node_campus -->|"renders"| node_book
node_campus -->|"generates pages"| node_bookpages
node_bookpages -->|"uses"| node_bookpage
node_visitor -->|"asks questions"| node_chatui
node_chatui -->|"sends messages"| node_chatservice
node_chatservice -->|"posts messages"| node_chatapi
node_appentry -->|"registers route"| node_chatapi
node_chatapi -->|"dispatches to"| node_chatlogic
node_chatlogic -->|"detects intent"| node_intent
node_chatlogic -->|"reads and updates"| node_memory
node_chatlogic -->|"generates answers"| node_ragpipeline
node_chatlogic -->|"uses schemas"| node_chattypes
node_ragpipeline -->|"retrieves context"| node_retriever
node_retriever -->|"embeds query"| node_embedder
node_retriever -->|"searches"| node_vectorstore
node_ragpipeline -->|"requests generation"| node_ollama
node_embedder -->|"uses chunking"| node_chunker
node_visitor -->|"submits forms"| node_formapi
node_appentry -->|"registers routes"| node_formapi
node_formapi -->|"accesses database"| node_database
node_formapi -->|"uses models"| node_dbmodels

click node_navigation "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/Navbar.tsx"
click node_institution "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/about/page.tsx"
click node_academics "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/academics/page.tsx"
click node_programs "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/programs/page.tsx"
click node_placements "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/placements/page.tsx"
click node_research "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/research/page.tsx"
click node_campus "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/facilities/page.tsx"
click node_book "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/facilities/Book.tsx"
click node_bookpages "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/facilities/BookPages.tsx"
click node_bookpage "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/facilities/Page.tsx"
click node_chatui "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/contexts/ChatContext.tsx"
click node_chatservice "https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/services/chat.service.ts"
click node_chatapi "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/api/chat.py"
click node_chatlogic "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/services/chat_service.py"
click node_intent "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/ai/intent.py"
click node_memory "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/ai/memory.py"
click node_ragpipeline "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/pipeline.py"
click node_retriever "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/retriever.py"
click node_embedder "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/embedder.py"
click node_chunker "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/chunker.py"
click node_vectorstore "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/vector_store.py"
click node_formapi "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/api/contact.py"
click node_database "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/database/database.py"
click node_dbmodels "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/database/models.py"
click node_appentry "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/main.py"
click node_chattypes "https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/schemas/chat.py"
click node_legacydata "https://github.com/karthikeya39g-af/nnrg_website/blob/main/frontend/src/data/departments.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_navigation,node_institution,node_academics,node_programs,node_placements,node_research,node_campus,node_book,node_bookpages,node_bookpage,node_legacydata toneBlue
class node_chatui,node_chatservice toneAmber
class node_chatapi,node_chatlogic,node_intent,node_memory,node_chattypes toneMint
class node_ragpipeline,node_retriever,node_embedder,node_chunker,node_vectorstore toneRose
class node_formapi,node_database,node_dbmodels,node_appentry,node_visitor,node_ollama toneIndigo
```

## Components

### Campus Website

- [Site Navigation](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`
- [Institution Pages](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/about/page.tsx): `src/app/about/page.tsx`
- [Academic Content](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/academics/page.tsx): `src/app/academics/page.tsx`
- [Programs and Curriculum](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/programs/page.tsx): `src/app/programs/page.tsx`
- [Placements](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/placements/page.tsx): `src/app/placements/page.tsx`
- [Research](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/research/page.tsx): `src/app/research/page.tsx`
- [Facilities and Campus](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/app/facilities/page.tsx): `src/app/facilities/page.tsx`
- [Interactive Book](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/facilities/Book.tsx): `src/components/facilities/Book.tsx`
- [Book Spreads](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/facilities/BookPages.tsx): `src/components/facilities/BookPages.tsx`
- [Animated Page](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/components/facilities/Page.tsx): `src/components/facilities/Page.tsx`
- [Department Directory Data](https://github.com/karthikeya39g-af/nnrg_website/blob/main/frontend/src/data/departments.ts): `frontend/src/data/departments.ts`

### Chat Experience

- [Chat Interface](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/contexts/ChatContext.tsx): `src/contexts/ChatContext.tsx`
- [Chat HTTP Client](https://github.com/karthikeya39g-af/nnrg_website/blob/main/src/services/chat.service.ts): `src/services/chat.service.ts`

### Chat Backend

- [Chat API](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/api/chat.py): `backend/app/api/chat.py`
- [Chat Orchestrator](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/services/chat_service.py): `backend/app/services/chat_service.py`
- [Intent Detection](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/ai/intent.py): `backend/app/ai/intent.py`
- [Conversation Memory](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/ai/memory.py): `backend/app/ai/memory.py`
- [Chat Schemas](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/schemas/chat.py): `backend/app/schemas/chat.py`

### Knowledge Retrieval

- [RAG Generation](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/pipeline.py): `backend/app/rag/pipeline.py`
- [Document Retriever](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/retriever.py): `backend/app/rag/retriever.py`
- [Text Embeddings](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/embedder.py): `backend/app/rag/embedder.py`
- [Document Chunking](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/chunker.py): `backend/app/rag/chunker.py`
- [Vector Store](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/rag/vector_store.py): `backend/app/rag/vector_store.py`

### Forms and Storage

- [Contact, Apply, Tour APIs](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/api/contact.py): `backend/app/api/contact.py`
- [SQLite Database](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/database/database.py): `backend/app/database/database.py`
- [Form Data Models](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/database/models.py): `backend/app/database/models.py`
- [FastAPI Application](https://github.com/karthikeya39g-af/nnrg_website/blob/main/backend/app/main.py): `backend/app/main.py`

### Other components

- **Prospective Student**
- **Ollama Model**

## Connections

- Prospective Student → Site Navigation: browses (evidence: `README.md`)
- Site Navigation → Institution Pages: navigates (evidence: `src/components/Navbar.tsx`)
- Prospective Student → Academic Content: browses (evidence: `README.md`)
- Prospective Student → Programs and Curriculum: browses (evidence: `README.md`)
- Prospective Student → Placements: browses (evidence: `README.md`)
- Prospective Student → Research: browses (evidence: `README.md`)
- Prospective Student → Facilities and Campus: browses (evidence: `README.md`)
- Facilities and Campus → Interactive Book: renders (evidence: `src/app/facilities/page.tsx`)
- Facilities and Campus → Book Spreads: generates pages (evidence: `src/app/facilities/page.tsx`)
- Book Spreads → Animated Page: uses (evidence: `src/components/facilities/BookPages.tsx`)
- Prospective Student → Chat Interface: asks questions (evidence: `README.md`)
- Chat Interface → Chat HTTP Client: sends messages (evidence: `src/contexts/ChatContext.tsx`)
- Chat HTTP Client → Chat API: posts messages (evidence: `src/services/chat.service.ts`)
- FastAPI Application → Chat API: registers route (evidence: `backend/app/main.py`)
- Chat API → Chat Orchestrator: dispatches to (evidence: `backend/app/api/chat.py`)
- Chat Orchestrator → Intent Detection: detects intent (evidence: `backend/app/services/chat_service.py`)
- Chat Orchestrator → Conversation Memory: reads and updates (evidence: `backend/app/services/chat_service.py`)
- Chat Orchestrator → RAG Generation: generates answers (evidence: `backend/app/services/chat_service.py`)
- Chat Orchestrator → Chat Schemas: uses schemas (evidence: `backend/app/services/chat_service.py`)
- RAG Generation → Document Retriever: retrieves context (evidence: `backend/app/rag/pipeline.py`)
- Document Retriever → Text Embeddings: embeds query (evidence: `backend/app/rag/retriever.py`)
- Document Retriever → Vector Store: searches (evidence: `backend/app/rag/retriever.py`)
- RAG Generation → Ollama Model: requests generation (evidence: `backend/app/rag/pipeline.py`)
- Text Embeddings → Document Chunking: uses chunking (evidence: `backend/app/rag/embedder.py`)
- Prospective Student → Contact, Apply, Tour APIs: submits forms (evidence: `README.md`)
- FastAPI Application → Contact, Apply, Tour APIs: registers routes (evidence: `backend/app/main.py`)
- Contact, Apply, Tour APIs → SQLite Database: accesses database (evidence: `backend/app/api/contact.py`)
- Contact, Apply, Tour APIs → Form Data Models: uses models (evidence: `backend/app/api/contact.py`)
