An AI-powered legal contract analysis tool that helps users understand contracts in plain English by identifying dangerous clauses and providing clear explanations.
- Contract Upload: Upload contract images or documents for analysis
- AI Analysis: Powered by Google Gemini AI to analyze legal language
- Plain English Explanations: Convert complex legal jargon into understandable terms
- Risk Identification: Highlight dangerous clauses and potential issues
- Email Generation: Automatically generate professional emails related to contracts
- Live Translation: Translate contract summaries to Hindi and Bengali in real time
- Expert Search: Find relevant legal experts based on contract type
- User Dashboard: Track analysis history and manage projects
- Authentication: Secure user authentication via Clerk
- React with TypeScript
- Vite for build tooling
- Tailwind CSS for styling
- Shadcn/ui component library
- Clerk for authentication
- Axios for API communication
- React Query for state management
- Framer Motion for animations
- Node.js with Express
- TypeScript
- Prisma ORM with PostgreSQL
- Clerk for server-side authentication
- Cloudinary for image storage
- Tesseract.js for OCR processing
- OpenAI integration
- Multer for file uploads
- Node.js (v18 or higher)
- PostgreSQL database
- Clerk account and API keys
- Groq AI API key
- Cloudinary account for image storage
-
Clone the repository
git clone <repository-url> cd lexguard.ai
-
Install dependencies
Client:
cd Client npm installServer:
cd ../Server npm install -
Environment Configuration
Create
.envfiles in both Client and Server directories.Server/.env:
DATABASE_URL="postgresql://username:password@localhost:5432/lexguard" CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key CLERK_SECRET_KEY=your_clerk_secret_key GROQ_API_KEY=your_GROQ_ai_api_key SERPAPI_KEY=your_serpapi_key CLOUDINARY_CLOUD_NAME=your_cloudinary_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_secret_keyClient/.env:
VITE_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key VITE_BASEURL=http://localhost:3000 -
** Start the translation service**
Run a LibreTranslate Docker image so the backend can call the translation API at
http://localhost:5000/translate.docker pull libretranslate/libretranslate:latest docker run -d --name libretranslate -p 5000:5000 libretranslate/libretranslate:latest
-
Database Setup
cd Server npx prisma migrate dev npx prisma generate -
Start the application
Terminal 1 - Server:
cd Server npm run devTerminal 2 - Client:
cd Client npm run devThe application will be available at:
- Frontend: http://localhost:5173
- Backend: http://localhost:3000
- Sign Up/Login: Create an account using Clerk authentication
- Upload Contract: Upload a contract image or document through the dashboard
- AI Analysis: The system will analyze the contract using AI
- Review Results: View the analysis results, identified risks, and plain English explanations
- Generate Communications: Use the email generation feature for contract-related communications
- Find Experts: Search for legal experts relevant to your contract type
- Manage History: Access your analysis history in the dashboard
POST /addApi/add-project- Upload and analyze a new contractGET /getApi/get-project- Retrieve project details and analysis results
POST /api/translate- Translate legal text to plain EnglishGET /api/search-experts- Search for legal experts
lexguard.ai/
├── Client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Page components
│ │ ├── hooks/ # Custom React hooks
│ │ └── lib/ # Utility functions
│ ├── public/ # Static assets
│ └── package.json
├── Server/ # Node.js backend
│ ├── src/
│ │ ├── controllers/ # Route handlers
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Express middleware
│ │ ├── lib/ # Business logic
│ │ └── configs/ # Configuration files
│ ├── prisma/ # Database schema and migrations
│ └── package.json
└── README.md
Client:
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run test- Run testsnpm run lint- Run ESLint
Server:
npm run dev- Start development server with nodemonnpm run build- Compile TypeScriptnpm run start- Start production server
npx prisma migrate dev- Create and apply migrationsnpx prisma generate- Generate Prisma clientnpx prisma studio- Open Prisma Studio for database management
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please contact the development team or create an issue in the repository.
Disclaimer: This tool is for informational purposes only and does not constitute legal advice. Always consult with qualified legal professionals for contract review and legal matters. c:\Users\aviru.vscode\Every Project is Here\LexGurd.ai\README.md