How sainath-777/documind-enterprise works
DocuMind is a multi-tenant document intelligence platform. Users authenticate, upload PDFs for background indexing, then ask questions and receive cited answers through either standard responses or SSE streaming. The main query handler owns retrieval, generation, logging, and quota updates; retrieval combines semantic and keyword results before reranking. The frontend also exposes document, usage, audit, and team workflows. The README documents major integrations and capabilities not fully visible in sampled source; their links are shown only where documented, while unsampled endpoint wiring is not expanded.
Main entry points: query_stream.py Streaming endpoint · query.py Query endpoint · router.py API router · ingestor.py Ingestion coordinator
Components 32
Web client
- Dashboard and chat
frontend/src/app - API client
frontend/src/lib/api-client.ts
API and identity
- FastAPI app
documind/app/main.py - API router
documind/app/api/v1/router.py - Authentication
documind/app/api/v1/endpoints/auth.py - Tenant registration
documind/app/services/auth_service.py - Document endpoints
documind/app/api/v1/endpoints/documents.py - Quota and rate limits
documind/app/services/quotas - Audit endpoints
documind/app/api/v1/endpoints/audit.py - Admin endpoints
documind/app/api/v1/endpoints/admin.py
Document ingestion
- Ingestion coordinator
documind/app/services/ingestion/ingestor.py - PDF extraction
documind/app/services/ingestion/pdf_processor.py - Text chunking
documind/app/services/ingestion/chunker.py - Embedding generation
documind/app/services/ingestion/embedder.py - Vector indexing
documind/app/services/ingestion/uploader.py
Query and retrieval
- Query endpoint
documind/app/api/v1/endpoints/query.py - Streaming endpoint
documind/app/api/v1/endpoints/query_stream.py - Semantic cache
documind/app/services/cache/semantic_cache.py - Semantic search
documind/app/services/retrieval/semantic_search.py - BM25 search
documind/app/services/retrieval/bm25_search.py - Rank fusion
documind/app/services/retrieval/hybrid_fusion.py - Chunk reranking
documind/app/services/retrieval/reranker.py - Prompt builder
documind/app/services/generation/prompt_builder.py - Answer generation
documind/app/services/generation/llm_client.py - Streaming generation
documind/app/services/generation/llm_client_stream.py - Answer judge
documind/app/services/generation/judge.py
Data and integrations
- PostgreSQL
documind/app/models/database.py - Pinecone vectors
- Gemini
- Cohere reranking
- Groq judge model
Other components
- Organization user
Connections 48
- Organization user → Dashboard and chat: uses
- Dashboard and chat → API client: requests data
- API client → FastAPI app: HTTP and SSE
- FastAPI app → API router: mounts routes
- API router → Authentication: dispatches
- API router → Document endpoints: dispatches
- API router → Query endpoint: dispatches
- API router → Streaming endpoint: dispatches
- API router → Audit endpoints: dispatches
- API router → Admin endpoints: dispatches
- Authentication → Tenant registration: registers tenant
- Tenant registration → PostgreSQL: writes tenant data
- Document endpoints → PostgreSQL: stores metadata
- Document endpoints → Ingestion coordinator: starts ingestion
- Ingestion coordinator → PostgreSQL: updates status and chunks
- Ingestion coordinator → PDF extraction: extracts text
- Ingestion coordinator → Text chunking: creates chunks
- Ingestion coordinator → Embedding generation: embeds chunks
- Ingestion coordinator → Vector indexing: indexes chunks
- Vector indexing → Pinecone vectors: upserts vectors
- API client → Query endpoint: submits query
- Query endpoint → Quota and rate limits: checks and updates
- Streaming endpoint → Quota and rate limits: checks and updates
- Query endpoint → PostgreSQL: loads tenant and logs
- Streaming endpoint → PostgreSQL: loads tenant and logs
- Query endpoint → Semantic cache: checks and populates
- Streaming endpoint → Semantic cache: checks and populates
- Query endpoint → Embedding generation: embeds query
- Streaming endpoint → Embedding generation: embeds query
- Query endpoint → Semantic search: requests candidates
- Streaming endpoint → Semantic search: requests candidates
- Query endpoint → BM25 search: requests candidates
- Streaming endpoint → BM25 search: requests candidates
- Semantic search → Pinecone vectors: searches vectors
- BM25 search → PostgreSQL: searches text
- Query endpoint → Rank fusion: fuses results
- Streaming endpoint → Rank fusion: fuses results
- Query endpoint → Chunk reranking: reranks candidates
- Streaming endpoint → Chunk reranking: reranks candidates
- Chunk reranking → Cohere reranking: scores relevance
- Query endpoint → Prompt builder: builds prompt
- Streaming endpoint → Prompt builder: builds prompt
- Query endpoint → Answer generation: generates answer
- Streaming endpoint → Streaming generation: streams answer
- Answer generation → Gemini: generates text
- Streaming generation → Gemini: streams tokens
- Streaming endpoint → Answer judge: schedules evaluation
- Answer judge → Groq judge model: evaluates answer