Problem Statement: Legal documents are complex and inaccessible to the general public, creating barriers to understanding rights, obligations, and risks.
Our Solution: An AI-powered platform that transforms complex legal documents into clear, actionable insights using Google Cloud AI technologies.
Impact: Democratizing access to legal information and empowering individuals to make informed decisions.
Transform complex legal documents into clear, actionable insights with our AI-powered platform. Built for the GenAI Exchange Hackathon with enterprise-grade design and functionality.
- Event: GenAI Exchange Hackathon
- Organizer: Google Cloud & Hack2Skill
- Track: Professional Track
- Team: Legal AI (Harshad Agrawal, Parth Kosthi, Krrish Talesara)
Our solution addresses the critical need for accessible legal information by:
- analysis using AI
- barriers to legal understanding for general public
- insights from legal contracts and agreements
- access to legal expertise through AI-powered assistance
- API - Advanced natural language processing for legal text analysis
- AI - Machine learning models for risk assessment and clause classification
- Run - Scalable backend deployment for document processing
- Firebase - Real-time data synchronization and user management
- BigQuery - Data analytics for legal document insights
- Understanding - Context-aware legal text processing
- Visualization - Color-coded risk indicators with detailed explanations
- Interface - Conversational AI for document-specific questions
- Generation - Automated legal analysis summaries
- UI - Enterprise-grade user experience design
- Document Analysis - Advanced AI-powered legal document processing
- Risk Assessment - Intelligent clause risk evaluation with color-coded indicators
- Clause Explorer - Interactive expandable interface for document navigation
- Q&A Assistant - Modern chat interface with AI legal expert
- Visual Dashboard - Beautiful animated metrics and data visualization
- Report Generation - Professional downloadable analysis reports
- Drag & Drop Upload - Smooth file upload with real-time progress
- Responsive Design - Mobile-first approach with TailwindCSS
- Smooth Animations - Framer Motion micro-interactions
- Glass Morphism - Modern premium visual effects
- shadcn/ui Components - Consistent, accessible design system
- React 18 + TypeScript - Modern component architecture
- TailwindCSS - Utility-first styling with custom design tokens
- shadcn/ui - Premium component library
- Framer Motion - Smooth animations and transitions
- Zustand - Lightweight state management
- Recharts - Beautiful data visualization
- FastAPI - High-performance Python web framework
- Google Cloud Platform - Document AI + Vertex AI integration
- PostgreSQL - Robust data persistence
- Docker - Containerized deployment
- Run - Serverless scaling
- 18+ and npm
- 3.9+ and pip
- Git for version control
# Clone the repository
git clone https://github.com/Harshad2321/Legal-AI-Simplifier
cd Legal-AI-Simplifier
# Install frontend dependencies
cd frontend
npm install --legacy-peer-deps
# Install backend dependencies
cd ../backend
pip install -r requirements.txt# Backend environment
cd backend
cp .env.example .env
# Edit .env with your Google Cloud credentials
# Start backend server
python -m uvicorn app.main:app --reload --port 8080# Start frontend (in new terminal)
cd frontend
npm start
# Opens at http://localhost:3000# Build and deploy to GitHub Pages
cd frontend
npm run deployLive Demo: https://harshad2321.github.io/Legal-AI-Simplifier
- Create feature branch:
git checkout -b feature/your-feature-name - Make changes and test locally
- Commit with description:
git commit -m "Add feature description" - Push branch:
git push origin feature/your-feature-name - Create Pull Request for team review
- TypeScript - Strict typing for reliability
- Prettier - Consistent code formatting
- Component-driven - Reusable UI components
- Mobile-first - Responsive design approach
Legal-AI-Simplifier/
frontend/ # React TypeScript app
src/
components/ # Reusable UI components
pages/ # Main application pages
services/ # API integration layer
store/ # Zustand state management
types/ # TypeScript definitions
public/ # Static assets
backend/ # FastAPI Python server
app/
routers/ # API endpoint definitions
services/ # Business logic layer
schemas.py # Data models
requirements.txt # Python dependencies
README.md # This file
- Page - Drag-and-drop file upload with progress
- ** Dashboard** - Animated metrics and document overview
- Explorer - Interactive document navigation
- Chat - AI assistant conversation interface
- Download - Customizable report generation
- Library - Button, Card, Input, Progress, Badge, Accordion
- States - Skeleton screens and spinners
- Indicators - Color-coded risk level badges
- Layout - Mobile-optimized grid system
POST /api/documents/upload- File upload processingGET /api/documents/{id}- Document retrievalDELETE /api/documents/{id}- Document deletion
POST /api/analysis/extract-clauses- Clause extractionPOST /api/analysis/assess-risk- Risk assessmentPOST /api/analysis/generate-summary- Document summaryPOST /api/analysis/ask-question- Q&A functionality
- Upload - Smooth drag-and-drop with animations
- Dashboard - Beautiful cards with hover effects
- Explorer - Expandable accordion interface
- UI - Typing indicators and message animations
- Generation - Professional download interface
- Design - Mobile-optimized layouts
- States - Skeleton screens and progress indicators
- Handling - User-friendly error messages
- Deployment - Automatic deployment on push to main
** Live Demo**: https://harshad2321.github.io/Legal-AI-Simplifier
- Property name alignment in Document interface
- formatFileSize utility function export
- Alert severity property definition
- Add React Router for multi-page navigation
- Implement real API integration
- Add user authentication
- Enhanced mobile responsiveness
- Additional animation polish
- Implement progressive web app (PWA) features
| Harshad Agrawal | Parth Kosthi | Krrish Talesara |
|---|---|---|
| Full-Stack Dev & AI Integration | Full-Stack Dev & UI/UX Design | Full-Stack Dev & Backend Architecture |
| harshad.agrawal2005@gmail.com | parth.kosthi.btech2024@sitpune.edu.in | krrish.talesara.btech2024@sitpune.edu.in |
- All team members contributed equally to this project - from ideation to deployment!*
- Contact: harshad.agrawal2005@gmail.com
- Issues: Report bugs or request features
- ** Documentation**: Available in this README and code comments
Built for hackathon - Open source for educational purposes.
This project demonstrates:
- UI/UX that rivals top startups
- architecture with TypeScript
- integration for document processing
- design for all devices
- quality with proper structure
- deployment for live demonstration
** Live Demo**: https://harshad2321.github.io/Legal-AI-Simplifier
**Ready to impress judges and win! **
Built with for the Google Cloud AI Hackathon by Team Legal AI
Contact: harshad.agrawal2005@gmail.com
- Upload: PDF, DOCX, TXT support with drag-and-drop
- Analysis: Summary, clause extraction, risk assessment
- Support: English, Hindi, Spanish, French summaries
- Q&A: Ask questions about your documents
- Alerts: Automated detection of risky clauses
- Dashboard: Beautiful, intuitive interface
React Frontend FastAPI Backend Google Cloud
(TypeScript) (Python) Services
Tailwind FAISS Vertex AI
CSS Vector DB Cloud Store
Firestore
- Node.js 18+ and npm
- Python 3.11+
- Account with billing enabled
- Docker (optional, for containerized deployment)
git clone https://github.com/Harshad2321/Legal-AI-Simplifier.git
cd Legal-AI-Simplifiercd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Setup environment
cp .env.example .env
# Edit .env with your Google Cloud project settings
# Run backend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8080cd frontend
# Install dependencies
npm install
# Start development server
npm start# Install Google Cloud CLI
# https://cloud.google.com/sdk/docs/install
# Authenticate
gcloud auth application-default login
# Set project
gcloud config set project YOUR_PROJECT_ID
# Enable APIs
gcloud services enable run.googleapis.com
gcloud services enable storage.googleapis.com
gcloud services enable firestore.googleapis.com
gcloud services enable aiplatform.googleapis.com
gcloud services enable translate.googleapis.com
# Create storage bucket
gsutil mb gs://legal-ai-documents-YOUR_PROJECT_IDbackend/
app/
main.py # FastAPI application
config.py # Configuration management
schemas.py # Pydantic models
routers/
documents.py # Document management
analysis.py # AI analysis endpoints
services/
gcp_client.py # Google Cloud integration
document_processor.py # Text processing
vector_store.py # FAISS vector operations
requirements.txt # Python dependencies
Dockerfile # Container configuration
deploy.sh # Cloud Run deployment
frontend/
src/
components/ # Reusable UI components
pages/ # Main application pages
services/ # API integration
types/ # TypeScript type definitions
config/ # Configuration constants
App.tsx # Main application component
package.json # Node.js dependencies
tailwind.config.js # Tailwind CSS configuration
POST /api/v1/documents/upload- Upload documentGET /api/v1/documents/list- List documentsGET /api/v1/documents/{id}- Get document detailsDELETE /api/v1/documents/{id}- Delete documentGET /api/v1/documents/{id}/status- Processing status
POST /api/v1/analysis/{id}/summarize- Generate summaryPOST /api/v1/analysis/{id}/clauses- Extract clausesPOST /api/v1/analysis/{id}/ask- Ask questionsPOST /api/v1/analysis/{id}/alerts- Get risk alerts
// Upload document
const formData = new FormData();
formData.append('file', file);
const response = await fetch('/api/v1/documents/upload', {
method: 'POST',
body: formData
});
// Get summary
const summary = await fetch(`/api/v1/analysis/${documentId}/summarize`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
document_id: documentId,
language: 'hi', // Hindi summary
max_length: 500
})
});- Upload Demo: Drag & drop a legal contract (PDF/DOCX)
- Real-time Processing: Show live status updates
- Multi-language Summary: Generate in English and Hindi
- Risk Analysis: Highlight critical clauses with color coding
- Interactive Q&A: Ask "What are my payment obligations?"
- Smart Alerts: Show automated risk warnings
- "What are the termination conditions?"
- "What penalties might I face?"
- "What are my financial obligations?"
- "Are there any unusual clauses I should worry about?"
cd backend
chmod +x deploy.sh
./deploy.sh# Backend
cd backend
docker-compose up -d
# Frontend
cd frontend
npm run build
# Serve with your preferred static file serverGOOGLE_CLOUD_PROJECT_ID=your-project-id
GOOGLE_CLOUD_STORAGE_BUCKET=legal-ai-documents
GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json
DEBUG=False
LOG_LEVEL=INFO
FRONTEND_URL=https://your-frontend-domain.comREACT_APP_API_BASE_URL=https://your-backend-url.com
REACT_APP_DEMO_MODE=falsecd backend
python test_api.pycd frontend
npm test# Test complete flow
1. Upload document via frontend
2. Wait for processing
3. Test all analysis features
4. Verify API responsesEdit backend/app/services/document_processor.py:
self.risk_patterns = {
"high": [
r"penalty|penalties|fine|fines",
r"your_new_pattern_here",
# Add more patterns
]
}- Update
LANGUAGESinfrontend/src/config/constants.ts - Ensure Google Translate supports the language
- Test with sample documents
Edit frontend/tailwind.config.js for theme changes:
module.exports = {
theme: {
extend: {
colors: {
primary: {
// Your brand colors
}
}
}
}
}# Check Python version
python --version # Should be 3.11+
# Check dependencies
pip install -r requirements.txt
# Check Google Cloud authentication
gcloud auth application-default login# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
# Check Node.js version
node --version # Should be 18+- Verify backend is running on port 8080
- Check CORS settings in
backend/app/main.py - Ensure frontend proxy is configured
- Verify project ID in environment variables
- Check API enablement:
gcloud services list --enabled - Verify service account permissions
- processing: Document analysis runs in background
- caching: FAISS index persisted to disk
- pooling: Reuse GCP client connections
- management: Chunked processing for large documents
- splitting: React.lazy() for route-based splitting
- optimization: WebP format with fallbacks
- Caching: Service worker for offline functionality
- analysis: webpack-bundle-analyzer for optimization
- validation: Pydantic schemas for all endpoints
- validation: MIME type checking
- limits: 10MB max file size
- handling: No sensitive information in error messages
- protection: React's built-in sanitization
- protection: CORS configuration
- variables: No secrets in client-side code
- Backend:
GET /health - Service status monitoring
- Error rate tracking
- Performance metrics
# Backend logs
tail -f logs/app.log
# Frontend console
console.log('User action:', action);- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- Backend: Black formatting, type hints, docstrings
- Frontend: ESLint, Prettier, TypeScript strict mode
- Tests: Minimum 80% coverage
- Documentation: Update README for new features
- Functional Prototype - Working demo with full AI capabilities
- Google Cloud Integration - Backend deployed on Cloud Run with AI services
- Live Demo - https://harshad2321.github.io/Legal-AI-Simplifier
- Source Code - Public GitHub repository with clean, documented code
- Comprehensive Documentation - Detailed README with setup instructions
- Real-world Impact - Addresses genuine legal accessibility challenges
- Scalable Architecture - Enterprise-ready design patterns
- Frontend: React 18 + TypeScript + TailwindCSS
- Backend: Python FastAPI + Google Cloud AI
- Database: Cloud Firestore for document storage
- Services: Gemini API + Vertex AI for document processing
- Deployment: Cloud Run (Backend) + GitHub Pages (Frontend)
3-Minute Demo Video: [Coming Soon]
- Live demonstration of document upload and analysis
- AI-powered clause extraction and risk assessment
- Interactive Q&A with legal documents
- Report generation and download functionality
This project is licensed under the MIT License - see the LICENSE file for details.
- Cloud for AI and infrastructure services
- Hackathon for the platform and opportunity
- React and FastAPI communities for excellent frameworks
- shadcn/ui for beautiful component library
Built for: GenAI Exchange Hackathon
Team Members: Harshad Agrawal, Parth Kosthi, Krrish Talesara
Contact: harshad.agrawal2005@gmail.com
Repository: https://github.com/Harshad2321/Legal-AI-Simplifier
Disclaimer: This is AI assistance, not legal advice. Always consult with qualified legal professionals for important legal matters.