Back to Portfolio
Case Study

AI Contract Review Platform

A contract review SaaS for the music industry. Artists and managers upload recording, management, or publishing contracts and get a structured risk analysis in minutes.

Client: Music-industry legal tech (anonymized) Product: Live SaaS, marketing site + application Role: Full-stack developer (sole developer)

Challenge

Music industry contracts are dense, high-stakes, and usually reviewed under time pressure. Artists and managers sign recording, management and publishing deals without a clear picture of what they are agreeing to—and full legal review is slow and expensive enough that many skip it entirely.

Solution

A platform that gives users a first-pass, professional-grade analysis in minutes: flagged clauses with severity ratings, evidence highlighted in place in the document, extracted obligations turned into calendar reminders, and an overall risk score—plus a path to connect with a real entertainment lawyer when one is needed. The product is explicitly a review tool rather than legal advice, and carries clear disclaimers alongside a route to actual counsel.

Next.js 14 (App Router) TypeScript Supabase + RLS Anthropic Claude Inngest Stripe Resend Tailwind CSS

Shape of the system

Diagram: a contract document with clauses highlighted by severity alongside a panel showing a deterministic risk score, severity counts, the hypothesis rubric version, and the memoized analysis pipeline
Illustrative diagram — severity flags, deterministic score, memoized pipeline

Technical scope

  • Full application platform — sign-up and log-in with email confirmation and password reset, role selection (artist, manager, lawyer), session middleware, dashboard, contract vault with 12-month expiry handling, and settings
  • Contract ingestion — drag-and-drop upload to object storage via presigned URLs, with text extraction for PDF, DOCX and legacy DOC, plus language detection
  • Hypothesis-driven analysis engine tested against a curated library of 100+ expert-written hypotheses, developed with a music-industry domain expert
  • Durable background pipeline — analysis as a memoized job (extract → analyze → format → save), idempotent, retry-capped and concurrency-limited
  • Document-centric review UI — formatted contract beside a findings rail, severity filter pills, plain-English explanations, and evidence quotes fuzzy-matched and highlighted in place (including inside markdown tables and headings)
  • Obligations tab — extracts the concrete commitments and deadlines buried in the contract and turns them into calendar actions
  • Payments and tier gating — Stripe Checkout for one-off reviews, subscriptions for the Pro tier, Customer Portal, and a webhook handler keeping entitlements in sync behind a free-tier allowance
  • Lawyer directory — profiles with specializations, jurisdictions and rates, a contact-request flow tied to specific contracts, and transactional email
  • Split marketing site and authenticated app across subdomains — auth entry points, CORS and session flow built so the two read as one product
  • Groundwork for real-time collaboration — a Tiptap + Hocuspocus (Yjs) collaborative editor server for redlining together, gated to higher tiers

How it works

Hypotheses, not "find problems"

Rather than asking a model to find issues, the engine tests each contract against a curated library of expert-written hypotheses about what a fair music contract should and shouldn't contain. Each is classified as entailed, contradicted, or not mentioned.

The model classifies, the code scores

Risk scores are computed from a fixed flag-weight table over hypothesis outcomes — explainable and comparable across contracts. A deliberate move away from vibes-based LLM scoring.

Missing protections get flagged

Because every hypothesis is tested explicitly, a protection that simply isn't in the contract is surfaced as a finding — not silently passed over the way a "spot the bad clause" prompt would.

Versioned rubric

The hypothesis library is content-hashed, so every analysis records exactly which rubric produced it. The same contract gets the same rubric every time, and past results stay interpretable.

Prompt caching and parallel sharding

The contract is warmed into the model's prompt cache once, then three sharded analysis calls plus formatting and obligation extraction reuse it in parallel. The contract text is paid for once — a major cut to both latency and token cost.

Retry-safe orchestration

Every expensive step is memoized with an up-front idempotency check, retry caps and singleton concurrency, so a retry never redoes completed work and never double-bills. Built after learning what an unguarded retry storm costs.

Evidence you can see

Findings are anchored to the document: quotes are fuzzy-matched back into the formatted contract and highlighted in place, so a user can check the claim against the source text rather than trusting a summary.

Security posture

Row Level Security on all seven tables, service-role access confined to server-side jobs, Zod validation on every API payload, strict TypeScript with no any, and secrets exclusively via environment variables.

Outcome

Analysis in minutes
100+ hypothesis rubric
Deterministic risk score

A live SaaS product: marketing site and authenticated application, running the full path from upload through analysis, review, obligations, payment and lawyer referral.

My role

Sole developer across the whole product: auth and data model, ingestion and extraction, the analysis engine and its scoring rubric, the background pipeline, the review interface, Stripe billing and tier gating, the lawyer directory and transactional email, and deployment. The hypothesis library was developed in collaboration with a music-industry domain expert.

Client anonymized for privacy: product name, domains and identifying details have been removed. Diagram is illustrative and contains no client or user data. More technical depth available under NDA on request.

Building something like this?

Book a discovery call to scope your platform.

Book Discovery Call