How anuj-kumar-04/docintel-multi-tenant-enterprise-document-intelligence-platform--rag works
DocIntel is a multi-tenant document intelligence platform. Users authenticate, upload documents for asynchronous parsing, chunking and embedding, then ask questions through streaming chat and receive cited answers from hybrid retrieval and LLM generation. The graph also preserves tenant administration and quota controls, plus the storage, worker and model layers. Several subsystem links are documented in the README; unsampled implementation details are not inferred beyond those documented relationships.
Main entry points: tasks.py Ingestion worker · page.tsx Next.js interface · chat.py Chat endpoint · router.py API v1 routes
Components 29
User experience
- Next.js interface
frontend/app/page.tsx - Login screen
frontend/app/(auth)/login/page.tsx - Chat interface
frontend/app/(app)/chat/page.tsx - Streaming chat view
frontend/components/ChatStream.tsx - Citation card
frontend/components/CitationCard.tsx - Document workspace
frontend/app/(app)/documents/page.tsx - Upload control
frontend/components/UploadDropzone.tsx - Admin dashboard
frontend/app/(app)/admin/page.tsx
API and access
- FastAPI application
backend/app/main.py - API v1 routes
backend/app/api/v1/router.py - Authentication routes
backend/app/api/v1/auth.py - Auth and permissions
backend/app/services/auth_service.py - Document routes
backend/app/api/v1/documents.py - Chat endpoint
backend/app/api/v1/chat.py - Tenant administration
backend/app/api/v1/admin.py
Document ingestion
- Ingestion worker
backend/app/workers/tasks.py - Document parser
backend/app/services/parsing.py - Layout chunker
backend/app/services/chunking.py - Embedding service
backend/app/services/embeddings.py - Object storage
backend/app/services/storage.py
Retrieval and answers
- Hybrid retrieval
backend/app/services/retrieval.py - Cited answer generation
backend/app/services/generation.py - Semantic cache
backend/app/services/cache.py - Token budget
backend/app/services/budget.py
Data and operations
- PostgreSQL and pgvector
backend/app/models/chunk.py - Redis queue and cache
- LLM providers
- Langfuse tracing
backend/app/core/tracing.py
Other components
- Enterprise user
Connections 33
- Enterprise user → Next.js interface: uses
- Next.js interface → Login screen: signs in
- Next.js interface → Chat interface: asks questions
- Chat interface → Streaming chat view: renders stream
frontend/app/(app)/chat/page.tsx - Streaming chat view → Citation card: renders citations
frontend/components/ChatStream.tsx - Next.js interface → Document workspace: manages documents
- Document workspace → Upload control: uses upload
frontend/app/(app)/documents/page.tsx - Next.js interface → Admin dashboard: manages tenant
- Next.js interface → FastAPI application: HTTPS and SSE
- FastAPI application → API v1 routes: mounts routes
backend/app/main.py - API v1 routes → Authentication routes: registers
backend/app/api/v1/router.py - API v1 routes → Document routes: registers
backend/app/api/v1/router.py - API v1 routes → Chat endpoint: registers
backend/app/api/v1/router.py - API v1 routes → Tenant administration: registers
backend/app/api/v1/router.py - Authentication routes → Auth and permissions: delegates
backend/app/api/v1/auth.py - Document routes → Object storage: stores uploads
backend/app/api/v1/documents.py - Document routes → Ingestion worker: enqueues processing
backend/app/api/v1/documents.py - Ingestion worker → Object storage: downloads files
backend/app/workers/tasks.py - Ingestion worker → Document parser: parses content
backend/app/workers/tasks.py - Ingestion worker → Layout chunker: chunks layout
backend/app/workers/tasks.py - Ingestion worker → Embedding service: embeds chunks
backend/app/workers/tasks.py - Ingestion worker → PostgreSQL and pgvector: writes chunks
backend/app/workers/tasks.py - Object storage → PostgreSQL and pgvector: stores metadata
- Ingestion worker → Redis queue and cache: runs queued task
- Chat endpoint → Hybrid retrieval: retrieves context
backend/app/api/v1/chat.py - Chat endpoint → Cited answer generation: generates answer
backend/app/api/v1/chat.py - Chat endpoint → Semantic cache: checks cache
backend/app/api/v1/chat.py - Chat endpoint → Token budget: enforces quota
backend/app/api/v1/chat.py - Hybrid retrieval → PostgreSQL and pgvector: searches vectors
- Hybrid retrieval → Embedding service: embeds query
backend/app/services/retrieval.py - Cited answer generation → LLM providers: calls providers
- Chat endpoint → Langfuse tracing: records traces
backend/app/api/v1/chat.py - Tenant administration → PostgreSQL and pgvector: reads tenant data
backend/app/api/v1/admin.py