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