Inspiration
Millions of people sign contracts they don't understand, leading to unexpected fees and unfavorable terms. I wanted to build an AI assistant that instantly identifies risky clauses and answers questions in plain language. AWS Bedrock's Nova LLM made this possible.
What it does
LegalLens analyzes contracts in three ways:
- Risk Classification (🔴🟡🟢) - Flags dangerous clauses, cautions, and safe terms
- Natural Language Q&A - Answer questions grounded in actual contract text
- Semantic Search - Find relevant clauses using plain English
Impact: 50-page contract review → 40 seconds analysis + 3-second answers
How I built it
I engineered a RAG pipeline with AWS Bedrock:
Tech Stack:
- Frontend: React 18 + Vite
- Backend: Express.js + TypeScript
- AI: Bedrock Nova-lite (classification & Q&A), Titan Embed v2 (vectors)
- Storage: ChromaDB (vector database)
Pipeline: PDF → Text extraction → Chunking → Embedding → Classification → Q&A
Challenges I ran into
- JSON Parsing - Nova wrapped responses in markdown. Fixed with regex stripping + fallback.
- Performance - Sequential classification was slow. Solved with Promise.all() parallelization (5x speedup).
- LLM Grounding - Answers were generic. Fixed by passing top-5 relevant chunks as context.
- ChromaDB Stability - SDK conflicts. Switched to direct HTTP API calls.
Accomplishments I'm proud of
✅ Full end-to-end product (all 3 features working) ✅ Production-quality code (TypeScript strict, error handling) ✅ 40-second document processing, 3-second Q&A response ✅ Proper RAG implementation (no hallucinations) ✅ Comprehensive documentation
What I learned
- RAG requires careful chunking and context management
- LLMs need defensive JSON parsing with fallbacks
- Vector databases are incredibly powerful
- Parallelization yields massive performance gains
- Grounding answers in source text builds user trust
What's next for LegalLens
Short term: B2B SaaS for legal teams, batch API, custom risk categories
Long term: Fine-tuned Nova models, multi-language support, platform integrations
Business model: Freemium (5 docs/month) → Pro ($29/mo) → Enterprise (custom)
One sentence: AI-powered contract analyzer using AWS Bedrock Nova, turning 2-hour reviews into 40-second analysis with instant Q&A.
Built With
- aws-bedrock-(nova-lite-&-titan-embed-v2)
- chromadb
- express.js
- langchain
- react-18
- typescript
Log in or sign up for Devpost to join the conversation.