How haidepzai269/mindex-backend works
Mindex Backend is a Go API for document-centered AI study and collaboration. The principal workflow is that a user uploads a document, background workers extract and chunk it, then chat and retrieval features can answer questions using document content. The tree also exposes authentication, billing, collections, study tools, community features, and WebSocket rooms. The upload worker, RAG tool, startup wiring, and selected utilities were sampled; other feature links reflect the module structure and are shown conservatively.
Main entry points: routes API routes · database.go PostgreSQL · main.go Application startup · chat.go Chat and sessions
Components 23
API and identity
- Application startup
main.go - API routes
routes - Authentication
controllers/auth.go - Access middleware
middleware/auth.go
Documents and retrieval
- Document management
controllers/document.go - Upload workers
workers/worker.go - Extraction and indexing
workers/pipeline.go - Hybrid retrieval
utils/hybrid_search.go - Collections
controllers/collections.go
AI and study
- Chat and sessions
controllers/chat.go - Study features
controllers/studytools.go - AI provider routing
utils/ai_orchestrator.go - AI tools
internal/tools - Document search tool
internal/tools/rag_search_tool.go - Query rewriting
utils/query_rewriter.go
Platform services
- PostgreSQL
config/database.go - Redis
config/redis.go - Processing service client
utils/processing_client.go - Realtime rooms
internal/ws/room_hub.go - Billing
controllers/billing.go
Other components
- User
- AI providers
- Frontend client
Connections 30
- Application startup → API routes: registers
- Application startup → PostgreSQL: connects
- Application startup → Redis: connects
- Application startup → Upload workers: starts
- Application startup → Realtime rooms: starts
- Frontend client → API routes: calls API
- API routes → Access middleware: protects routes
- API routes → Authentication: registers auth
- API routes → Document management: registers documents
- API routes → Chat and sessions: registers chat
- API routes → Collections: registers collections
- API routes → Study features: registers study
- API routes → Billing: registers billing
- Upload workers → PostgreSQL: claims jobs
- Upload workers → Extraction and indexing: processes jobs
- Extraction and indexing → PostgreSQL: stores chunks
- Extraction and indexing → AI providers: requests embeddings
- Chat and sessions → Query rewriting: rewrites queries
- Chat and sessions → AI provider routing: requests AI
- Chat and sessions → Document search tool: invokes tool
- Document search tool → Hybrid retrieval: searches documents
- Document search tool → AI providers: generates embedding
- AI provider routing → AI providers: calls providers
- Document management → PostgreSQL: reads and writes
- Collections → PostgreSQL: reads and writes
- Authentication → PostgreSQL: reads and writes
- Authentication → Redis: checks auth state
- Processing service client → Redis: queues tasks
- Chat and sessions → Realtime rooms: uses realtime
- Billing → PostgreSQL: updates account