How gayitrijarajapu/documind-ai-backend works
DocuMind is a FastAPI document-understanding API for a React UI. Its main workflow accepts PDFs, extracts and chunks page text, builds a searchable vector index, and stores document metadata; users can then request grounded answers with citations, summaries, and structured fields. Separate API branches list/manage documents, expose dashboard counts, and retrieve chat history. The graph follows calls shown in sampled files and README capabilities; unsampled formatter and configuration details are represented only where supported.
Main entry points: document.py Document records · documents.py Document endpoints · main.py FastAPI app · document_processor.py PDF and indexing
Components 17
HTTP API
- FastAPI app
app/main.py - Document endpoints
app/api/documents.py - Chat endpoints
app/api/chat.py - Dashboard stats
app/api/dashboard.py - API schemas
app/schemas/document.py - UI formatting
app/services/formatters.py
Document Processing
- PDF and indexing
app/services/document_processor.py
AI Features
- Summary and extraction
app/services/document_ai.py - Question answering
app/services/qa.py - Gemini service
app/services/gemini.py
Persistence
- Document records
app/models/document.py - Database sessions
app/db/session.py - Runtime settings
app/core/config.py
Other components
- React UI
- SQL database
- FAISS index files
- Google Gemini
Connections 27
- React UI → FastAPI app: calls API
README.md - FastAPI app → Document endpoints: routes
app/main.py - FastAPI app → Chat endpoints: routes
app/main.py - FastAPI app → Dashboard stats: routes
app/main.py - Document endpoints → PDF and indexing: processes PDF
app/api/documents.py - Document endpoints → Summary and extraction: requests summary
app/api/documents.py - Document endpoints → UI formatting: formats response
app/api/documents.py - Document endpoints → Document records: reads and writes
app/api/documents.py - Chat endpoints → Question answering: answers question
app/api/chat.py - Chat endpoints → Document records: reads history
app/api/chat.py - Dashboard stats → Document records: counts records
app/api/dashboard.py - PDF and indexing → FAISS index files: writes and searches
app/services/document_processor.py - PDF and indexing → Document records: stores chunks
app/services/document_processor.py - Summary and extraction → PDF and indexing: fallback summaries
app/services/document_ai.py - Summary and extraction → Gemini service: requests AI output
app/services/document_ai.py - Summary and extraction → Document records: loads and updates
app/services/document_ai.py - Question answering → PDF and indexing: retrieves chunks
app/services/qa.py - Question answering → Gemini service: requests answer
app/services/qa.py - Question answering → Document records: stores messages
app/services/qa.py - Gemini service → Google Gemini: invokes model
app/services/gemini.py - Database sessions → Runtime settings: loads database URL
app/db/session.py - Database sessions → SQL database: connects
app/db/session.py - Document records → Database sessions: declares ORM base
app/models/document.py - FastAPI app → Database sessions: creates tables
app/main.py - Runtime settings → FAISS index files: configures index directory
app/core/config.py - Document endpoints → API schemas: validates responses
app/api/documents.py - Chat endpoints → API schemas: validates requests
app/api/chat.py