How kos0-col/minirag works
Mini RAG Pro is a web app for authenticated, document-grounded chat. Users sign in, create chats, upload documents, ask questions, and receive Gemini-generated answers grounded in retrieved chunks; they can also manage agents and explore the app’s other pages. The README documents document extraction, chunking, query caching, and agent management. The sampled sources confirm frontend state and local chat storage, server setup, auth logic, and parts of retrieval; several route and document-processing implementations were not sampled, so their internal wiring is shown only where documented.
Main entry points: server.js Express server · App.tsx App routing · queryService.js RAG query service · apiClient.ts API client
Components 26
Web app
- App routing
frontend/src/App.tsx - Chat page
frontend/src/pages/ChatPage.tsx - Documents page
frontend/src/pages/DocumentsPage.tsx - Explore page
frontend/src/pages/ExplorePage.tsx - Login and registration
frontend/src/pages/LoginPage.tsx - API client
frontend/src/services/apiClient.ts
API and services
- Express server
server.js - Auth routes
src/routes/auth.js - Chat routes
src/routes/chats.js - Document routes
src/routes/documents.js - Query routes
src/routes/queries.js - Agent routes
src/routes/agents.js - Authentication service
src/services/authService.js - Chat service
src/services/chatService.js
RAG workflow
- Document processing
documentService.js - RAG query service
queryService.js
Application state
- App store
frontend/src/store/useAppStore.ts - Local chat storage
frontend/src/utils/chatStorage.ts - Local document chunking
frontend/src/utils/chunkEngine.ts - Agent and skill catalog
frontend/src/services/repoService.ts
Persistent data
- Application database
- Domain entities
src/entities/DocumentChunk.js - Query cache
src/entities/CacheEntry.js
Other components
- User
- Gemini API
- Google OAuth
Connections 31
- User → App routing: uses
- App routing → Login and registration: routes
- App routing → Chat page: routes
- App routing → Documents page: routes
- App routing → Explore page: routes
- Chat page → App store: reads and updates
- Chat page → API client: requests
- Documents page → API client: requests
- Login and registration → API client: authenticates
- API client → Express server: HTTP API
- App store → Local chat storage: persists chats
- Documents page → Local document chunking: processes files
- Explore page → Agent and skill catalog: browses catalog
- Express server → Auth routes: mounts
- Express server → Chat routes: mounts
- Express server → Document routes: mounts
- Express server → Query routes: mounts
- Express server → Agent routes: mounts
- Auth routes → Authentication service: delegates auth
- Authentication service → Google OAuth: verifies OAuth
- Authentication service → Application database: reads and writes users
- Chat routes → Chat service: delegates chat operations
- Chat service → Application database: reads and writes chats
- Document routes → Document processing: processes uploads
- Document processing → Application database: stores documents and chunks
- Query routes → RAG query service: submits questions
- RAG query service → Application database: retrieves chunks
- RAG query service → Gemini API: embeds and generates
- Agent routes → Application database: manages agents
- Domain entities → Application database: defines schema
- RAG query service → Query cache: caches queries