AI-powered legal document analysis platform that simplifies complex legal documents, provides intelligent summaries, and offers chatbot-based assistance.
Legal documents are often difficult for ordinary users to understand because of legal jargon and lengthy clauses.
LegalEase helps users by:
- Simplifying complex legal language
- Generating concise summaries
- Highlighting risks and important clauses
- Providing AI-powered legal assistance
- Improving accessibility and understanding
- About LegalEase
- Live Demo
- Features
- Screenshots
- Technology Stack
- Project Structure
- Installation
- Usage
- Testing
- Configuration
- Tailwind Theme Guide
- Security
- Contributing
- Code of Conduct
- Future Enhancements
- License
A comprehensive legal document analysis platform that combines AI-powered document processing, chatbot assistance, and user-friendly interfaces.
Check out the live project here:
👉 visit Live Demo
Explore the LegalEase platform to upload documents,view summaries,and interact with the AI chatbot interface.
LEGAL EASE
├── .github/
│ └── workflows/
│ ├── ci.yml
│ ├── gssoc-auto-label.yml
│ ├── gssoc-ci.yml
│ ├── gssoc-stale.yml
│ ├── gssoc-welcome.yml
│ ├── pr-test.yml
│ └── test.yml
│
├── assets/
│
├── backend/
│ ├── core/
│ ├── data/
│ ├── middleware/
│ ├── routers/
│ │ ├── auth_routes.py
│ │ └── legal_routes.py
│ ├── services/
│ │ ├── ai_service.py
│ │ └── legal_mapping.py
│ ├── tests/
│ │ ├── conftest.py
│ │ ├── test_ai_pipeline.py
│ │ ├── test_api_validation.py
│ │ ├── test_endpoints.py
│ │ ├── test_integration.py
│ │ ├── test_legal_mapping.py
│ │ ├── test_rate_limiter.py
│ │ └── test_security.py
│ ├── utils/
│ ├── auth.py
│ ├── database.py
│ ├── main.py
│ ├── models.py
│ ├── requirements.txt
│ └── pytest.ini
│
├── coverage/
├── docs/
│ └── tailwind-theme-guide.md
├── htmlcov/
├── legacy/
│
├── public/
│
├── src/
│ ├── components/
│ │ ├── BackToTop.tsx
│ │ ├── ErrorBoundary.tsx
│ │ ├── Footer.tsx
│ │ ├── Header.tsx
│ │ ├── LegalMapping.tsx
│ │ ├── ProtectedRoute.tsx
│ │ ├── ScrollToTop.tsx
│ │ ├── ShareButton.tsx
│ │ ├── Toast.tsx
│ │ ├── ToastContainer.tsx
│ │ └── WhatsAppShareModal.tsx
│ ├── config/
│ ├── contexts/
│ ├── hooks/
│ ├── layouts/
│ ├── pages/
│ ├── services/
│ ├── test/
│ ├── App.tsx
│ ├── main.tsx
│ └── index.css
│
├── .env.example
├── .eslintrc.json
├── .gitignore
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── package.json
├── pnpm-lock.yaml
├── pnpm-workspace.yaml
├── postcss.config.js
├── README.md
├── tailwind.config.js
├── tsconfig.json
├── vite.config.ts
└── vercel.json
- Hero Section: Compelling introduction with call-to-action buttons
- Features Overview: Document summary, jargon explanations, and risk alerts
- Quick Actions: Direct access to main features
- Security Information: Trust indicators and compliance details
- Responsive Design: Mobile-friendly layout
- Statistics Overview: Document counts, processing status, and time saved
- Quick Actions: Fast access to upload, chat, and processing
- Recent Activity: Timeline of user actions
- Recent Documents: Latest uploaded files with status indicators
- Drag & Drop Interface: Intuitive file upload experience
- File Validation: Type and size checking (PDF, DOCX, TXT up to 25MB)
- Feature Explanation: Clear description of AI capabilities
- Recent Documents: History with processing status
- Interactive Chat Interface: Real-time conversation with AI
- Legal Topics Sidebar: Quick access to common questions
- Message History: Persistent conversation log
- Legal Disclaimer: Important usage guidelines
- Real-time Progress: Step-by-step processing visualization
- Animated Progress Bars: Visual feedback for each stage
- Processing History: Past document processing records
- Status Management: Cancel, retry, and download options
- Dual Comparison: Computes and contrasts readability metrics for the original legal text vs. the AI summary
- Linguistic Scores: Displays Flesch Reading Ease, Flesch-Kincaid Grade Level, and Difficulty Classifications
- Visual Progress Bars: Uses color-coded horizontal bars (Green = Easy, Yellow = Moderate, Red = Difficult) to showcase improvements
- Automated Badges: Highlights exactly how many grade levels and reading ease points have been improved
- Personal Information: Complete profile management
- Address Details: Billing and contact information
- Preferences: Language, timezone, and notification settings
- Account Statistics: Usage metrics and achievements
- Frontend: React 18, TypeScript, Vite
- Styling: Tailwind CSS 3.4 with custom theme extensions
- Routing: React Router DOM 6
- Charts: Recharts
- Icons: Lucide React
- Testing: Vitest, React Testing Library, jsdom
- Backend: Python 3.11+, FastAPI, Uvicorn
- Database: SQLAlchemy (with Supabase support)
- Auth: python-jose (JWT), bcrypt
- Document Processing: PyMuPDF (PDF), python-docx (DOCX)
- Rate Limiting: SlowAPI
- Linting: ESLint (frontend), Flake8 (backend)
- Consistent Color Scheme: Tailwind-based theme with light/dark mode support
- Lucide Icons: Modern, consistent icon set
- Smooth Animations: CSS transitions and React-powered interactions
- Accessibility: Proper ARIA labels and keyboard navigation
- Mobile Navigation: Collapsible menu for smaller screens
- Flexible Layouts: CSS Grid and Flexbox for optimal viewing
- Touch-Friendly: Appropriately sized interactive elements
- File Upload: Drag & drop with progress indication
- Chat Interface: Real-time AI-powered conversation
- Processing Animation: Step-by-step progress visualization
- Notifications: Toast-style messages for user feedback
- Chrome 80+
- Firefox 75+
- Safari 13+
- Edge 80+
The Readability Score Analyzer provides an instant visual comparison between the Original Legal Document and the AI Generated Summary. This helps users quantify how much easier the summary is to read and comprehend.
Readability metrics are calculated based on linguistic properties of the text using sentence count, word count, and syllable count heuristics.
The Flesch Reading Ease formula outputs a score between 0 and 100. Higher scores indicate material that is easier to read; lower numbers mark harder-to-read text.
Reading Ease Scores & Difficulty Classification:
- 90–100: Very Easy (approx. 5th-grade reading level)
- 80–89: Easy (6th-grade level)
- 70–79: Fairly Easy (7th-grade level)
- 60–69: Standard (8th to 9th-grade level)
- 50–59: Fairly Difficult (High School student level)
- 30–49: Difficult (College student level)
- 0–29: Very Difficult (College graduate / professional level)
The Flesch-Kincaid Grade Level formula translates the Reading Ease score into a U.S. school grade level format, making it easier to see how many years of education are expected to digest the document.
(Screenshots section placeholder for readability comparison panel)
- Node.js 18+ and npm (or pnpm)
- Python 3.11+
# Install dependencies
npm install
# Start development server
npm run devThe frontend runs on http://localhost:5173 by default.
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
source venv/bin/activate # Linux/macOS
# venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Copy environment variables
cp .env.example .env
# Edit .env with your API keys
# Start the server
uvicorn main:app --reloadThe backend runs on http://localhost:8000 by default.
Copy backend/.env.example to backend/.env and configure:
SUPABASE_URL— Supabase project URLSUPABASE_KEY— Supabase anonymous keyAI_API_KEY— AI service API key
This project includes comprehensive test suites for both backend and frontend to ensure code quality and prevent regressions.
The backend uses pytest as the testing framework with the following test structure:
backend/
├── tests/
│ ├── test_security.py # Security and authentication tests
│ ├── test_rate_limiter.py # Rate limiting functionality tests
│ ├── test_api_validation.py # API key validation tests
│ ├── test_endpoints.py # API endpoint tests
│ └── test_integration.py # Integration tests for user flows# Navigate to backend directory
cd backend
# Install test dependencies
pip install -r requirements.txt
# Run all tests
pytest
# Run tests with coverage
pytest --cov=. --cov-report=html
# Run only unit tests
pytest -m unit
# Run only integration tests
pytest -m integration
# Run tests with verbose output
pytest -v-
Unit Tests: Test individual functions and classes in isolation
- Rate limiter functionality
- API key validation
- Request model validation
- Health endpoint
-
Integration Tests: Test complete user flows
- Document upload and summarization
- Document upload and chat interaction
- Multiple document uploads
- Error recovery scenarios
-
Security Tests: Verify security measures
- API key authentication
- File size limits
- Rate limiting
- Invalid file rejection
The frontend uses Vitest as the testing framework with React Testing Library:
src/
├── test/
│ ├── setup.ts # Test configuration and mocks
│ └── services/
│ ├── storage.test.ts # Storage service tests
│ └── api.test.ts # API service tests# Install dependencies
npm install
# Run all tests
npm test
# Run tests in watch mode
npm test -- --watch
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverage
# Run tests for a specific file
npm test -- storage.test.ts- Service Tests: Test utility functions and services
- Storage service (localStorage operations)
- API service (HTTP requests)
- Error handling
- Data transformation
- Backend:
backend/pytest.ini- Pytest configuration - Frontend:
vite.config.ts- Vitest configuration - Frontend Setup:
src/test/setup.ts- Test environment setup
Tests are automatically run on GitHub Actions for every pull request. See .github/workflows/test.yml for the CI configuration.
When adding new features, please include:
- Unit tests for individual functions/components
- Integration tests for complete user flows
- Edge case tests for error scenarios
Follow the existing test patterns and maintain test coverage above 80%.
Follow these steps to configure environment variables required to run the project locally and in CI. Do not commit your real secrets.
- Create a Python virtualenv (recommended):
python -m venv .venv
source .venv/bin/activate
pip install -r backend/requirements.txt- Create a frontend environment (Node):
npm install- Create a local .env from the example:
cp .env.example .env
# Edit .env and replace placeholders with real values (DO NOT commit .env)-
Important environment variables:
From
.env.example:BYTEZ_API_KEY— required by the backend to access the Bytez SDK. Keep this secret.FRONTEND_URL— frontend origin used for CORS (default:http://localhost:5173).
Vercel deployment:
- The frontend calls same-origin API routes at
/apiin production, soVITE_API_URLis usually not required on Vercel. - Add
JWT_SECRET_KEYto Vercel environment variables before testing login/signup. - Add
BYTEZ_API_KEYto enable AI-backed features; otherwise/api/healthreports degraded. - Add
DATABASE_URLfor persistent accounts. Without it, Vercel uses temporary SQLite storage that can reset between serverless instances. - If using a separate backend host instead, set frontend
VITE_API_URLto that backend URL and backendFRONTEND_URLto the Vercel frontend URL.
Optional backend controls:
API_KEYS— comma-separated list of valid API keys for server endpoints (recommended in production).DEV_API_KEY— developer API key allowed whenALLOW_DEVis enabled (default:dev-token).ALLOW_DEV— allow usingDEV_API_KEYfor local development (true/false, defaulttrue).MAX_UPLOAD_SIZE— maximum allowed upload size in bytes (default 26214400 = 25MB).RATE_LIMIT_IP_CALLS,RATE_LIMIT_KEY_CALLS,RATE_LIMIT_PERIOD— simple rate-limiting configuration (defaults: 60, 30, 60).
-
Run backend (development):
# from the project root
cd backend
uvicorn main:app --reload --port 8000Security notes (backend)
- Authentication: backend endpoints (
/chat,/upload,/summarize) require an API key inAuthorization: Bearer <key>orX-API-Keyheader. SetAPI_KEYSor useDEV_API_KEYwithALLOW_DEVenabled for local development. - Upload limits: server enforces
MAX_UPLOAD_SIZEand basic file-type validation (PDF, DOCX, text). Oversized uploads return HTTP 413. - Rate limiting: server applies per-IP and per-API-key rate limits; exceeding the limit returns HTTP 429.
- Error codes: AI/service dependency failures return 5xx (503/502) rather than 200.
- Health check:
/healthreturns dependency status (useful for orchestration and monitoring).
Logging and secrets
-
Do not commit real secrets. Use environment variables or your secret manager.
-
The server will log degraded status when AI dependencies are unavailable but will not print secret values.
-
Run frontend (development):
# from the project root
npm run dev- Running in CI / Production:
- Provide secrets via your CI environment variables/secrets (do not store real secrets in the repository).
- Use the environment variables directly in your process manager (systemd, Docker, Kubernetes, etc.).
Security notes
.envand other secret files are ignored by.gitignoreby default. The repo includes!.env.exampleso the example can be committed while real secrets remain ignored.- Avoid printing secrets to stdout or logs. The backend no longer prints the API key at startup.
- Semantic HTML5 structure
- Consistent navigation across pages
- Proper meta tags for SEO and responsiveness
- Tailwind CSS for utility-first styling
- Custom animations and transitions
- Dark mode support
- Print styles included
- Modular code organization
- Event-driven architecture
- Local storage for preferences
- Simulated API interactions
For a complete guide to all custom theme values (colors, fonts, animations, container settings), see the Tailwind Theme Guide.
The primary color scheme can be modified in the Tailwind config (tailwind.config.js):
colors: {
primary: { DEFAULT: '#2563EB', /* ...shades */ }, // Brand blue
success: { DEFAULT: '#16A34A', /* ...shades */ }, // Positive states
warning: { DEFAULT: '#CA8A04', /* ...shades */ }, // Caution states
error: { DEFAULT: '#DC2626', /* ...shades */ }, // Error states
info: { DEFAULT: '#0EA5E9', /* ...shades */ }, // Informational
background: { light: '#F3F4F6', dark: '#111827' }, // Page backgrounds
}- Update company information in headers/footers
- Modify feature descriptions and benefits
- Customize legal disclaimers and privacy notices
- Integrate with actual backend APIs
- Add real authentication
- Implement document processing workflows
- CDN Resources: Fonts and Tailwind CSS from CDN
- Optimized Images: Proper sizing and lazy loading
- Minimal JavaScript: Essential functionality only
- CSS Efficiency: Utility-first approach reduces custom CSS
- Input Validation: File type and size checking
- XSS Prevention: Proper content sanitization
- Secure Headers: Content Security Policy recommendations
- Privacy: No sensitive data stored locally
- Backend Integration: Real document processing API
- User Authentication: Login/registration system
- Payment Processing: Subscription management
- Advanced Analytics: Usage tracking and insights
- Mobile App: React Native or Flutter application
For questions or issues:
- Check the browser console for JavaScript errors
- Ensure files are served via HTTP (not file://)
- Verify Tailwind CSS is loading correctly
- Test with different browsers and devices
Please follow the steps below to contribute to this project.
We welcome contributions from beginners and open-source enthusiasts! Follow these steps to get started:
- Go to the project repository
- Click on the Fork button (top right)
- This creates a copy of the repository in your GitHub account
Open your terminal and run:
git clone https://github.com/YOUR-USERNAME/LegalEase.git
cd LegalEaseAlways create a new branch before making changes:
git checkout -b your-branch-name- Open the project in a code editor (e.g., VS Code)
- Make your desired changes (e.g., improve README, fix UI, add features)
git add .
git commit -m "Describe your changes clearly"git push origin your-branch-name- Go to your forked repository on GitHub
- Click on Compare & Pull Request
- Add a clear title and description
- Submit the PR for review
Before starting work:
- Go to the Issues tab
- Check if the issue already exists
- If not, click New Issue
- Clearly describe the problem or improvement
- Keep your PR small and focused
- Follow proper commit message format
- Avoid making unrelated changes
- Be respectful in discussions
Thank you for contributing to LegalEase! 🚀
If you're new to open source:
- Look for beginner-friendly issues
- Read CONTRIBUTING.md
- Ask questions through Issues
- Submit your first PR
Every contribution matters!
Please read our CODE_OF_CONDUCT.md before participating in the community.
By contributing, you agree to maintain a respectful and inclusive environment.
LegalEase is committed to web accessibility best practices:
- Reduced Motion Support: Custom animations (
slide-up,spin-slow) and CSS transitions are automatically disabled when users enable theprefers-reduced-motion: reducesystem setting. This ensures a comfortable experience for users with motion sensitivity or vestibular disorders. - Semantic Color Tokens: Success, warning, error, and info states use accessible color contrasts (see #184).
- Keyboard Navigation: All interactive elements are keyboard-accessible.
To enable reduced motion on your system:
- macOS: System Settings → Accessibility → Display → Reduce motion
- Windows: Settings → Accessibility → Visual effects → Animation effects
- Linux: Varies by desktop environment (GNOME: Accessibility → Reduce Animation)
This project is intended for demonstration purposes. Please ensure proper licensing for any production use.
LegalEase - Making legal documents accessible and understandable for everyone.



