Case Study

AI-Powered Contract Analyser

LLM API Next.js Supabase TypeScript Full-Stack
80%
Review time saved
40+
Clause types detected
3
Languages supported

The Problem

Legal teams and founders spend hours manually reviewing contracts — NDAs, SaaS agreements, employment contracts — looking for risky clauses, unusual terms, and missing provisions. Junior team members often miss nuance; senior lawyers are expensive. Neither option scales.

The goal was a SaaS tool that could read any contract, extract structured information, flag risks in plain English, and surface questions the user should be asking their lawyer — in under 60 seconds.

Why a Long-Context Model

Contract analysis is a perfect fit for a long-context, strong-instruction-following model. A typical NDA runs 3,000–8,000 tokens; a complex MSA can be 40,000+. The model handles the full document in a single pass, maintaining coherent reasoning across the entire contract — whereas chunked approaches lose cross-reference context.

Reliability at following structured output schemas (returning valid JSON) without extensive prompt engineering was also critical for the data pipeline. The LLM layer is swappable — this isn't a single-provider dependency, just the model that best suited these constraints at build time.

Core Features

Clause Extraction
40+ clause types identified, labelled, and pulled out as structured data — termination, IP assignment, non-compete, liability cap, etc.
Risk Flagging
Each clause scored 1–5 for risk, with a plain-English explanation of why it matters and industry benchmark comparison.
Plain-English Summary
Executive summary of the whole contract in 5 bullet points: what you're agreeing to, what you're giving up, and what to watch out for.
Suggested Questions
AI-generated list of questions to raise with the other party or your lawyer, based on missing or one-sided clauses.
Side-by-Side Redline
Upload two contract versions and get a structured diff of changed clauses, with AI commentary on the significance of each change.
Export & Share
Download analysis as PDF or share a read-only link with collaborators. Clause annotations preserved in the shared view.

Technical Architecture

  • Next.js App Router — server components for the analysis pipeline, client components for the interactive review UI. Streaming responses keep the UI live during long analyses.
  • Supabase — Postgres for user data and analysis results, storage for uploaded PDFs, Auth for multi-tenant SaaS. Row-level security ensures users only access their own documents.
  • Structured outputs — the model is prompted to return a typed JSON schema (TypeScript types shared between client and server via a shared package). Zod validates at runtime.
  • PDF parsing — PDF.js on the client for rendering; pdf-parse server-side for text extraction. Scanned documents fall back to Textract OCR via AWS.

Outcome

Launched as a private beta to 120 users — primarily startup founders, freelancers, and small law firms. Retention at 30 days was 64%. Users report saving an average of 2–3 hours per contract review. Paid plan conversion at 18%.

← Agentic Orchestrator All Projects →