How naga-poornima/rag-based-college-chatbot works
CampusAI is a college-document question-answering platform. Students authenticate, ask general or document-restricted questions, and receive answers grounded in retrieved college documents with citations; admins manage documents and review usage analytics. The frontend provides chat, document, account, and admin views, while FastAPI routes requests through controllers and services. Document ingestion, retrieval, answer generation, authentication, persistence, and vector indexing are distinct backend responsibilities. The README documents multilingual support and cloud/offline alternatives; unsampled internals and some frontend-to-endpoint wiring are not inferred.
Main entry points: App.jsx App routing · vector_service.py Vector service · rag_service.py RAG orchestration · api.js API client
Components 34
Student and admin UI
- App routing
client/src/App.jsx - Auth state
client/src/store/authStore.js - Auth client
client/src/services/authService.js - API client
client/src/services/api.js - Chat experience
client/src/pages/Chat.jsx - Chat state
client/src/store/chatStore.js - Document views
client/src/pages/Documents.jsx - Admin dashboard
client/src/pages/Admin.jsx - Language support
client/src/i18n/index.js - Hindi translations
client/src/i18n/hi.js - Telugu translations
client/src/i18n/te.js
API and identity
- FastAPI entry
server/app/main.py - Auth routes
server/app/routes/auth.py - Auth controller
server/app/controllers/auth_controller.py - Auth service
server/app/services/auth_service.py - Auth middleware
server/app/middleware/auth.py - User schema
server/app/models/user.py - Token security
server/app/utils/security.py - RAG routes
server/app/routes/rag.py - RAG controller
server/app/controllers/rag_controller.py
Knowledge and RAG
- RAG orchestration
server/app/services/rag_service.py - Document service
server/app/services/document_service.py - Document ingestion
server/app/rag/document_loader.py - Embedding generation
server/app/rag/embedding_generator.py - Semantic retrieval
server/app/rag/retriever.py - Grounded answers
server/app/rag/answer_generator.py - AI provider service
server/app/services/ai_service.py
Admin and telemetry
- Analytics service
server/app/services/analytics_service.py - Admin controller
server/app/controllers/admin_controller.py
Storage and integrations
- Vector service
server/app/services/vector_service.py - Database manager
server/app/config/database.py - Runtime settings
server/app/config/settings.py
Other components
- Student
- Administrator
Connections 39
- Student → App routing: uses portal
README.md - Administrator → App routing: uses portal
README.md - App routing → Auth state: guards routes
client/src/App.jsx - App routing → Chat experience: routes to
client/src/App.jsx - App routing → Document views: routes to
client/src/App.jsx - App routing → Admin dashboard: routes to
client/src/App.jsx - Auth state → Auth client: calls
client/src/store/authStore.js - Auth client → API client: sends requests
client/src/services/authService.js - Chat experience → Chat state: uses state
- Chat experience → API client: sends questions
- Document views → API client: requests documents
- Admin dashboard → API client: requests analytics
- Language support → Hindi translations: loads translations
client/src/i18n/index.js - Language support → Telugu translations: loads translations
client/src/i18n/index.js - FastAPI entry → Auth routes: registers routes
server/app/main.py - FastAPI entry → RAG routes: registers routes
server/app/main.py - Auth routes → Auth controller: dispatches
server/app/routes/auth.py - Auth controller → Auth service: calls
server/app/controllers/auth_controller.py - Auth service → Database manager: reads and writes
server/app/services/auth_service.py - Auth service → Token security: creates tokens
server/app/services/auth_service.py - Auth controller → User schema: uses schemas
server/app/controllers/auth_controller.py - Auth middleware → Token security: validates tokens
server/app/middleware/auth.py - RAG routes → Auth middleware: protects endpoints
server/app/routes/rag.py - RAG routes → RAG controller: dispatches
server/app/routes/rag.py - RAG controller → RAG orchestration: calls
server/app/controllers/rag_controller.py - RAG orchestration → Grounded answers: requests answers
server/app/services/rag_service.py - RAG orchestration → Semantic retrieval: retrieves chunks
server/app/services/rag_service.py - RAG orchestration → Vector service: checks vector status
server/app/services/rag_service.py - Semantic retrieval → Embedding generation: embeds queries
server/app/rag/retriever.py - Semantic retrieval → Vector service: searches vectors
server/app/rag/retriever.py - Grounded answers → AI provider service: generates response
- Document service → Document ingestion: processes files
server/app/services/document_service.py - Document ingestion → Embedding generation: creates embeddings
README.md - Document ingestion → Vector service: indexes chunks
README.md - Document service → Vector service: cleans vectors
server/app/services/document_service.py - Database manager → Runtime settings: reads configuration
server/app/config/database.py - Vector service → Runtime settings: reads configuration
server/app/services/vector_service.py - Admin controller → Analytics service: requests analytics
- Admin dashboard → Admin controller: views telemetry