How 06dhanushbe/rag_as_a_service works
Rag as a Service lets dashboard owners authenticate, manage knowledge bases and API keys, upload documents, and inspect usage; API consumers submit RAG queries and receive generated answers. The backend ingests PDFs into chunks and vectors, then retrieves and generates query responses. The graph preserves the documented frontend capabilities and the indexed backend modules. Some routes and subsystems were not excerpted, so their documented links are cited to the README; unsampled implementation details are not inferred.
Main entry points: App.jsx Console router · apiClient.js API client · rag.py RAG query route · service.py Query orchestrator
Components 29
Admin console
- Console router
frontend/src/App.jsx - API client
frontend/src/apiClient.js - Knowledge-base UI
frontend/src/pages/KnowledgeBasePage.jsx - API-key UI
frontend/src/pages/ApiManagementPage.jsx - Usage dashboard
frontend/src/pages/UsagePage.jsx - Query tester
frontend/src/pages/DocsPage.jsx
Backend API
- Authentication routes
app/api/auth.py - API-key routes
app/api/api_keys.py - Knowledge-base routes
app/api/kb.py - Upload routes
app/api/upload.py - Document routes
app/api/documents.py - RAG query route
app/api/rag.py - Usage routes
app/api/usage.py
RAG runtime
- Ingestion coordinator
app/rag/ingestion_service.py - PDF loader
app/rag/ingestion/loader.py - Text chunker
app/rag/ingestion/chunker.py - Vector indexer
app/rag/ingestion/indexer.py - Query orchestrator
app/rag/service.py - Vector retriever
app/rag/retrieval/retriever.py - Result reranker
app/rag/retrieval/reranker.py - Context builder
app/rag/retrieval/context_builder.py - Answer generator
app/rag/llm/generator.py
Persistence and providers
- Relational database
app/core/database.py - Qdrant vector store
app/rag/vectorstore/qdrant_client.py - Embedding provider
app/rag/ingestion/embedder.py - LLM provider
- Usage event model
app/models/usage_event.py
Other components
- Dashboard owner
- API consumer
Connections 31
- Dashboard owner → Console router: manages through
- Console router → API client: requests data
frontend/src/App.jsx - Console router → Knowledge-base UI: routes to
frontend/src/App.jsx - Console router → API-key UI: routes to
frontend/src/App.jsx - Console router → Usage dashboard: routes to
frontend/src/App.jsx - Console router → Query tester: routes to
frontend/src/App.jsx - API client → Authentication routes: calls API
- API client → Knowledge-base routes: calls API
- API client → API-key routes: calls API
- API client → Upload routes: uploads files
- API client → Usage routes: requests metrics
- API consumer → RAG query route: submits query
- RAG query route → Relational database: checks mappings
app/api/rag.py - RAG query route → Query orchestrator: calls query
app/api/rag.py - RAG query route → Usage event model: logs usage
app/api/rag.py - RAG query route → API consumer: returns answer
app/api/rag.py - Upload routes → Ingestion coordinator: starts ingestion
- Ingestion coordinator → PDF loader: loads PDF
app/rag/ingestion_service.py - Ingestion coordinator → Text chunker: splits pages
app/rag/ingestion_service.py - Ingestion coordinator → Vector indexer: indexes chunks
app/rag/ingestion_service.py - Vector indexer → Embedding provider: embeds chunks
app/rag/ingestion/indexer.py - Vector indexer → Qdrant vector store: stores vectors
app/rag/ingestion/indexer.py - Query orchestrator → Vector retriever: retrieves chunks
app/rag/service.py - Query orchestrator → Result reranker: reranks results
app/rag/service.py - Query orchestrator → Context builder: builds context
app/rag/service.py - Query orchestrator → Answer generator: generates answer
app/rag/service.py - Vector retriever → Qdrant vector store: searches vectors
app/rag/retrieval/retriever.py - Vector retriever → Embedding provider: embeds question
app/rag/retrieval/retriever.py - Answer generator → LLM provider: requests completion
- Usage routes → Usage event model: reads metrics
app/api/usage.py - Relational database → Usage event model: provides model base
app/models/usage_event.py