A comprehensive legal technology platform that combines AI-powered dispute resolution with traditional court management systems.
- User Authentication: Secure JWT-based authentication with MongoDB
- Role-based Access: Separate interfaces for users and court officials
- AI-Powered Dispute Resolution: Intelligent case analysis and suggestions
- Document Management: Secure file upload and management system
- Case Tracking: Complete case lifecycle management
- Real-time Chat: AI-powered legal assistance chatbot
- Mediation Platform: Online dispute resolution tools
-
Node.js with Express.js
-
MongoDB with Mongoose ODM
-
JWT for session management
-
bcryptjs for password hashing
-
express-validator for input validation
-
React with Vite
-
Axios for API communication
-
Context API for state management
- Node.js (v16 or higher)
- MongoDB (v4.4 or higher)
git clone <repository-url>
cd AI_Courtcd backend
npm installCreate a .env file in the backend directory:
cp env.example .envEdit the .env file with your configuration:
# Server Configuration
PORT=5000
NODE_ENV=development
# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017/ai-court
# JWT Configuration
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# Frontend URL for CORS
FRONTEND_URL=http://localhost:5173cd frontend
npm installCreate a .env file in the frontend directory:
cp env.example .envEdit the .env file with your configuration:
# Backend API URL
VITE_API_URL=http://localhost:5000/api
Ensure MongoDB is running:
# Start MongoDB (Ubuntu/Debian)
sudo systemctl start mongod
# Start MongoDB (macOS with Homebrew)
brew services start mongodb-community
# Start MongoDB (Windows)
net start MongoDBBackend:
cd backend
npm run devFrontend:
cd frontend
npm run devBackend:
cd backend
npm startFrontend:
cd frontend
npm run build
npm run previewThe system uses JWT-based authentication:
- JWT Authentication: Primary authentication method for API access
- Session Management: Automatic token refresh and session validation
POST /api/auth/signup- User registrationPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/profile- Get user profilePUT /api/auth/profile- Update user profilePUT /api/auth/change-password- Change passwordPOST /api/auth/verify- Verify JWT token
Symptoms: Database connection errors Solution:
- Ensure MongoDB is running
- Check MongoDB connection string
- Verify network connectivity
Symptoms: Authentication failures, 401 errors Solution:
- Check JWT_SECRET environment variable
- Ensure token is properly formatted
- Verify token expiration
Symptoms: Frontend can't connect to backend Solution:
- Check FRONTEND_URL environment variable
- Ensure CORS configuration matches frontend URL
- Verify backend is running on correct port
Enable debug logging by setting:
NODE_ENV=development
DEBUG=*Check application logs for detailed error information:
# Backend logs
cd backend
npm run dev
# Frontend logs (in browser console)
F12 > ConsoleAI_Court/
βββ backend/
β βββ config/
β β βββ database.js # MongoDB configuration
β βββ middleware/
β β βββ auth.js # Authentication middleware
β βββ models/
β β βββ User.js # User model
β β βββ Document.js # Document model
β βββ routes/
β β βββ auth.js # Authentication routes
β β βββ cases.js # Case management routes
β β βββ documents.js # Document management routes
β βββ scripts/
β β βββ setup-demo.js # Demo data setup
β βββ server.js # Express server
β βββ package.json
βββ frontend/
β βββ src/
β β βββ components/ # React components
β β βββ contexts/
β β β βββ AuthContext.jsx # Authentication context
β β βββ pages/ # Page components
β β βββ config/
β β βββ main.jsx # React entry point
β βββ package.json
βββ README.md
- Password Hashing: bcrypt with salt rounds
- JWT Token Security: Configurable expiration and secret
- Input Validation: Comprehensive validation using express-validator
- Rate Limiting: API rate limiting to prevent abuse
- CORS Protection: Configured CORS for security
- Helmet.js: Security headers middleware
- Environment Variables: Secure configuration management
cd backend
npm testcd frontend
npm testAll protected routes require a valid JWT token in the Authorization header:
Authorization: Bearer <jwt-token>
Standard error response format:
{
"error": "Error type",
"message": "Human-readable error message",
"details": [] // Optional validation errors
}- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For support and questions:
- Check the troubleshooting section
- Review the logs for error details
- Create an issue with detailed error information
- Include environment details (without sensitive data)
- β Improved JWT token handling
- β Enhanced error handling and validation
- β Added comprehensive authentication flow
- β Fixed CORS configuration
- β Improved database connection handling
- β Added security headers and rate limiting
- β Enhanced user model with better validation
- β Fixed frontend authentication context
- β Added proper environment variable handling