Skip to main content

Backend Handbook Overview

This handbook is for backend developers, architects, and integration engineers, helping you quickly understand MimirQ backend's module boundaries, API contracts, and internal flows. Use OpenAPI / Redoc as the authoritative Schema reference; this handbook focuses on navigation indexes, state-machine descriptions, and troubleshooting guides.

Tech Stack​

LayerTechnologyVersion / Notes
Web FrameworkFastAPI0.135
ORMSQLAlchemy2.0 (async)
Vector DatabaseMilvus2.x (BM25 + SPLADE + ColBERT ANN hybrid retrieval)
Relational DatabasePostgreSQLPrimary storage
Cache / QueueRedisSession, rate limiting & Pub/Sub
Task QueueArqAsync parsing, indexing, evaluation tasks
Object StorageMinIO / S3-compatibleRaw document files

System Architecture​

Module Map​

DomainOverviewAPI IndexState Machine / Troubleshooting
DatasetsOverviewAPI IndexState & Jobs / Troubleshooting
DocumentsOverviewAPI IndexState & Jobs / Troubleshooting
ChatChat Module——
RetrievalRetrieval Module——
Knowledge Graph (KG)KG Module——
EvaluationsEvaluations Module——
GovernanceGovernance Module——
ParsingParsing Module——
EvidenceEvidence Module——
PlatformPlatform Module——

Suggested Reading Order​

Reading Path
  1. This page -- Establish the big picture
  2. Datasets -- Overview → API Index → Schema → State & Jobs
  3. Documents -- Overview → Pipeline → State & Jobs
  4. Retrieval & RAG -- Retrieval → KG → Chat
  5. Governance & Evaluations -- Governance → Evaluations
  6. Integration Troubleshooting -- Each domain's troubleshooting page + Integration Overview

Embedding & Model Support​

The backend ships with 15 embedding models across 7 providers. The repository's .env.example defaults to BAAI/bge-m3; if EMBEDDING_MODEL is not set, the backend code still falls back to text-embedding-3-small. Production and team environments should follow .env.example / deployment config rather than the process fallback. The RAG Engine supports hybrid orchestration of four retrieval modes -- Vector, BM25, SPLADE, and ColBERT ANN -- and can be flexibly switched via configuration.

Key Configuration & File Paths​

FilePurpose
app/core/config.py1200+ config entries, driven by pydantic-settings
alembic.ini / alembic/Database migrations
docker-compose.ymlLocal dev environment orchestration
app/rag/engine.pyRAGEngine main flow (streaming)
app/rag/retriever.pyHybridRetriever hybrid retrieval
app/rag/pipelines/langgraph.pyLangGraph Functional API pipeline
app/rag/kg/Knowledge graph extraction / recall / expansion / reranking
Configuration Priority

Environment variables > .env file > config.py defaults. For production deployments, inject sensitive configuration via environment variables.