Monorepo for a high-performance Legal PDF RAG system.
Built with Bun, Elysia, React, and LanceDB. This project leverages Retrieval-Augmented Generation to provide intelligent analysis of legal documents with full type safety.
No local runtime dependencies required beyond Docker Desktop.
- Docker Desktop for Windows installed and running.
Double-click scripts/init-models.bat. It will:
- Start the Ollama container.
- Download the AI models (
llama3+nomic-embed-text, ~4.5 GB). - Start all remaining services.
Note
Model download requires an internet connection and can take several minutes. Without an NVIDIA GPU, expect 30–90 s per query on CPU.
| Action | Script |
|---|---|
| Start | scripts/start.bat |
| Stop | scripts/stop.bat |
| Service | URL |
|---|---|
| Frontend | http://localhost:8080 |
| Backend | http://localhost:3000 |
| Swagger | http://localhost:3000/swagger |
Tip
The Swagger UI at http://localhost:3000/swagger lists all available API routes with request/response schemas. Use it to explore or test the API directly from the browser.
The sidebar lists your Chats and Documents. Use the icons at the top to create a new chat or upload a document.
Click the upload icon (top-right of the sidebar) to open the upload modal. Select a PDF file and click Confirmar Envio. The document will be processed and indexed — this may take a moment depending on file size.
- Select or create a Chat from the sidebar.
- Type your question in the chat input.
- The system retrieves relevant chunks from indexed documents and returns an answer with source citations.
Tip
All backend routes are documented and interactively testable at http://localhost:3000/swagger.
Ensure you have Bun installed.
bun installbun devStarts the Elysia backend (port 3000) and the Vite frontend (port 5173) simultaneously using Turborepo.
bun run buildImportant
These rules are mandatory for all contributors and AI agents.
- English + caveman full Documentation must be in English using "caveman full" style. Keep articles and full sentences but eliminate filler, hedging, and pleasantries. Maintain a professional and tight tone.
- Docs must match reality Documentation must strictly reflect code behavior. If the code performs action X, the documentation must state X. Stale documentation is worse than no documentation. Fix any observed drift immediately.
For a deep dive into the architecture, coding patterns, and the RAG pipeline flow, refer to the main project documentation:
apps/server: Elysia backend with modular domain logic.apps/web: React frontend with TanStack Router & Query.packages/*: Shared internal packages and types.scripts/: Windows helper scripts for Docker lifecycle management.storage/data: Local persistence for documents and vector indices.

