LegaLens — AI-Powered Legal Document Analyzer
Understand and negotiate legal agreements without an expensive lawyer.
💡 Inspiration
Legal documents are everywhere: housing leases, loan agreements, employment contracts. Yet most people sign them without fully understanding the risks—or without reading them at all. These documents often hide obligations or clauses that heavily favour one party. We wanted to build a tool that empowers everyday people to understand and negotiate legal agreements on their own. So we built LegaLens.
✨ What it does
LegaLens is an AI-powered legal document analyzer. Users upload a legal document (e.g. a lease or agreement), and the platform:
- Extracts and parses the document text
- Breaks the document into structured clauses
- Analyzes each clause for legal risk and predatory patterns
- Validates findings against relevant laws using retrieval-based analysis
- Generates plain-language summaries of complex sections
- Suggests negotiation strategies for problematic clauses
🛠️ How we built it
- Frontend — We built a responsive interface using React, TypeScript, and Tailwind CSS. The frontend is deployed on Vercel.
- Backend — FastAPI on Google Cloud (Cloud Run), with Auth0 for auth and Supabase for storage. We use Gemini and LangChain for AI, with a RAG pipeline over a legal knowledge base. Real-time voice is powered by ElevenLabs and Picovoice for wake-word.
🧗 Challenges we ran into
- Clause parsing — Accurately parsing legal documents into meaningful clauses was tough. Legal formatting varies widely, and poorly structured PDFs or OCR text made consistent extraction difficult.
- Hallucinations — We had to prevent the AI from making up legal claims. We integrated a RAG pipeline so that analysis could reference real legal material instead of relying purely on generative reasoning.
- Voice + React — When we added real-time voice with ElevenLabs, the UI would often crash when a conversation session started. The issue came from the interaction between the React frontend and streaming audio responses from the ElevenLabs API.
- Async pipeline — Connecting the frontend to the asynchronous AI processing pipeline required careful backend design to keep the system responsive.
🏆 Accomplishments that we're proud of
We’re proud that LegaLens goes beyond simple document summarization and delivers structured legal reasoning:
- A full end-to-end AI pipeline for contract analysis
- A multi-agent architecture for legal reasoning
- Legal validation through RAG instead of pure LLM output
- Actionable negotiation suggestions for risky clauses
- A clean interface that makes complex legal analysis accessible
Most importantly, we built a system that helps users challenge unfair contracts instead of blindly accepting them.
📚 What we learned
Building reliable AI systems takes more than calling a language model API. We learned:
- How to design AI pipelines instead of single prompts
- How to use RAG to ground AI responses in real data
- How to handle messy real-world documents
- How to coordinate multiple AI agents for specialized reasoning
- How to build scalable AI applications with modern web infrastructure
- How important explainability is in high-stakes domains like law
🚀 What's next for LegaLens
- Expand the legal knowledge base — Add jurisdiction-specific laws and consumer protections to our RAG system.
- Contract comparison — Let users compare multiple agreements and identify the safest option.
- Contract simulation — Let users see potential financial outcomes of different clauses over time.
- Personal AI legal assistant — Help users review contracts in real time before signing.
Our goal is to help people understand legal agreements efficiently and stay safer when signing documents.
Built With
- auth0
- blackboard.io
- elevenlabs
- fastapi
- gemini
- google-cloud
- javascript
- langchain
- picovoice
- python
- react
- tailwindcss
- typescript
- vercel



Log in or sign up for Devpost to join the conversation.