How palaksukhadeve14/doculens-ai works
Doculens AI is a web app for signing in, uploading a PDF, and asking questions grounded in its contents. The dashboard coordinates PDF upload and chat; the server extracts and chunks document text, stores embeddings in Qdrant, then retrieves relevant chunks to ground Gemini answers. Authentication uses session-backed API routes and MongoDB user records. The sampled server excerpt shows these processing stages, but some implementation details and the uploader/chat component internals were not shown; their links are included only where the dashboard or server excerpt supports them.
Main entry points: server.js API server · Dashboard.jsx Dashboard · authRoutes.js Auth routes · App.jsx Route application
Components 23
Web interface
- Route application
client/src/App.jsx - Auth context
client/src/context/AuthContext.jsx - Login page
client/src/pages/Login.jsx - Registration page
client/src/pages/Register.jsx - Dashboard
client/src/pages/Dashboard.jsx - Dashboard header
client/src/components/Header.jsx - PDF uploader
client/src/components/PdfUploader.jsx - Chat panel
client/src/components/ChatPanel.jsx
Authentication
- Auth routes
routes/authRoutes.js - Auth controller
controllers/authControllers.js - Session auth
middleware/authMiddleware.js - User records
models/User.js - MongoDB connection
config/db.js
Document question answering
- API server
server.js - PDF ingestion
server.js - Document embeddings
server.js - PDF vector store
server.js - Chunk retrieval
server.js - Answer generation
server.js
Other components
- User
- Gemini API
- Qdrant service
- MongoDB service
Connections 30
- User → Route application: opens
client/src/App.jsx - Route application → Dashboard: routes to
client/src/App.jsx - Route application → Login page: routes to
client/src/App.jsx - Route application → Registration page: routes to
client/src/App.jsx - Dashboard → Dashboard header: renders
client/src/pages/Dashboard.jsx - Dashboard → PDF uploader: renders
client/src/pages/Dashboard.jsx - Dashboard → Chat panel: renders
client/src/pages/Dashboard.jsx - Login page → Auth routes: submits login
client/src/pages/Login.jsx - Auth context → Auth routes: checks session
client/src/context/AuthContext.jsx - Dashboard → API server: uploads and asks
client/src/pages/Dashboard.jsx - API server → Auth routes: mounts routes
server.js - Auth routes → Auth controller: dispatches to
routes/authRoutes.js - Auth routes → Session auth: protects profile
routes/authRoutes.js - Auth controller → User records: reads and writes
controllers/authControllers.js - Session auth → User records: loads user
middleware/authMiddleware.js - API server → MongoDB connection: connects database
server.js - MongoDB connection → MongoDB service: connects
config/db.js - API server → MongoDB service: stores sessions
server.js - API server → PDF ingestion: handles upload
server.js - PDF ingestion → Document embeddings: embeds chunks
server.js - Document embeddings → Gemini API: requests embeddings
server.js - PDF ingestion → PDF vector store: stores vectors
server.js - PDF vector store → Qdrant service: upserts vectors
server.js - API server → Chunk retrieval: handles PDF questions
server.js - Chunk retrieval → Document embeddings: embeds query
server.js - Chunk retrieval → PDF vector store: searches chunks
server.js - PDF vector store → Qdrant service: queries vectors
server.js - Chunk retrieval → Answer generation: provides context
server.js - Answer generation → Gemini API: generates answer
server.js - API server → Gemini API: answers general asks
server.js