Skip to main content
02 // Production Legal RAGLive Production • 19 Statutes

JurixAI

Statute-grounded Indian legal intelligence assistant covering 19 Indian acts (6,994 ChromaDB vectors) with English/Hindi Tesseract OCR document review, trilingual responses, Supabase OAuth2 PKCE auth, and multi-layer production abuse guardrails.

RoleFull-Stack & RAG Architect
ContextLive Production Web App
Live DemoSource Code
Legal Index
6,994 Chunks
Indian Law
19 Statutes
Test Suite
37 Tests
INTERACTIVE SYSTEM SIMULATORLIVE CLIENT DEMO
CHROMADB • 6,994 VECTORS / 19 STATUTES
Q:Online fraud hua hai aur thana FIR likhne se mana kar raha hai.
BNS 2023#01
BNSS Sec. 173#02
IT Act 2000#03
TOP-3
BNS 2023BNSS Sec. 173IT Act 2000

Ghabraiye mat—aap kisi bhi thane mein Zero FIR darj karwa sakte hain (BNSS Sec. 173) ya turant 1930 helpline par cyber complaint file karein.

GEMINI CASCADE + TESSERACT OCRPKCE AUTH • 37 TESTS
01 // THE BOTTLENECK

Problem Space

Citizens facing urgent legal notices, FIR refusals, or tenancy disputes struggle to decode dense Indian bare acts (BNS/BNSS/IPC/Constitution), while naive RAG wrappers hallucinate statutes or blow through API budgets under guest traffic.

02 // THE SYSTEM

Production Architecture

A React 19 + Vite frontend on Vercel pairs with a non-root FastAPI + ChromaDB container on Azure Container Apps, backed by Supabase OAuth2 PKCE auth, a 3-model Gemini cascade, smart small-talk RAG bypass, and English/Hindi OCR review.

Execution Pipeline

  1. STAGE 01

    Auth & Abuse Shield

    Verifies Supabase PKCE JWTs or IP-scoped guest quotas (5/10min, 15/day) beneath a global 250 req/day UTC kill-switch and strict message caps.

  2. STAGE 02

    Calibrated ChromaDB Retrieval

    Bypasses RAG on short greetings; legal queries fetch top-3 chunks (750-char size, 120 overlap) from 6,994 all-MiniLM-L6-v2 vectors across 19 bare acts.

  3. STAGE 03

    Safe OCR Document Review

    Checks %PDF/PNG/JPEG magic bytes, enforces 8 MB chunked early-abort and 25M-pixel decompression-bomb guards, and extracts text via pdfplumber + English/Hindi Tesseract.

  4. STAGE 04

    Multi-Model Gemini Cascade

    Streams empathetic English, Hindi, or Hinglish guidance structured as Fastest Exit → Statutory Grounding → Alternatives across gemini-2.5-flash, gemini-3.5-flash-lite, and gemini-3.8-flash.

Key Engineering Trade-Offs & Decisions

  • Baked all-MiniLM-L6-v2 weights directly into the non-root Docker image (HF_HUB_OFFLINE=1) for deterministic, offline-safe cold starts.
  • Enforced strict token and context budgets (RAG_TOP_K=3, 3,500-char RAG cap, 4-turn history window, 6,000-char doc cap, 1,024 output cap) to control inference cost.
  • Separated Supabase Anon (PKCE user auth) and Secret (server-side RLS) clients with anti-spoofing signup checks and 37 automated pytest tests.
  • Automated GitHub Actions → GHCR → Azure Container Apps backend deployment paired with Vercel frontend hosting.

Tech Stack

FastAPIChromaDBLangChainGemini APIReact 19SupabaseTesseract OCRDockerAzure ACAVercel
Deployment & Runtime

Live at jurix-ai.vercel.app; non-root FastAPI + 42.3 MB ChromaDB container deployed on Azure Container Apps via GHCR with Supabase PostgreSQL.

Open-source repo: PRs, issues, and feature collabs are always welcome on GitHub.