How kashishbhutia/ragpdfanalyser works
Smart Document Analyzer lets users upload PDFs, wait for processing, then ask document-specific questions and see grounded answers with page citations; chat history persists per document. The graph covers the UI/API, upload and indexing stages, retrieval and answer generation, and persistence. The README documents the major capabilities; edges are limited to relationships shown in excerpts or explicitly documented, so unsampled internals are not inferred.
Main entry points: document.controller.ts Document controller · Home.tsx Home workflow · chat.controller.ts Chat controller · rag.service.ts RAG orchestration
Components 21
Web client
- Home workflow
client/src/pages/Home.tsx - Chat interface
client/src/components/ChatInterface.tsx - Document upload
client/src/components/DocumentUpload.tsx - Document list
client/src/components/DocumentList.tsx - Message display
client/src/components/MessageBubble.tsx - API client
client/src/services/api.ts
API and orchestration
- HTTP API
server/src/app.ts - Document routes
server/src/routes/document.routes.ts - Document controller
server/src/controllers/document.controller.ts - Chat controller
server/src/controllers/chat.controller.ts - Chat routes
server/src/routes/chat.routes.ts - File upload middleware
server/src/middleware/upload.ts
PDF indexing
- PDF extraction
server/src/services/pdf.service.ts - Text chunking
server/src/services/chunking.service.ts - Embedding service
server/src/services/embedding.service.ts
Retrieval and answers
- RAG orchestration
server/src/services/rag.service.ts - Vector search store
server/src/services/vectorStore.service.ts
Persistence
- Document records
server/src/models/Document.model.ts - Chat history records
server/src/models/ChatHistory.model.ts
Other components
- User
- Google Gemini
Connections 27
- User → Home workflow: uses
README.md - Home workflow → Chat interface: renders
client/src/pages/Home.tsx - Home workflow → Document upload: renders
client/src/pages/Home.tsx - Home workflow → Document list: renders
- Chat interface → API client: submits queries
client/src/components/ChatInterface.tsx - Chat interface → Message display: renders messages
client/src/components/ChatInterface.tsx - Document upload → API client: uploads PDF
client/src/components/DocumentUpload.tsx - Home workflow → API client: loads documents and history
client/src/pages/Home.tsx - API client → HTTP API: HTTP requests
client/src/services/api.ts - HTTP API → Document routes: mounts routes
server/src/app.ts - HTTP API → Chat routes: mounts routes
server/src/app.ts - Document routes → File upload middleware: accepts files
server/src/routes/document.routes.ts - Document routes → Document controller: dispatches
server/src/routes/document.routes.ts - Chat routes → Chat controller: dispatches
server/src/routes/chat.routes.ts - Document controller → Document records: creates and updates
server/src/controllers/document.controller.ts - Document controller → PDF extraction: extracts pages
server/src/controllers/document.controller.ts - Document controller → Text chunking: chunks text
server/src/controllers/document.controller.ts - Document controller → Embedding service: embeds chunks
server/src/controllers/document.controller.ts - Document controller → Vector search store: stores vectors
server/src/controllers/document.controller.ts - Document controller → Chat history records: deletes history
server/src/controllers/document.controller.ts - Chat controller → Document records: checks readiness
server/src/controllers/chat.controller.ts - Chat controller → RAG orchestration: runs query
server/src/controllers/chat.controller.ts - Chat controller → Chat history records: saves and reads
server/src/controllers/chat.controller.ts - RAG orchestration → Embedding service: embeds query
server/src/services/rag.service.ts - RAG orchestration → Vector search store: retrieves chunks
server/src/services/rag.service.ts - RAG orchestration → Google Gemini: generates answer
server/src/services/rag.service.ts - Embedding service → Google Gemini: requests embeddings
server/src/services/embedding.service.ts