Upload any contract → AI flags illegal clauses, writes counter-clauses, gives a Sign/Don't Sign verdict, and trains you to negotiate. Free legal protection for everyone.
Every year, millions of Indians sign rental agreements, employment contracts, NDAs, and loan documents they don't understand. Legal review costs ₹2,000–₹10,000 per document — 92% of people can't afford it. They sign anyway.
A clause that violates the Indian Contract Act. A non-compete that is legally unenforceable. A deposit clause designed to never be returned. Signed. Every day. By people who just didn't know.
LexAI fixes that.
Flags clauses that violate actual Indian law — not just "risky," but legally unenforceable — with specific Act name and section number.
Covers: Indian Contract Act §23/§27 · IT Act §43/§72 · Rent Control Acts · Industrial Disputes Act · Consumer Protection Act 2019
A clear decision — not a score:
- ✅
SAFE TO SIGN— no critical issues ⚠️ DO NOT SIGN YET— fix these 3 clauses first- 🚫
DO NOT SIGN— serious illegal content
For every risky clause, LexAI writes ready-to-send alternative wording the user can demand from the other party.
AI plays the landlord, employer, or client. You practice your pushback. After 3 rounds, AI gives a negotiation debrief and outcome score.
Upload old + new contract. AI diffs every clause — what changed, what disappeared, and whether each change hurts or helps you.
Visual timeline of when each clause activates over the contract period. The auto-renewal that fires in month 10. The rent hike trigger in month 6.
Compares your clauses against 200+ real Indian contracts. "Your 90-day notice period is above market for 73% of similar IT roles."
Rights violated after signing? LexAI generates a proper Indian legal notice — correct citations, 15-day deadline, court-ready language.
Full Hindi explanations + Text-to-Speech on every clause. Works on ₹8,000 Android phones.
| Verdict Banner | Clause Analysis | Danger Timeline |
|---|---|---|
![]() |
![]() |
![]() |
| Negotiation Roleplay | Contract Compare | Dispute Letter |
|---|---|---|
![]() |
![]() |
![]() |
| Layer | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 14 (App Router) | UI + API routes in one project |
| Styling | Tailwind CSS | Fast, responsive design |
| Primary LLM | Groq LLaMA 3.1 70B | Sub-1s clause analysis + negotiation |
| Vision / OCR | Google Gemini 1.5 Flash | PDF → text extraction |
| Database | MongoDB Atlas | Documents, clauses, benchmark data |
| Deployment | Vercel | Auto-deploy from GitHub |
| Voice | Web Speech API | Browser-native TTS + mic input |
User Browser (Next.js 14 PWA)
│
├── /analyze → Upload + full analysis workspace
├── /compare → Contract version diff
├── /roleplay → Negotiation simulator
├── /dispute → Legal notice generator
└── /history → Past analyzed documents
│
▼
Next.js API Routes
│
├── /api/parse-document → Gemini: PDF → raw text
├── /api/analyze-clauses → Groq: master analysis JSON
├── /api/counter-clause → Groq: alternative clause wording
├── /api/compare-contracts → Groq: old vs new diff
├── /api/negotiation-chat → Groq: SSE streaming roleplay
├── /api/benchmark-clause → MongoDB + Groq comparison
├── /api/dispute-letter → Groq: legal notice draft
└── /api/documents → MongoDB CRUD
│
├── Groq LLaMA 3.1 70B (analysis, negotiation, letters)
├── Gemini 1.5 Flash (PDF parsing)
└── MongoDB Atlas (storage + 200 benchmark clauses)
- Node.js >= 18.0.0
- npm >= 9.0.0
- MongoDB Atlas account (free)
- Groq API key (free)
- Google Gemini API key (free)
# 1. Clone the repo
git clone https://github.com/yourusername/lexai.git
cd lexai
# 2. Install dependencies
npm install
# 3. Set up environment variables
cp .env.example .env.local
# Fill in your API keys (see below)
# 4. Seed benchmark database
node scripts/seed-benchmarks.js
# 5. Run development server
npm run devCreate a .env.local file in the root directory:
# MongoDB Atlas
# Get from: cloud.mongodb.com → Connect → Drivers
MONGODB_URI=mongodb+srv://USERNAME:PASSWORD@cluster0.xxxxx.mongodb.net/lexai
# Groq (Free: 14,400 req/day)
# Get from: console.groq.com/keys
GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Google Gemini (Free: 1,500 req/day)
# Get from: aistudio.google.com/app/apikey
GEMINI_API_KEY=AIzaSyXXXXXXXXXXXXXXXXXXXXXX
# App
NEXT_PUBLIC_APP_URL=http://localhost:3000
NEXTAUTH_SECRET=your_64_char_random_secret| Service | URL | Free Limit |
|---|---|---|
| Groq | console.groq.com/keys | 14,400 req/day · 30 RPM |
| Gemini | aistudio.google.com/app/apikey | 1,500 req/day · 15 RPM |
| MongoDB | cloud.mongodb.com | 512MB free M0 cluster |
lexai/
├── app/
│ ├── layout.jsx # Root layout
│ ├── page.jsx # Landing page
│ ├── analyze/page.jsx # ★ Main analysis workspace
│ ├── compare/page.jsx # Contract version diff
│ ├── roleplay/page.jsx # Negotiation simulator
│ ├── dispute/page.jsx # Dispute letter generator
│ ├── history/page.jsx # Past documents
│ └── api/ # All API routes
│
├── components/
│ ├── VerdictBanner.jsx # Sign / Don't Sign banner
│ ├── ClauseCard.jsx # Expandable clause card
│ ├── DangerTimeline.jsx # Visual clause timeline
│ ├── NegotiationChat.jsx # Roleplay chat UI
│ ├── DiffViewer.jsx # Contract compare view
│ └── ... # Other components
│
├── lib/
│ ├── mongodb.js # DB connection
│ ├── groq.js # Groq client
│ ├── gemini.js # Gemini client
│ └── prompts.js # All LLM prompts
│
├── models/ # Mongoose schemas
├── scripts/
│ └── seed-benchmarks.js # Seeds 200 Indian contract clauses
│
├── .env.example # Environment template
└── package.json
{
"next": "14.2.0",
"groq-sdk": "^0.7.0",
"@google/generative-ai": "^0.17.0",
"mongoose": "^8.4.0",
"recharts": "^2.12.0",
"lucide-react": "^0.400.0",
"tailwindcss": "^3.4.0"
}# Install Vercel CLI
npm i -g vercel
# Deploy
vercel
# After deploy, add env vars in:
# Vercel Dashboard → Project → Settings → Environment VariablesAdd all variables from .env.local in the Vercel dashboard, then redeploy.
- PDF upload + Gemini text extraction
- Illegal clause detection with Indian law citations
- Sign / Don't Sign verdict
- Counter-clause generator
- Negotiation roleplay simulator
- Contract version comparator
- Clause danger timeline
- Benchmark engine (200 seeded clauses)
- Dispute letter generator
- Hindi + voice support
- Regional languages (Marathi, Telugu, Tamil)
- WhatsApp bot integration
- Lawyer connect (30-min paid consultation)
- B2B API for real-estate platforms
- Community red flags (crowdsourced clause warnings)
LexAI provides legal information, not legal advice. It is not a substitute for professional legal counsel. Always consult a qualified lawyer for important legal decisions. Illegal clause detection is based on publicly available Indian law and should be independently verified for your specific situation.
Built with ❤️ at TerraCode Convergence 2026
| Name | Role |
|---|---|
| Yashodip More | Full Stack + AI |
| Teammate | Frontend + Design |
MIT License — see LICENSE for details.
LexAI · TerraCode Convergence 2026
"Harvey AI serves law firms. LexAI serves you."






