How andrea-ragalzi/document-intelligent-hub works
Document Intelligent Hub lets people manage private PDF collections or explore a shared, read-only demo, then ask multilingual, document-grounded questions and inspect filename/page citations. The main flow runs from the Next.js client through FastAPI into document indexing or the RAG query workflow. Supporting capabilities include Firebase identity, guest-query limits, persisted registered-user conversations, and support submissions. The README documents the major flows; unsampled implementation details are represented at their existing directory paths rather than inferred as specific calls.
Main entry points: documents_router.py Document routes · page.tsx Next.js experience · rag_orchestrator_service.py RAG orchestration · main.py FastAPI application
Components 26
Web client
- Next.js experience
frontend/app/dashboard/page.tsx - Chat and citations
frontend/hooks/useRAGChat.ts - Conversation persistence
frontend/lib/conversationsService.ts - Firebase client
frontend/lib/firebase.ts
API and access
- FastAPI application
backend/main.py - Identity verification
backend/app/core/auth.py - API contracts
backend/app/schemas/rag_schema.py - Guest query budgets
backend/app/services/guest_query_budget_service.py - Support submissions
backend/app/routers/support_router.py
Document workflows
- Document routes
backend/app/routers/documents_router.py - PDF indexing
backend/app/services/document_indexing_service.py - Document management
backend/app/services/document_management_service.py - Shared demo corpus
backend/app/services/shared_demo_corpus_service.py - Original file storage
backend/app/infrastructure/local_file_storage.py
Retrieval and answers
- Query routes
backend/app/routers/query_router.py - RAG orchestration
backend/app/services/rag_orchestrator_service.py - Query parsing
backend/app/services/query_parser_service.py - Query reformulation
backend/app/services/query_processing_service.py - Vector repository
backend/app/repositories/vector_store_repository.py
Persistence and services
- ChromaDB
backend/app/db/chroma_client.py - OpenAI
- Firebase identity
- Firestore
- Guest usage adapter
backend/app/infrastructure/firestore_guest_usage.py - Email delivery
backend/app/infrastructure/resend_email_adapter.py
Other components
- User
Connections 28
- User → Next.js experience: uses
README.md - Next.js experience → Chat and citations: asks questions
README.md - Chat and citations → Query routes: sends REST query
README.md - Next.js experience → Document routes: manages PDFs
README.md - Next.js experience → FastAPI application: calls REST API
README.md - FastAPI application → Document routes: registers routes
backend/main.py - FastAPI application → Query routes: registers routes
backend/main.py - FastAPI application → Support submissions: registers routes
backend/main.py - Document routes → Identity verification: verifies identity
backend/app/routers/documents_router.py - Document routes → PDF indexing: indexes PDFs
README.md - Document routes → Document management: manages documents
backend/app/routers/documents_router.py - Document routes → Shared demo corpus: serves demo corpus
backend/app/routers/documents_router.py - Document routes → Original file storage: stores originals
README.md - PDF indexing → ChromaDB: indexes chunks
README.md - Query routes → RAG orchestration: runs RAG
backend/app/routers/query_router.py - Query routes → Guest query budgets: reserves guest budget
backend/app/routers/query_router.py - Guest query budgets → Guest usage adapter: reserves usage
backend/app/services/guest_query_budget_service.py - Guest usage adapter → Firestore: persists usage
- RAG orchestration → Query parsing: parses filters
- RAG orchestration → Query reformulation: reformulates queries
- RAG orchestration → Vector repository: retrieves evidence
README.md - Vector repository → ChromaDB: reads and writes
backend/app/repositories/vector_store_repository.py - RAG orchestration → OpenAI: generates answers
README.md - Chat and citations → Firebase client: uses authentication
README.md - Firebase client → Firebase identity: authenticates users
README.md - Conversation persistence → Firestore: persists conversations
README.md - Next.js experience → Conversation persistence: saves registered chats
README.md - Support submissions → Email delivery: sends support mail