Back to all work
Legal AIMulti-tenant SaaS

QLaw

A Vietnamese-first, RAG-grounded legal AI platform for law firms — bilingual by design, with row-level tenant isolation.

Role Architected & led

QLaw is a legal AI platform for law firms: streaming chat over legal corpora with strict tenant isolation, bilingual by design — Vietnamese first, English alongside. Built as a monorepo across a Next.js web app, a NestJS API gateway, and a FastAPI AI service.

What it does

  • Streaming chat grounded in legal corpora over server-sent events.
  • Bilingual VI/EN with production-grade internationalization.
  • Row-level security for tenant isolation enforced in PostgreSQL itself, not just the app layer.
  • pgvector retrieval with a graceful mock mode for offline development.

Architecture & approach

  • Monorepo — Next.js, NestJS, and a FastAPI AI service under one turbo workspace.
  • SSE token streams proxied through the NestJS gateway to the browser.
  • RLS at the database — law-firm data cannot cross tenant boundaries.
Why it mattersLegal work demands both privacy and precision — RLS-enforced isolation plus RAG grounding make the AI trustworthy enough for real firm data.
Built with
Next.jsNestJSFastAPITypeScriptPostgreSQL (RLS)pgvectorLiteLLMDocker