How goutampatel18/nyaybandhu works
NyayBandhu is a React legal-information site backed by a FastAPI service and a local RAG assistant. The main workflow is a user asking a legal question, the frontend sending it to the chatbot API, and the backend retrieving relevant material before generating an answer. A separate ingestion workflow loads documents, chunks them, builds the FAISS index, and records document and embedding metadata. The README describes the overall retrieval-and-generation flow; unsampled chatbot internals and frontend API wiring are not asserted as verified calls.
Main entry points: pipeline.py Ingestion orchestrator · main.py FastAPI application · App.tsx React application · documents.py Document endpoints
Components 21
Web application
- React application
frontend/src/App.tsx - Page routes
frontend/src/routes/appRoutes.tsx - Chat interface
frontend/src/components/Chatbot.tsx
Backend API
- FastAPI application
backend/app/main.py - Chat endpoint
backend/app/routes/chatbot.py - Document endpoints
backend/app/routes/documents.py - Library endpoint
backend/app/routes/library.py - Health endpoint
backend/app/routes/health.py - Document operations
backend/app/services/documents.py
Document ingestion
- Ingestion orchestrator
backend/app/rag/pipeline.py - Document loader
backend/app/rag/loader.py - Text chunker
backend/app/rag/chunker.py
Retrieval and generation
- FAISS index
backend/app/rag/vector_store.py - Embedding model
backend/app/rag/embeddings.py - Answer generation
backend/app/rag/chain.py
Persistent data
- Database initialization
backend/app/db/init_db.py - Database sessions
backend/app/db/session.py - Document records
backend/app/models/document.py - Embedding metadata
backend/app/models/embedding_metadata.py - Library records
backend/app/models/library.py
Other components
- Legal information seeker
Connections 24
- Legal information seeker → React application: uses
README.md - React application → Page routes: renders
frontend/src/App.tsx - Legal information seeker → Chat interface: asks questions
- Chat interface → Chat endpoint: sends chat request
- React application → FastAPI application: calls backend
README.md - FastAPI application → Chat endpoint: registers
backend/app/main.py - FastAPI application → Document endpoints: registers
backend/app/main.py - FastAPI application → Library endpoint: registers
backend/app/main.py - FastAPI application → Health endpoint: registers
backend/app/main.py - FastAPI application → Database initialization: initializes
backend/app/main.py - Chat endpoint → Database sessions: uses
backend/app/routes/chatbot.py - Document endpoints → Ingestion orchestrator: triggers
backend/app/routes/documents.py - Document endpoints → Document operations: delegates to
backend/app/routes/documents.py - Document operations → Ingestion orchestrator: may ingest
backend/app/services/documents.py - Ingestion orchestrator → Document loader: loads files
backend/app/rag/pipeline.py - Ingestion orchestrator → Text chunker: chunks text
backend/app/rag/pipeline.py - Ingestion orchestrator → FAISS index: builds and saves
backend/app/rag/pipeline.py - FAISS index → Embedding model: uses
backend/app/rag/vector_store.py - Ingestion orchestrator → Document records: updates records
backend/app/rag/pipeline.py - Ingestion orchestrator → Embedding metadata: writes metadata
backend/app/rag/pipeline.py - Database initialization → Database sessions: opens sessions
backend/app/db/init_db.py - Database initialization → Library records: seeds reference data
backend/app/db/init_db.py - Answer generation → FAISS index: retrieves context
README.md - Answer generation → Legal information seeker: returns answer
README.md