LegalEasy

Inspiration

Contracts, terms of service, and NDAs are notoriously dense, filled with archaic jargon that overwhelms anyone without a law degree. We've all been guilty of scrolling to the bottom of a massive document and blindly clicking "I Agree." As developers fascinated by extracting intelligence from unstructured data, we saw an opportunity to bridge the gap between complex legal text and everyday comprehension. We built LegalEasy to democratize legal understanding, allowing anyone to instantly summarize massive documents, assess potential liabilities, and make informed decisions with confidence.


What It Does

LegalEasy is a full-stack, AI-powered legal assistant that automates document review.

  • Intelligent Analysis: Users can upload legal documents to instantly receive a plain-English summary, a clause-by-clause breakdown, and a categorized risk assessment (Low, Medium, High).
  • Document Comparison: Provides intelligent, side-by-side comparisons of two documents (like a standard contract vs. a redlined version) to highlight advantages, disadvantages, and critical alterations.
  • Risk Dashboard: Tracks historical document data and visualizes risk distributions over time.

To ensure our risk assessment wasn't just subjective AI guesswork, we implemented an objective, weighted mathematical model behind the scenes. The normalized overall document risk score, $R_{total}$, is calculated as:

$$R_{total} = \frac{1}{N_{total}} \sum_{i=1}^{n} \left( \alpha \cdot S_i + \beta \cdot F_i \right)$$

Where:

  • $n$ = number of flagged clauses
  • $S_i$ = AI-determined severity of the $i$-th clause
  • $F_i$ = financial/legal impact factor
  • $\alpha, \beta$ = tuned hyperparameters to prevent false alarms

How We Built It

We architected LegalEasy as an end-to-end, fully type-safe application managed within a pnpm monorepo.

Layer Technology
Frontend React 18, Vite, Tailwind CSS, shadcn/ui, Orval
Backend Node.js, Express, TypeScript, Multer
Shared Architecture Zod validation schemas, OpenAPI specifications
Database Drizzle ORM (analyses, conversations, messages)
AI Integration Custom OpenAI

Challenges We Ran Into

  • Real-time data flow for voice and audio capabilities — managing audio-playback worklets on the frontend and synchronizing them with the backend AI client required precise state management and stream handling.
  • Fine-tuning the risk model ($R_{total}$) — balancing weights so the system accurately flagged critical legal loopholes without generating false "High Risk" errors for standard boilerplate clauses required strict prompt engineering and data validation.

Accomplishments We're Proud Of

  • End-to-end type safety — by strictly enforcing OpenAPI specs and shared Zod schemas across the monorepo, we virtually eliminated runtime type errors, making the codebase robust and scalable.
  • Seamless voice interaction — chatting with a complex legal PDF as if it were a consultant delivers a genuinely magical user experience.

What We Learned

Building LegalEasy significantly improved our system architecture skills, particularly in managing a modern monorepo workspace. Key learnings include:

  • Deeply integrating API specifications into the build pipeline to keep frontend and backend in sync
  • Managing database schemas with Drizzle ORM
  • Mastering the Web Audio API for real-time OpenAI voice streaming

What's Next for LegalEasy

  • Jurisdiction-Specific Tuning — fine-tuning models or using advanced RAG (Retrieval-Augmented Generation) to analyze documents based on specific state or national laws.
  • E-Signature Integration — integrating with platforms like DocuSign so users can analyze, approve, and sign contracts in one seamless workflow.
  • Multi-language Support — expanding translation capabilities to analyze and compare contracts across different languages, aiding international business agreements.

Built With

Share this project:

Updates