Skip to content

MatheusFilg/rag-typescript

Repository files navigation

RAG-TS

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.


For End Users (Docker — Windows)

No local runtime dependencies required beyond Docker Desktop.

Prerequisites

First-time Setup

Double-click scripts/init-models.bat. It will:

  1. Start the Ollama container.
  2. Download the AI models (llama3 + nomic-embed-text, ~4.5 GB).
  3. 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.

Daily Use

Action Script
Start scripts/start.bat
Stop scripts/stop.bat

Accessing the Application

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.


Using the Application

Main Interface

The sidebar lists your Chats and Documents. Use the icons at the top to create a new chat or upload a document.

Main screen

Uploading 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.

Upload modal

Querying

  1. Select or create a Chat from the sidebar.
  2. Type your question in the chat input.
  3. 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.


For Contributors

Prerequisites

Ensure you have Bun installed.

Installation

bun install

Development

bun dev

Starts the Elysia backend (port 3000) and the Vite frontend (port 5173) simultaneously using Turborepo.

Build

bun run build

Project Rules

Important

These rules are mandatory for all contributors and AI agents.

  1. 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.
  2. 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.

Documentation

For a deep dive into the architecture, coding patterns, and the RAG pipeline flow, refer to the main project documentation:

PROJECT.md


Structure Overview

  • 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.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages