How sophanith21/library-book-retrieval-rag-engine works
LBRE is documented as a digital library and RAG search system: users enter through a browser, reach backend services through the edge and API gateways, and search results are retrieved and synthesized with citations. Its documented domain capabilities include authentication, book CRUD and object storage, hybrid indexing, fused retrieval, and LLM synthesis. The sampled NestJS controllers and services are mostly hello-world scaffolding, and the frontend is a Vite starter; therefore domain interactions below rely on README statements, not inspected implementations. Dashed edges mark documented or implied-but-unverified messaging and data links.
Main entry points: api-gateway.controller.ts API Gateway · retrieval.service.ts Retrieval Service · book.service.ts Book Service · indexing.service.ts Indexing Service
Components 16
User Experience
- Web Interface
frontend/src/App.tsx - Edge Gateway
infra/edge-gateway/nginx.conf
Backend Services
- API Gateway
backend/apps/api-gateway/src/api-gateway.controller.ts - Authentication
backend/apps/auth/src/auth.service.ts - Book Service
backend/apps/book/src/book.service.ts - Service Contracts
backend/libs/contracts/src/contracts.service.ts
Search and Synthesis
- Indexing Service
backend/apps/indexing/src/indexing.service.ts - Retrieval Service
backend/apps/retrieval/src/retrieval.service.ts - LLM Synthesis
backend/apps/llm/src/llm.service.ts - Ollama LLM
- Crawler and Ingest
ingest.py
Persistence and Messaging
- Database Client
backend/libs/prisma/src/prisma.service.ts - RabbitMQ
- PostgreSQL PgVector
- SeaweedFS S3
Other components
- Library User
Connections 21
- Library User → Web Interface: uses
README.md - Web Interface → Edge Gateway: routes API requests
README.md - Edge Gateway → API Gateway: proxies API
README.md - API Gateway → Authentication: routes requests
README.md - API Gateway → Book Service: routes requests
README.md - API Gateway → Indexing Service: routes requests
README.md - API Gateway → Retrieval Service: routes requests
README.md - API Gateway → LLM Synthesis: routes requests
README.md - API Gateway → RabbitMQ: dispatches messages
README.md - Authentication → RabbitMQ: uses messaging
README.md - Book Service → RabbitMQ: uses messaging
README.md - Indexing Service → RabbitMQ: uses messaging
README.md - Retrieval Service → RabbitMQ: uses messaging
README.md - LLM Synthesis → RabbitMQ: uses messaging
README.md - Book Service → SeaweedFS S3: stores book files
README.md - Indexing Service → PostgreSQL PgVector: stores vectors
README.md - Retrieval Service → PostgreSQL PgVector: searches vectors
README.md - Retrieval Service → LLM Synthesis: provides fused chunks
README.md - LLM Synthesis → Ollama LLM: generates synthesis
README.md - Crawler and Ingest → Book Service: supplies book content
- Crawler and Ingest → Indexing Service: supplies documents