A production-ready Retrieval-Augmented Generation (RAG) microservice built with FastAPI, Next.js, and ChromaDB.
Upload PDF/TXT documents and chat with them using a local LLM (Ollama).
- Multi-Format Support: Ingest PDF and TXT files with automatic text extraction and chunking.
- Semantic Search: Powered by
SentenceTransformersandChromaDBfor accurate context retrieval. - Local LLM Integration: Uses Ollama for privacy-focused, offline inference.
- Modern UI: Built with Next.js, Tailwind CSS, and Framer Motion for a smooth chat experience.
- Dockerized: One-command setup with
docker-compose. - Robust Testing: Comprehensive Unit, Integration, and E2E tests with 90%+ coverage.
- Framework: FastAPI
- Vector DB: ChromaDB
- Embeddings:
all-MiniLM-L6-v2 - PDF Processing:
pdfminer.six - Testing: Pytest, Pytest-Asyncio
- Framework: Next.js (React)
- Styling: Tailwind CSS
- State: React Hooks
- PDF Viewer:
react-pdf
-
Clone the repository
git clone https://github.com/yourusername/document-rag-service.git cd document-rag-service -
Start the services
docker-compose up --build
-
Access the application
- Frontend:
http://localhost:3000 - Backend API:
http://localhost:8000/docs
- Frontend:
The project includes a robust test suite running inside Docker.
# Run all tests
docker-compose exec backend pytest app/tests
# Run specific test category
docker-compose exec backend pytest app/tests/unit
docker-compose exec backend pytest app/tests/integration
docker-compose exec backend pytest app/tests/e2e├── backend/ # FastAPI application
│ ├── app/
│ │ ├── api/ # API Routes
│ │ ├── core/ # Config & Settings
│ │ ├── services/ # Business Logic (Ingestion, Retrieval, LLM)
│ │ └── tests/ # Pytest Suite
│ └── Dockerfile
├── frontend/ # Next.js application
│ ├── src/
│ │ ├── components/ # React Components
│ │ └── app/ # Pages & Layouts
│ └── Dockerfile
├── docs/ # Documentation
└── docker-compose.yml # Orchestration
Distributed under the MIT License.