Inspiration

Most SMEs and startup founders lack the budget for a permanent legal team, yet they sign complex agreements every day—vendor contracts, NDAs, and employment terms. A single overlooked "indemnity" or "termination" clause can have catastrophic consequences. We were inspired to build ContractLens to democratize legal protection, giving every small business the "eyes" of a senior legal counsel for a fraction of the cost and time.

What it does

ContractLens is an AI-powered legal Swiss Army knife. It allows users to:

  • Scan Diverse Formats: Upload PDFs, Word docs, Images, or even raw CSV/text files.
  • Detect Hidden Risks: Automatically identifies aggressive, one-sided, or ambiguous clauses.
  • Translate Legalese: Explains complex legal jargon in plain, actionable English.
  • Suggest Rewrites: Provides "Balanced" versions of risky clauses that protect the user without being "deal-breakers."
  • Visualize Changes: Offers a side-by-side diff comparison showing exactly what was added or removed in the suggested rewrite.

How we built it

The project is built on a modern full-stack architecture:

  • Frontend: Next.js 15 with App Router, utilizing Tailwind CSS for a high-fidelity "dark mode" aesthetic and motion for fluid animations.
  • AI Core: Powered by Google Gemini 1.5 Pro. We utilized structured JSON schema prompts to ensure the AI identifies specific risks and provides consistent data structures for our UI.
  • Processing: Custom server actions handle file parsing using pdf-parse and mammoth (for Word documents).
  • Comparison Engine: Used the diff library to generate word-level comparisons between original and suggested clauses.
  • UX: Implemented react-joyride for interactive onboarding and a custom SVG-animated splash screen.

Challenges we ran into

The primary challenge was consistent data extraction. Legal documents are notoriously messy. Extracting clean text from a scanned image (OCR) versus a structured Word doc required different strategies. We also faced the challenge of "hallucination management" in legal contexts—it was critical to ensure the AI's suggestions stayed within the realm of "fair trade" rather than making impossible legal claims.

Accomplishments that we're proud of

  • The Diff Viewer: Creating a intuitive way to see legal changes was a major win. By highlighting exactly what words changed, we make legal review feel like a simple code review.
  • The "Bento-Style" Dashboard: We managed to pack a risk summary, clause breakdown, and full document view into a single screen that doesn't feel cluttered.
  • Speed: The app processes entire documents and returns a categorized risk report in under 5 seconds.

What we learned

We learned that in the legal world, context is king. A clause that is "High Risk" in a vendor contract might be "Normal" in an employment agreement. We also discovered that users value "Security" not just in the code, but in the visual language of the app—using high-contrast iconography and deep, authoritative colors (Indigos and Neutrals) helped build immediate trust.

What's next for ContractLens

  • Multi-user Collaboration: Allowing a founder and their external lawyer to comment on the AI's suggestions directly.
  • Industry-Specific Profiles: Selecting a "Real Estate" or "SaaS" profile to get even more targeted risk detection.
  • API Integrations: A "ContractLens for Slack" bot that scans shared legal PDFs automatically.
  • International Law Support: Fine-tuning the model to understand the nuances between US, EU, and UK contract law.

Built with ❤️ for SME empowerment.

Built With

  • and
  • cloud
  • diff
  • google
  • google-gemini-1.5-pro-api-(@google/genai)
  • lucide-react
  • mammoth
  • motion-(framer-motion)
  • next.js-15
  • node.js
  • pdf-parse
  • react-joyride
  • tailwind-css
  • typescript
Share this project:

Updates