Inspiration
The inspiration for ContractClarity AI stems from the “Terms and Conditions” fatigue that plagues the digital age. Most people sign employment agreements, rental contracts, and service terms without truly understanding the implications of the fine print.
Legal jargon acts as a barrier to accessibility, often hiding one-sided clauses or significant risks. We wanted to build a tool that democratizes legal understanding, transforming dense, intimidating documents into clear, actionable, and human-friendly insights.
What We Learned
Building this project highlighted the immense power of Retrieval-Augmented Generation (RAG), specifically through Gemini’s Google Search grounding.
We learned that while large language models are excellent at summarization, grounding them in real-time legal standards and industry norms is what turns a generic summary into a robust professional analysis.
We also gained deep insights into client-side performance. Offloading PDF parsing to the browser using pdf.js significantly improves scalability and user privacy compared to traditional server-side processing.
How We Built It
ContractClarity AI is a modern React 19 application built with a strong focus on speed, aesthetics, and real-world utility.
Frontend
Built with TypeScript and React, using a component-based architecture to maintain clean state management across the landing, upload, and results views.
Styling
Tailwind CSS was used to create a professional SaaS aesthetic, featuring smooth transitions, subtle parallax scroll effects, and a fully responsive layout.
AI Core
The heart of the application is the Gemini 3 Pro model. We designed a strict system instruction set that forces the model to behave as a neutral, non-alarmist contract explainer rather than a legal advisor.
Grounding
Google Search grounding was integrated to ensure the AI evaluates whether contract clauses are standard or unusually aggressive based on current real-world legal benchmarks.
Document Processing
pdf.js is used for client-side text extraction, while html2pdf.js generates high-quality, print-ready PDF reports directly in the browser.
Challenges We Faced
PDF Complexity
Not all PDFs are created equal. Supporting multi-page documents and ensuring accurate text extraction without exceeding API payload limits required a shift to client-side parsing.
AI Reliability
Legal explanations demand high precision. We reduced hallucination risks by enforcing strict JSON schemas and implementing multi-attempt retry logic with exponential backoff.
UI and UX of Exporting
Designing a web interface is straightforward, but producing a professional-looking PDF required careful use of CSS print media queries to ensure page breaks occurred in logical, readable places.
Built With
- css3
- gemini-3-pro-preview
- google-gemini-api
- google-search-grounding
- html2pdf.js
- html5
- javascript
- react
- react-19
- tailwind-css
- typescript
Log in or sign up for Devpost to join the conversation.