Clean & Simplified AI Legal System Last updated: 2026-01-25 - Automatic Deployment Ready π
A streamlined AI-powered legal assistance system featuring essential components only. After major cleanup, this project has been simplified from 200+ files down to ~40 core files, focusing on working components and production-ready code.
# 1. Start the simple webhook server
cd "D:\LegalAI Hub"
python simple_webhook.py
# Server: http://localhost:8000
# 2. Test server status
curl http://localhost:8000
# Returns: {"message": "Simple Webhook Server", "status": "running"}
# 3. Database management
cd database
python init_db.py # Initialize/reset database
# 4. NAS backup
cd automation
python nas_sync.py # Manual backup# Full backend server
cd backend/app
python main.py- π Simple Server: http://localhost:8000 (β Working)
- ποΈ Database: backend/database/legal_cases.db (β Working)
- π Backups: nas_backup/ (β Complete backup system)
- βοΈ Config: config/global_config.json (β Centralized settings)
- Database System: SQLite with legal case schema
- Backup System: Complete backup to nas_backup folder
- Configuration: Centralized settings in global_config.json
- Logging: Active error and activity tracking
- Full Backend: FastAPI with complete API routes
- AI Services: AI integration ready
- Web Dashboard: HTML templates and CSS prepared
- NAS Integration: Sync scripts ready for deployment
- Authentication: JWT-based user management system
- Document Processing: Upload and analysis capabilities
- Files Reduced: 200+ β ~40 essential files (80% reduction)
- No Duplicates: All redundant files removed
- Clean Structure: Only working/code-ready components kept
- Clear Status: Working vs Code-ready distinction
- Focused Scope: Essential legal AI features only
LegalAI Hub/ (~40 files total)
βββ π₯οΈ simple_webhook.py # β
Working webhook server
βββ ποΈ backend/ # π§ Complete FastAPI app
β βββ app/main.py # Full server
β βββ database/legal_cases.db # β
Working SQLite
β βββ services/ # π§ AI integrations ready
βββ βοΈ config/global_config.json # β
Centralized settings
βββ π automation/ # π§ NAS sync scripts
βββ π frontend/templates/ # π§ Web dashboard ready
βββ π nas_backup/ # β
Complete backup system
βββ π docs/ # Essential documentation
# Install minimal dependencies
pip install fastapi uvicorn requests
# Start working webhook server
cd "D:\LegalAI Hub"
python simple_webhook.py
# Server runs on http://localhost:8000# Install all dependencies
cd "D:\LegalAI Hub\backend"
pip install -r requirements.txt
# Start full server
cd app
python main.py# Setup virtual environment
python -m venv venv
venv\Scripts\activate
# Install dependencies
pip install fastapi uvicorn sqlite3 requests python-dotenv
# Initialize database
cd database
python init_db.py
# Start simple server
cd ..
python simple_webhook.py# AI/LLM Configuration
# NAS Integration (Code ready, needs testing)
NAS_HOST=192.168.1.100
NAS_USER=your_nas_username
NAS_PASSWORD=your_nas_password- simple_webhook.py: No environment variables required
- Config file: config/global_config.json contains all settings
- Database: Automatically uses backend/database/legal_cases.db
- Logs: Written to backend/logs/ directory
- Backups: Stored in nas_backup/ folder
Admin User:
Username: admin
Password: admin123
Sample Users:
Username: lawyer1 / Password: lawyer123
Username: client1 / Password: client123
# Manual backup
python database/backup_db.py
# Start scheduler for automated tasks
python automation/scheduler.py
# NAS synchronization
python automation/nas_sync.py --action sync# View logs
docker-compose logs -f
# Scale services
docker-compose up -d --scale legalai-app=2
# Production with monitoring
docker-compose --profile production --profile monitoring up -dimport requests
# Chat with AI
response = requests.post('http://localhost:8000/api/chat', json={
'message': 'What are the key elements of a valid contract?'
})
# Upload document
files = {'file': open('contract.pdf', 'rb')}
response = requests.post('http://localhost:8000/api/documents/upload',
files=files, data={'document_type': 'contract'})python start.py --mode status# Database optimization
python automation/scheduler.py --action run --job optimize_db
# Cleanup old files
python automation/scheduler.py --action run --job cleanup_logs
# Health check
python automation/scheduler.py --action run --job health_check- Input Validation: SQL injection and XSS protection
- Authentication: JWT-based with role management
- File Security: Type validation and size limits
- Rate Limiting: API throttling and abuse prevention
- Data Encryption: Secure storage and transmission
- Contract Analysis: Automated review of client agreements
- Case Management: Track cases from intake to resolution
- Document Automation: Generate legal documents from templates
- Compliance Monitoring: Track regulatory requirements
- Risk Assessment: Identify potential legal issues
- Knowledge Management: Searchable legal document library
- Workflow Automation: Streamline routine legal tasks
- MVP Development: Complete legal tech stack ready to deploy
- AI Integration: Pre-built LLM capabilities for legal use
- Scalable Architecture: Grows from startup to enterprise
- Cost Effective: Open source with enterprise features
- Runs on localhost:8000
- SQLite database
- File-based storage
- Manual backup
- Docker containerization
- Redis caching
- Nginx load balancing
- Automated backups
- Health monitoring
- NAS integration
Compatible with:
- β AWS (EC2, ECS, Lambda)
- β Google Cloud (Compute Engine, Cloud Run)
- β Azure (Container Instances, App Service)
- β Railway, Heroku, Vercel
- β Any Docker-compatible platform
- π Check the CLAUDE.md for detailed documentation
- π Report issues on GitHub
- π¬ Join our community discussions
- Fork the repository
- Create feature branch
- Submit pull request
- Follow coding standards
This project is open source and available under the MIT License.
β
Complete Solution: Everything you need in one package
β
Production Ready: Built for real-world legal work
β
AI-First: Leverages cutting-edge language models
β
Easy Setup: One command to get started
β
Highly Customizable: Adapt to your specific needs
β
Scalable: From personal use to enterprise deployment
β
Well Documented: Comprehensive guides and examples
β
Actively Maintained: Regular updates and improvements
Ready to test the cleaned system? Start in under 1 minute!
# Start the working webhook server
cd "D:\LegalAI Hub"
python simple_webhook.pyFile Count: ~40 essential files (cleaned from 200+)
Status: Clean, simplified, and ready for development