How alharthalhajhussein/mini-rag-app works
Mini-RAG-App is a FastAPI service for project-scoped document question answering. Users upload PDF or text files, which are processed into chunks; chunks can then be embedded and indexed, searched, or used to generate RAG answers. The graph preserves project/data management, NLP indexing and retrieval, configurable model and vector-store backends, and persistence. Some route and provider implementations were not excerpted, so their connections are limited to relationships supported by the README or SOURCE INDEX; dashed links indicate unverified wiring.
Main entry points: data.py Data routes · nlp_controller.py RAG orchestration · nlp.py NLP routes · main.py FastAPI app
Components 22
API and orchestration
- FastAPI app
src/main.py - Data routes
src/routes/data.py - NLP routes
src/routes/nlp.py
Document processing
- Project files
src/controllers/project_controller.py - Upload validation
src/controllers/data_controller.py - File chunking
src/controllers/process_controller.py
Retrieval and generation
- RAG orchestration
src/controllers/nlp_controller.py - Prompt templates
src/stores/llm/templates/template_parser.py - LLM provider factory
src/stores/llm/llm_provider_factory.py - LLM backends
src/stores/llm/providers
Persistence and backends
- Project records
src/models/project_model.py - Chunk records
src/models/chunk_model.py - Asset records
src/models/asset_model.py - Database schemas
src/models/db_schemes/minirag/schemes - Vector store factory
src/stores/vector_db/vector_db_provider_factory.py - Vector store backends
src/stores/vector_db/providers - Pgvector provider
src/stores/vector_db/providers/pgvector_db_provider.py - Qdrant provider
src/stores/vector_db/providers/qdrant_db_provider.py
Other components
- API user
- PostgreSQL
- Vector database
- Model service
Connections 29
- API user → Data routes: uploads files
src/routes/data.py - API user → NLP routes: queries API
src/routes/nlp.py - FastAPI app → Data routes: registers routes
src/main.py - FastAPI app → NLP routes: registers routes
src/main.py - Data routes → Upload validation: validates uploads
src/routes/data.py - Data routes → File chunking: processes files
- Data routes → Project records: manages projects
src/routes/data.py - Data routes → Chunk records: stores chunks
src/routes/data.py - Upload validation → Project files: gets project path
src/controllers/data_controller.py - File chunking → Project files: gets project path
src/controllers/process_controller.py - File chunking → Chunk records: creates chunks
- Project records → PostgreSQL: persists records
- Chunk records → PostgreSQL: persists chunks
- NLP routes → Project records: loads project
src/routes/nlp.py - NLP routes → Chunk records: loads chunks
src/routes/nlp.py - NLP routes → RAG orchestration: dispatches RAG work
src/routes/nlp.py - RAG orchestration → Vector database: indexes and searches
src/controllers/nlp_controller.py - RAG orchestration → Model service: embeds and generates
src/controllers/nlp_controller.py - RAG orchestration → Prompt templates: builds prompts
src/controllers/nlp_controller.py - RAG orchestration → Database schemas: uses chunk schemas
src/controllers/nlp_controller.py - FastAPI app → LLM provider factory: creates clients
src/main.py - FastAPI app → Vector store factory: creates client
src/main.py - LLM provider factory → LLM backends: selects provider
src/stores/llm/llm_provider_factory.py - Vector store factory → Vector store backends: selects provider
- Vector store backends → Pgvector provider: includes backend
- Vector store backends → Qdrant provider: includes backend
- Pgvector provider → PostgreSQL: stores vectors
- Qdrant provider → Vector database: stores vectors
- LLM backends → Model service: calls model APIs