Legal House is an intelligent legal document review system that automates case analysis, generates AI-powered summaries of legal documents, and provides quick insights for law firms, courts, and legal professionals. The system leverages advanced natural language processing to streamline the legal workflow.
- Features
- Tech Stack
- System Architecture
- Database Schema
- API Documentation
- Installation & Setup
- Application Flow
- AI Model Configuration
- Project Structure
- Environment Variables
- Usage Guide
- Contributors
- Future Enhancements
- License
-
User Management
- Create and manage user profiles with contact details
- Store user information (name, email, phone, address)
- Link users to their respective cases
-
Case Management
- Create new legal cases with detailed information
- Upload legal documents (PDF format) for each case
- Track case creation and resolution timestamps
- Monitor case status (resolved/unresolved)
-
Document Upload & Storage
- Secure PDF file upload functionality
- File validation and size restrictions (10MB limit)
- Organized file storage system with unique filenames
- Direct access to uploaded documents via links
-
AI-Powered Document Summarization
- Automated text extraction from PDF documents
- Intelligent case summarization using local AI model (Ollama)
- Point-wise structured summaries for easy comprehension
- Real-time streaming response from AI model
-
Case Status Tracking
- Differentiate between resolved and unresolved cases
- Automatic status updates upon case resolution
- Timestamp tracking for creation and resolution
- Dashboard with case statistics
-
View & Filter Cases
- View all unresolved cases requiring attention
- Access resolved cases with their summaries
- Quick access to case documents
- Detailed case information display
-
Dashboard Analytics
- Active cases count
- Resolved cases count
- Total documents processed
- Recent cases overview
- React.js (v19.0.0) - Modern JavaScript library for building user interfaces
- Vite (v6.2.0) - Fast build tool and development server
- React Router DOM (v7.4.1) - Client-side routing
- Tailwind CSS (v3.4.1) - Utility-first CSS framework
- ShadCN UI - Reusable component library built on Radix UI
- Lucide React (v0.485.0) - Beautiful icon library
- Axios (v1.8.4) - HTTP client for API requests
- Sonner (v2.0.2) - Toast notifications
- Marked (v15.0.7) - Markdown parser (for formatted summaries)
- Node.js - JavaScript runtime environment
- Express.js (v4.21.2) - Web application framework
- PostgreSQL - Relational database management system
- node-postgres (pg v8.14.1) - PostgreSQL client for Node.js
- Multer (v1.4.5-lts.2) - Middleware for handling file uploads
- pdf-parse (v1.1.1) - PDF text extraction library
- node-fetch (v3.3.2) - Fetch API for Node.js
- CORS (v2.8.5) - Cross-Origin Resource Sharing middleware
- dotenv (v16.4.7) - Environment variable management
- Ollama - Local AI model server
- Deepseek R1 (1.56B) - Pretrained language model for text summarization
- Model Type: Generative text model
- Running locally on port 11434
- Streaming response capability
- Optimized for document summarization tasks
- PostgreSQL - Production-grade relational database
- Connection pooling for efficient resource management
- Foreign key constraints for data integrity
- Timestamp tracking for audit trails
βββββββββββββββββββ
β React.js UI β
β (Frontend) β
ββββββββββ¬βββββββββ
β HTTP Requests (Axios)
β
βββββββββββββββββββ
β Express.js API β
β (Backend) β
ββββββ¬ββββββββ¬βββββ
β β
β β
βββββββββββ ββββββββββββββββ
βPostgreSQLβ βOllama AI Modelβ
β Database β β (Local) β
ββββββββββββ ββββββββββββββββ
- User Interaction β React frontend receives user input
- API Request β Axios sends HTTP request to Express backend
- Data Processing β Express controllers handle business logic
- Database Operations β PostgreSQL stores/retrieves data
- AI Processing β Ollama model generates summaries
- Response β Data sent back through the chain to frontend
Stores information about legal professionals, clients, or case owners.
CREATE TABLE users (
id SERIAL PRIMARY KEY,
user_name VARCHAR(255) NOT NULL,
phone_no VARCHAR(15) NOT NULL,
email VARCHAR(255) NOT NULL,
address TEXT NOT NULL
);Fields:
id- Auto-incrementing primary keyuser_name- Full name of the userphone_no- Contact phone numberemail- Email addressaddress- Physical address
Stores legal case information and links to users.
CREATE TABLE cases (
id SERIAL PRIMARY KEY,
user_id INT NOT NULL,
case_name VARCHAR(255) NOT NULL,
case_file_link VARCHAR(255) NOT NULL,
case_resolve_file_link TEXT,
creation_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
resolved_timestamp TIMESTAMP,
resolve_status BOOLEAN DEFAULT FALSE,
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
);Fields:
id- Auto-incrementing primary keyuser_id- Foreign key linking to users tablecase_name- Name/title of the legal casecase_file_link- Path to uploaded PDF documentcase_resolve_file_link- AI-generated summary textcreation_timestamp- Automatic timestamp when case is createdresolved_timestamp- Timestamp when case is resolvedresolve_status- Boolean indicating if case is resolved (true/false)
Relationships:
- One user can have multiple cases (One-to-Many)
- CASCADE delete ensures cases are removed when user is deleted
http://localhost:5000/api/v1
POST /create/user
Creates a new user in the system.
Request Body:
{
"user_name": "John Doe",
"phone_no": "1234567890",
"email": "john@example.com",
"address": "123 Main Street, City"
}Response:
{
"message": "User created successfully",
"data": [
{
"id": 1,
"user_name": "John Doe",
"phone_no": "1234567890",
"email": "john@example.com",
"address": "123 Main Street, City"
}
]
}POST /create/case
Creates a new case and uploads associated PDF document.
Content-Type: multipart/form-data
Request Body:
user_id(number) - ID of the usercase_name(string) - Name of the casecase_file_link(file) - PDF file (max 10MB)
Response:
{
"message": "Case created successfully",
"data": {
"id": 1,
"user_id": 1,
"case_name": "Theft Case",
"case_file_link": "/uploads/1234567890-document.pdf",
"resolve_status": false,
"creation_timestamp": "2024-01-06T10:30:00.000Z"
}
}POST /create/upload
Uploads a PDF file to the server.
Content-Type: multipart/form-data
Request Body:
case_file_link(file) - PDF file
Response:
{
"message": "File uploaded successfully",
"file": "1234567890-document.pdf"
}GET /view/view
Retrieves all cases that haven't been resolved yet.
Response:
{
"message": "Cases retrieved successfully",
"data": [
{
"case_id": 1,
"case_name": "Theft Case",
"case_file_link": "/uploads/1234567890-document.pdf",
"creation_timestamp": "2024-01-06T10:30:00.000Z",
"resolved_timestamp": null,
"resolve_status": false,
"user_id": 1,
"user_name": "John Doe",
"phone_no": "1234567890",
"email": "john@example.com",
"address": "123 Main Street, City"
}
]
}GET /view/view-resolve
Retrieves all cases that have been resolved.
Response:
{
"message": "Cases retrieved successfully",
"data": [
{
"case_id": 2,
"case_name": "Property Dispute",
"case_file_link": "/uploads/9876543210-document.pdf",
"creation_timestamp": "2024-01-05T09:00:00.000Z",
"resolved_timestamp": "2024-01-06T11:00:00.000Z",
"resolve_status": true,
"user_id": 1,
"user_name": "John Doe",
"phone_no": "1234567890",
"email": "john@example.com",
"address": "123 Main Street, City"
}
]
}GET /view/get-summary?id={case_id}
Retrieves the AI-generated summary for a specific case.
Query Parameters:
id(number) - Case ID
Response:
{
"success": true,
"data": {
"id": 2,
"user_id": 1,
"case_name": "Property Dispute",
"case_file_link": "/uploads/9876543210-document.pdf",
"case_resolve_file_link": "Summary text here...",
"creation_timestamp": "2024-01-05T09:00:00.000Z",
"resolved_timestamp": "2024-01-06T11:00:00.000Z",
"resolve_status": true
}
}POST /summarize
Processes a case document and generates an AI-powered summary.
Request Body:
{
"pdfUrl": "/uploads/1234567890-document.pdf",
"caseId": 1
}Response:
{
"success": true,
"output": "**Case Summary:**\n1. Key point one...\n2. Key point two...\n\n**Conclusion:** Overall summary..."
}Processing Steps:
- Fetches PDF from the provided URL
- Extracts text content from PDF
- Sends text to Ollama AI model for summarization
- Streams response from AI model
- Updates database with summary and resolution status
- Returns formatted summary to client
- Node.js (v16 or higher)
- PostgreSQL (v12 or higher)
- Ollama (for AI model)
- npm or yarn package manager
git clone https://github.com/laatu08/SEMICOLON.git
cd SEMICOLON# Install PostgreSQL (if not already installed)
# For Ubuntu/Debian:
sudo apt-get install postgresql postgresql-contrib
# For macOS:
brew install postgresql
# Start PostgreSQL service
sudo service postgresql start # Linux
brew services start postgresql # macOS
# Create database
psql -U postgres
CREATE DATABASE legal_house;
\qcd backend
# Install dependencies
npm install
# Create .env file
touch .env
# Add the following to .env file:
DATABASE_URL=postgresql://username:password@localhost:5432/legal_house
PORT=5000
MODEL_NAME=deepseek-r1:1.5b
# Create uploads directory
mkdir uploads
# Start the server
npx nodemon index.js
# OR
npm startThe backend server will start on http://localhost:5000
# Open new terminal
cd admin
# Install dependencies
npm install
# Start the development server
npm run devThe frontend application will start on http://localhost:5173
# Install Ollama
# For Linux:
curl -fsSL https://ollama.com/install.sh | sh
# For macOS:
brew install ollama
# For Windows: Download from https://ollama.com/download
# Start Ollama service
ollama serve
# Pull the Deepseek R1 model (in a new terminal)
ollama pull deepseek-r1:1.5b
# Verify model is running
curl http://localhost:11434/api/generate -d '{
"model": "deepseek-r1:1.5b",
"prompt": "Hello"
}'User lands on homepage
β
Sees statistics:
- Active cases count
- Resolved cases count
- Total documents
- Recent cases table
User clicks "New Case" button
β
Redirected to /create-case page
β
User fills form:
- Full Name
- Email
- Phone Number
- Address
- Case Name
- PDF File Upload
β
Form validation
β
Submit form β API POST /api/v1/create/user
β
User created in database
β
API POST /api/v1/create/case (with user_id)
β
File uploaded to /uploads directory
β
Case created in database (resolve_status = false)
β
Success notification shown
User navigates to /view-case
β
API GET /api/v1/view/view (fetches unresolved cases)
β
Table displays all unresolved cases
β
User clicks "Summarize" button
β
Modal opens showing case details
β
API POST /api/v1/summarize triggered
ββ Backend fetches PDF from server
ββ Extracts text using pdf-parse
ββ Sends text to Ollama AI model
ββ AI generates structured summary
ββ Streams response back
β
API updates database:
ββ Sets case_resolve_file_link = summary
ββ Sets resolved_timestamp = current time
ββ Sets resolve_status = true
β
Summary displayed in modal textarea
β
User closes modal
β
Case list refreshes (case removed from unresolved list)
User navigates to /resolve-case
β
API GET /api/v1/view/view-resolve (fetches resolved cases)
β
Table displays all resolved cases
β
User clicks "View Summary" button
β
API GET /api/v1/view/get-summary?id={case_id}
β
Modal opens with pre-generated summary
β
User can read the summary
Frontend (React)
β
βββ Create Case
β ββ Form Input
β ββ File Upload
β ββ API Call β Backend β Database
β
βββ View Cases
β ββ Fetch Data
β ββ API Call β Backend β Database Query
β
βββ Summarize
β ββ Trigger AI
β ββ API Call β Backend
β β ββ Fetch PDF
β β ββ Extract Text
β β ββ Call Ollama
β ββ Update Database
β
βββ View Summary
ββ Fetch Summary β Backend β Database
Model Details:
- Name: Deepseek R1
- Version: 1.5B parameters
- Type: Generative Pre-trained Transformer
- Purpose: Legal document summarization
- Deployment: Local inference server
Configuration:
// API Endpoint
const OLLAMA_URL = "http://localhost:11434/api/generate";
// Model Parameters
{
"model": "deepseek-r1:1.5b",
"prompt": "<system_prompt> + <extracted_text>",
"stream": true
}Prompt Engineering: The system uses a carefully crafted prompt for optimal summarization:
You are an advanced AI model specialized in summarizing long texts.
Your task is to generate a structured, point-wise summary of the
given text, capturing key details concisely. Follow these guidelines:
1. Extract the most important points from the text in a clear and
concise manner.
2. Present the summary in bullet points, avoiding unnecessary details.
3. Maintain clarity and coherence while ensuring completeness.
4. After listing the key points, provide a short conclusion
summarizing the overall essence of the text.
5. Keep the response brief, to the point, and easy to read.
Here is the text to summarize:
[DOCUMENT_TEXT]
Response Processing:
- The model returns a streaming response
- Responses are concatenated into a full summary
<think>tags are removed from the output- Final summary is stored in the database
Model Performance:
- Average processing time: 30-60 seconds per document
- Suitable for documents up to 50 pages
- Generates structured, point-wise summaries
- Includes conclusion section
SEMICOLON/
β
βββ admin/ # Frontend React Application
β βββ public/
β β βββ vite.svg
β βββ src/
β β βββ assets/
β β β βββ react.svg
β β βββ components/
β β β βββ ui/ # ShadCN UI Components
β β β βββ dialog.jsx # Modal dialog component
β β β βββ navigation-menu.jsx
β β βββ lib/
β β β βββ utils.js # Utility functions
β β βββ page/
β β β βββ CreateCase.jsx # Create new case page
β β β βββ Footer.jsx # Footer component
β β β βββ Home.jsx # Dashboard home page
β β β βββ Navbar.jsx # Navigation bar
β β β βββ ResolveCase.jsx # View resolved cases
β β β βββ ViewCase.jsx # View & summarize cases
β β βββ App.css
β β βββ App.jsx # Main app component with routing
β β βββ index.css # Global styles
β β βββ main.jsx # Entry point
β βββ .gitignore
β βββ components.json # ShadCN configuration
β βββ eslint.config.js
β βββ index.html
β βββ jsconfig.json
β βββ package.json
β βββ postcss.config.js
β βββ README.md
β βββ tailwind.config.js
β βββ vite.config.js
β
βββ backend/ # Backend Node.js Application
β βββ controllers/ # Business logic handlers
β β βββ case.controller.js # Case creation logic
β β βββ fileUpload.controller.js # File upload handling
β β βββ resolveView.controller.js # Resolved cases view
β β βββ summarize.controller.js # AI summarization logic
β β βββ user.controller.js # User management
β β βββ view.controller.js # Unresolved cases view
β βββ models/ # Database models
β β βββ case.model.js # Cases table schema
β β βββ user.model.js # Users table schema
β βββ routes/ # API route definitions
β β βββ create.route.js # Create user/case routes
β β βββ summerize.route.js # Summarization route
β β βββ view.route.js # View cases routes
β βββ uploads/ # Uploaded PDF files storage
β βββ .env # Environment variables
β βββ .gitignore
β βββ db.js # Database connection
β βββ index.js # Server entry point
β βββ package.json
β
βββ .gitignore
βββ README.md # This file
Frontend:
App.jsx- Main routing configurationHome.jsx- Dashboard with statistics and recent casesCreateCase.jsx- Form for creating new casesViewCase.jsx- Table of unresolved cases with summarize buttonResolveCase.jsx- Table of resolved cases with summariesdialog.jsx- Reusable modal component for displaying summaries
Backend:
index.js- Express server setup and middleware configurationdb.js- PostgreSQL connection poolcase.controller.js- Handles case creation and file uploadssummarize.controller.js- PDF extraction and AI summarizationuser.controller.js- User CRUD operations*.model.js- Database table creation scripts
# Database Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/legal_house
# Server Configuration
PORT=5000
# AI Model Configuration
MODEL_NAME=deepseek-r1:1.5b
# Optional: Node Environment
NODE_ENV=development# API Base URL
VITE_API_URL=http://localhost:5000Security Note: Never commit .env files to version control. Add them to .gitignore.
- Navigate to the application homepage
- Click on "New Case" button or go to "Create Case" in navigation
- Fill in the client/case information:
- Enter full name of the client
- Provide email address
- Add phone number
- Enter physical address
- Specify case name/title
- Upload the legal document (PDF format, max 10MB)
- Click "Create Case" button
- Wait for success notification
- Go to "View Case" from navigation menu
- Browse the list of unresolved cases
- Click "View File" to review the original document
- Click "Summarize" button for the desired case
- Wait for AI processing (30-60 seconds)
- Review the generated summary in the modal
- The case is automatically marked as resolved
- Navigate to "Resolve Case" page
- View all previously resolved cases
- Click "View Summary" to see the AI-generated analysis
- Review case details and summary
- Partha Borah - Lead Developer
- Abishesk Prasad - Backend Developer
- Nitul Das - Frontend Developer
- Sourav Kumar Barman - Database & AI Integration
-
Enhanced AI Capabilities
- Improve model efficiency for faster processing
- Support for larger documents (100+ pages)
- Multi-language document support
- Legal terminology recognition and highlighting
-
Advanced Search & Filtering
- Full-text search across cases
- Filter by date range, status, user
- Advanced query builder
- Export search results
-
Case Law Recommendations
- AI-powered similar case suggestions
- Legal precedent identification
- Citation extraction and linking
-
User Authentication
- Secure login system
- Role-based access control (Admin, Lawyer, Clerk)
- User activity logs
- Session management
-
Document Management
- Support for multiple file formats (DOCX, TXT, etc.)
- Document version control
- Annotation and highlighting features
- Collaborative editing
-
Reporting & Analytics
- Case resolution time analytics
- User activity reports
- PDF export of summaries
- Custom report generation
-
Notifications
- Email notifications for case updates
- Real-time alerts
- Reminder system for pending cases
-
Mobile Application
- React Native mobile app
- Offline access to summaries
- Push notifications
-
Integration Capabilities
- Calendar integration
- Email client integration
- Court management system APIs
- Cloud storage integration (Google Drive, Dropbox)
-
Security Enhancements
- End-to-end encryption for documents
- Two-factor authentication
- Audit trails
- GDPR compliance features
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024 SEMICOLON Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
For queries, suggestions, or collaboration opportunities:
- GitHub Repository: https://github.com/laatu08/SEMICOLON
- Email: partha2002borah@gmail.com
- Phone: +91 88128-63574
- Location: JEC, Garmur, 785007
- OpenAI and Ollama teams for AI model infrastructure
- PostgreSQL community for robust database system
- React and Vite teams for modern frontend tooling
- ShadCN for beautiful UI components
- All contributors and testers
- CPU: 2 cores
- RAM: 4 GB
- Storage: 10 GB free space
- OS: Windows 10, macOS 10.15+, Ubuntu 20.04+
- CPU: 4 cores or more
- RAM: 8 GB or more
- Storage: 20 GB SSD
- GPU: Optional, for faster AI processing
- OS: Latest stable versions
Issue 1: Database Connection Failed
Solution:
- Check PostgreSQL is running: sudo service postgresql status
- Verify DATABASE_URL in .env file
- Ensure database exists: psql -U postgres -c "\l"
Issue 2: Ollama Model Not Found
Solution:
- Check Ollama is running: curl http://localhost:11434
- Pull model: ollama pull deepseek-r1:1.5b
- Verify model name in .env matches exactly
Issue 3: File Upload Fails
Solution:
- Check uploads directory exists
- Verify file size is under 10MB
- Ensure file is PDF format
- Check disk space available
Issue 4: CORS Errors
Solution:
- Verify CORS is enabled in backend
- Check frontend is running on correct port
- Clear browser cache
"Empowering legal professionals with AI-driven automation!"
Last Updated: January 6, 2026 Version: 1.0.0 Maintained by: SEMICOLON Team