Web

Lexi Legal AI

Bilingual Ethiopian employment-contract review platform with citation-grounded RAG, clause risk scoring, and verifiable legal evidence.

Web2026React / TypeScript / Vite

Screens

Lexi Legal AI screenshot 1

Built with

ReactTypeScriptViteNode.jsExpressFastAPIPostgrespgvectorRedisMongoDBMinIOOpenAIRAGDockerTraefik

Lexi Legal AI helps Ethiopian workers and teams understand employment contracts before they sign. Users upload a PDF or contract photos in English or Amharic, then receive a clause-by-clause risk report grounded in retrieved Ethiopian labour-law provisions.

What I built

  • A public React application for upload, document preview, analysis history, settings, billing, and bilingual reports.
  • A Node.js API that handles Better Auth sessions, document metadata, subscriptions, manual payment review, guardrails, and orchestration.
  • A FastAPI AI service that owns corpus ingestion, hybrid retrieval, clause analysis, grounded chat, citation validation, and evaluation flows.
  • An operator admin console for corpus management, feedback review, billing verification, usage, and system operations.

AI and retrieval system

  • Hybrid RAG retrieval combines OpenAI text-embedding-3-small vector search in Postgres/pgvector with Postgres full-text search.
  • Dense and sparse rankings are fused with Reciprocal Rank Fusion, then optionally reranked before analysis.
  • The model can only cite provision IDs returned by retrieval; unsupported legal claims are marked as insufficient legal evidence instead of being presented as fact.
  • The current legal scope focuses on Ethiopian employment-contract clauses such as compensation, working hours, probation, leave, notice, termination, dispute resolution, and signatures.

Product experience

  • Reports include a safety/risk view, exact contract evidence, cited legal provisions, bilingual summaries, and follow-up chat.
  • The product is designed for English and Amharic workflows, with language detection and instant report switching.
  • Trust and safety work includes AI disclaimers, Terms, Privacy Policy, account deletion, rate limits, and OpenAI spend ceilings.

Production operations

  • The live deployment runs on a VPS behind Traefik with separate frontend, admin, backend, AI service, worker, Postgres, Redis, MinIO, and MongoDB services.
  • Operational tooling includes automated off-box backups, Uptime Kuma status monitoring, Healthchecks, GlitchTip error tracking, Beszel host metrics, CI tests, and git-based deploys.

Impact

Lexi turns legal AI from a generic chatbot into a verifiable contract-review workflow: every serious finding must point back to retrieved legal text, and when the system lacks evidence it says so directly.