Inspiration

It started in a lawyer's office in Delhi.

A senior advocate 18 years of experience, a full client calendar was spending three hours drafting a standard Non-Disclosure Agreement. Not because it was complex. Because every clause had to be hand-typed, cross-referenced against the Indian Contract Act 1872, checked for jurisdiction compliance, and formatted from scratch. Again. Like he had done hundreds of times before.

That moment broke our hearts a little.

AI tools like Harvey and CoCounsel exist, but they charge $200–500 per user per month and are built entirely for Big Law firms in the US and UK. The solo practitioner in Meerut, the boutique firm in Bengaluru, the in-house counsel at an Indian startup completely left out.

We asked one question:

"What if every lawyer not just the ones at Clifford Chance had an AI associate working alongside them?"

That question became LexAI Intelligence.


What It Does

LexAI is an AI-powered legal intelligence platform that automates the most time-consuming parts of a lawyer's daily workflow — across three jurisdictions: United States, United Kingdom, and India. One toggle in Settings sets the default jurisdiction, and every AI feature drafting, analysis, research adapts to it automatically.

Contract Drafting Engine

Describe your contract in plain English. LexAI generates a full, jurisdiction-compliant draft in under 30 seconds NDAs, Employment Agreements, Service Agreements, Share Purchase Agreements, Freelance Contracts, and more. US drafting is tuned to UCC, Reg D, Delaware GCL, and NLRA.

Document & Risk Analysis

Upload any legal document and get instant clause-by-clause analysis. Every clause is scored LOW, MEDIUM, or HIGH risk, with a plain-English explanation and a suggested rewrite. An overall Risk Score \( R \in [0, 100] \) gives lawyers a single number to prioritise review.

Case Law Research

Ask any legal question in plain English. LexAI searches verified legal databases and returns cited precedents with a hallucination guard that cross-verifies every citation before it reaches the lawyer. No invented cases. Ever.

Client Brief Generator

Paste any dense legalese, choose a complexity level (Basic, Standard, or Detailed), and receive a plain-English summary your client can actually understand.

Deadline & Matter Tracker

Manage court dates, filing deadlines, statute of limitations countdowns, and contract expiry alerts all tracked with priority and status.

Pricing

Three plans across three billing regions — US · USD, UK · GBP, IN · INR billed once for a 24-month term.

Plan Price Key features
Solo $49 / 2 years Up to 25 matters · Unlimited contracts & AI · Single state US law
Firm $199 / 2 years Unlimited everything · Multi-state + UK + India · Client briefs · Priority support
Enterprise Custom SSO (Okta, Azure AD) · US data residency · Dedicated success manager

How We Built It

LexAI is a production-grade full-stack TypeScript monorepo with four layers.

Frontend

React 19 + Vite 7 + Tailwind CSS 4 + shadcn/ui. We chose a warm Copper & Cream design language — deliberately different from the cold blue that dominates legal tech.

Libre Baskerville  →  Display headings  (serif authority)
Mulish             →  Body text         (clean, readable)
IBM Plex Mono      →  Clause numbers, citations, legal codes

State: TanStack Query v5 · Routing: Wouter · Animation: Framer Motion · Forms: React Hook Form + Zod

Backend

Express 5 with 8 route modules:

/dashboard   /matters    /contracts   /documents
/deadlines   /research   /briefs      /settings

All protected by a requireAuth middleware via Clerk every database query scoped to the authenticated user automatically.

AI Layer

Anthropic Claude (primary) + OpenAI GPT-4 (fallback), routed by task complexity. Switching jurisdiction changes the entire prompt context:

US  →  UCC · Reg D · Delaware GCL · NLRA
IN  →  Indian Contract Act 1872 · Companies Act 2013 · IDA 1947
UK  →  English common law · Contracts (Rights of Third Parties) Act 1999

Risk Scoring

The overall contract risk score is computed as:

$$R = 100 - \left(\frac{\sum_{i=1}^{n} w_i \cdot r_i}{\sum_{i=1}^{n} w_i}\right) \times 100$$

Where \( w_i \) is the weight of clause \( i \) (liability clauses weighted higher than boilerplate) and \( r_i \in [0, 1] \) is the raw risk severity of that clause.

API Client

The entire React Query client is auto-generated via Orval v8.5.3 from the OpenAPI spec zero hand-written fetch calls, full end-to-end type safety, zero drift between backend and frontend.

Deployment

Built and shipped on Replit → lex-intelligence--mtiwari241905.replit.app


Challenges We Ran Into

The Hallucination Problem

A legal AI that invents a Supreme Court judgment is worse than no AI at all. In 2023, a US lawyer was sanctioned for submitting ChatGPT-generated fake citations (Mata v. Avianca). We built a multi-layer citation verification pipeline:

AI response
    ↓
Extract all citations
    ↓
Cross-check against official databases
    ↓
Score confidence per citation
    ↓
Hard-block any unverified citation
    ↓
Deliver to lawyer — verified only

Getting this right for Indian case law — where citation formats like (2023) 5 SCC 123 differ completely from US/UK took the most iteration of anything we built.

One Toggle, Three AI Systems

The Default Jurisdiction selector looks like a simple 3-button toggle. Under the hood, switching US → IN → UK changes the entire prompt context, clause library, compliance ruleset, and legal database. Three genuine pipelines not three labels on the same prompt. This was our deepest architectural challenge.

Making AI Feel Instant

Lawyers don't wait. We combined:

  • Streaming responses — tokens appear as generated, not all at once
  • Model routing — fast models for simple tasks, powerful models for complex ones
  • Prompt caching — 90% cost reduction on repeated system prompts
  • Optimistic UI — interface responds immediately while AI works in background

$$t_{\text{perceived}} : 28\text{s} \longrightarrow 4\text{s}$$

Scope Discipline

8 API modules + React frontend + 3-jurisdiction AI + auth + design system + multi-currency pricing + live deployment in one month. We cut real-time collaboration, native mobile, and live Stripe payments. We kept: accuracy, jurisdiction depth, and a product that actually works.


Accomplishments That We're Proud Of

It's live and it actually works. lex-intelligence--mtiwari241905.replit.app — real database, real auth, real AI, 8 fully functional API modules. Not a prototype. (Currently hosted on Replit · migrating to Google Cloud Run by June 2026)

Three genuine jurisdictions — not three labels. US, UK, and India are all first-class citizens with their own prompt context, clause libraries, and compliance rules. LexAI is one of the only legal AI tools in the world with native Indian law support.

End-to-end type safety. PostgreSQL → Drizzle ORM → Express API → Orval-generated React Query hooks → Zod-validated forms. Every layer fully typed. Zero any in production.

A design lawyers actually want to use. The Copper & Cream design system is distinctive in a market full of cold, intimidating SaaS interfaces. Approachability is a feature when your users are non-technical professionals.

A real business model. Three plans · three billing regions · three currencies · 24-month billing cycle · plan enforcement server-side · inline upgrade path in-app. The commercial architecture is real and ready.


What We Learned

Accuracy is the product in legal AI. The hardest part was making the AI trustworthy, not impressive. A fast wrong answer in a legal context is catastrophically worse than a slow right one. This shaped our entire architecture toward verification-first design.

One toggle can hide enormous complexity. The jurisdiction selector is three buttons in the UI. Behind it are three genuinely different AI pipelines. Good UX hides complexity but the complexity still has to be built.

Auto-generated API clients are massively underrated. Orval was a two-day setup that paid back every day after. No drift, no hand-written types, instant TypeScript errors on breaking changes. Every team building REST + React should be doing this.

Indian legal tech is a massive underserved market. \( 750{,}000+ \) registered advocates in India. A legal services market worth $1.3B+. Almost zero purpose-built AI tooling for Indian law. The gap between what's possible and what lawyers have access to is enormous and LexAI proved it's closeable.

Pricing is product design. The 24-month billing term, INR localisation, and inline Plan & Usage in Settings weren't afterthoughts they were product decisions that shaped trust and conversion from day one.


What's Next for LexAI Intelligence

Google Cloud Run Migration — Our Replit deployment serves as the hackathon demo. Production infrastructure moves to Google Cloud Run in June 2026 containerised, auto-scaling, and with a permanent custom domain.

DOCX & PDF Export — One-click Word and PDF export for every drafted contract and brief. The single most-requested feature from test users.

Live Stripe Billing — The plan tiers, billing regions, and upgrade flow are fully built. Next: wire Stripe for real USD · GBP · INR payments.

Team Collaboration — Shared matter workspaces with role-based access (partner, associate, paralegal) for firms with multiple lawyers.

Calendar Sync — Court dates and filing deadlines synced directly to Google Calendar and Microsoft Outlook.

Fine-tuned Indian Law Model — A model trained on the full corpus of Indian Supreme Court and High Court judgments, all major Indian statutes, and real Indian contract templates. Our IN jurisdiction accuracy would jump significantly beyond anything built on general-purpose LLMs.

Multilingual Support — Hindi, Tamil, and Telugu brief generation and document analysis. India has 22 scheduled languages; most clients don't work primarily in English.

SOC 2 Type II — The Enterprise plan already includes SSO (Okta, Azure AD) and US data residency. SOC 2 certification is the next step to unlock enterprise law firm deployments.

Mobile App — React Native companion for reviewing briefs, checking deadlines, and approving drafts from the courtroom.


⚖️ Live → lex-intelligence--mtiwari241905.replit.app

Built With

  • anthropic-claude-api
  • clerkauthentication-api
  • drizzleorm
  • express5
  • framer-motion
  • git
  • ibmplexmono
  • libre-baskerville
  • lucide-react
  • mulish
  • orval
  • pgvector
  • pnpm
  • postgresql
  • react19
  • reacthookform
  • shadcn/ui
  • sql
  • tailwindcss4
  • tanstackqueryv5
  • tsx
  • typescript
  • vite7
  • wouter
  • zod
Share this project:

Updates

Submission history