Bridging the gap between complex legal language and everyday understanding — powered by AI.
https://ai-legislative-analyzer-iota.vercel.app/
AI Legislative Analyzer is a full-stack web application that transforms dense legal documents into structured, easy-to-understand summaries. Using an LLM under the hood, it extracts key components from legal text and presents them in clean, categorized summary cards — making legal information accessible to anyone, regardless of their legal background.
Legal documents are notoriously lengthy and difficult to interpret. Extracting meaningful insights typically requires reading through pages of dense, technical language. AI Legislative Analyzer solves this by automatically analyzing legal text and organizing it into clearly defined sections that anyone can understand at a glance.
- 📋 Text Input — Paste any raw legal text directly into the interface
- 🤖 AI-Powered Analysis — Sends text to a backend LLM for intelligent summarization
- 🗂️ Structured Summaries — Output is organized into five predefined sections:
- Scope — What the legislation covers
- Core Concepts — Key definitions and principles
- Obligations — What parties are required to do
- Exceptions — Exemptions and special cases
- Penalties — Consequences for non-compliance
- 🃏 Summary Cards UI — Clean, readable card-based layout for results
- ⏳ Loading & Error States — Graceful handling of async operations and failures
- 📄 PDF Support (experimental) — Planned and partially implemented via
pdfjs-dist
┌─────────────────────────────────────────────────────────────┐
│ Frontend │
│ React + TypeScript + Tailwind CSS │
│ │
│ ┌─────────────┐ ┌──────────────────────────────┐ │
│ │ App.tsx │──────▶ │ SummaryCard Component │ │
│ │ (state mgmt)│ │ (renders structured output) │ │
│ └──────┬──────┘ └──────────────────────────────┘ │
└──────────┼──────────────────────────────────────────────────┘
│ HTTP Request (legal text)
▼
┌─────────────────────────────────────────────────────────────┐
│ Backend │
│ Node.js / Express API │
│ │
│ POST /analyze ──────▶ LLM API (AI Model) │
│ ◀──────────── Structured Summary │
└─────────────────────────────────────────────────────────────┘
- User pastes legal text into the frontend
- Frontend sends a request to the backend API
- Backend processes the text using an LLM
- AI returns a formatted summary string
- Frontend parses the response into structured sections
- UI renders the sections as summary cards
| Layer | Technology |
|---|---|
| Frontend | React, TypeScript |
| Styling | Tailwind CSS |
| Backend | Node.js, Express |
| AI Integration | LLM API (OpenAI or compatible) |
| PDF Parsing (optional) | pdfjs-dist |
ai-legislative-analyzer/
├── client/ # Frontend (React + TypeScript)
│ ├── src/
│ │ ├── components/
│ │ │ └── SummaryCard.tsx # Renders a single summary section
│ │ ├── App.tsx # Main logic and state management
│ │ └── index.tsx
│ ├── tailwind.config.js
│ └── package.json
│
├── server/ # Backend (Node.js / Express)
│ ├── routes/
│ │ └── analyze.js # POST /analyze endpoint
│ ├── services/
│ │ └── aiService.js # LLM API integration
│ └── index.js
│
└── README.md
- Node.js
v18+ - npm or yarn
- An API key for your LLM provider (e.g., OpenAI)
# Clone the repository
git clone https://github.com/your-username/ai-legislative-analyzer.git
cd ai-legislative-analyzercd server
npm install
# Create your environment file
cp .env.example .env
# Add your LLM API key to .env# .env
LLM_API_KEY=your_api_key_here
PORT=5000npm startcd client
npm install
npm run devThe app will be available at http://localhost:5173 (or your configured port).
The backend returns a formatted summary string. The frontend parses it using keyword-based pattern matching to extract sections:
Scope → Core Concepts → Obligations → Exceptions → Penalties
These are converted into a structured object and rendered as individual SummaryCard components.
- Works best with clean, well-formatted text input
- PDF parsing may introduce noisy text that affects summary quality
- Relies on consistent AI output structure for accurate parsing
- No authentication or persistent storage implemented yet
- Robust PDF/text preprocessing and cleaning
- JSON-based AI responses for more reliable parsing
- User authentication and saved analysis history
- Multi-language support
- Side-by-side document comparison
- Cloud deployment with auto-scaling
- Advanced legal analytics (change highlighting, clause tracking)
- 🎓 Law Students — Quickly summarize acts and legislative sections
- 👨💻 Developers — Build and prototype legal-tech tools faster
- 🏛️ General Public — Understand government policies without a law degree
- 🔬 Researchers — Analyze and compare legal documents at scale
Contributions are welcome! Please open an issue to discuss what you'd like to change, or submit a pull request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m 'Add your feature') - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
This project is licensed under the MIT License.
Made with ❤️ to make legal text less painful