LexAI is an AI-assisted legal drafting and review platform built for handling real-world case documents. It helps ingest PDFs and text files, extract key facts, search across evidence, detect inconsistencies, and generate structured legal outputs.
- Ingests case documents such as FIRs, witness statements, affidavits, and related attachments
- Runs OCR on scanned documents when needed
- Classifies user intent and routes requests through the right workflow
- Retrieves relevant evidence from a vector store for grounded responses
- Detects contradictions and supports entailment-style verification
- Drafts and assembles legal content from templates and structured context
- Exports generated work into document formats for downstream use
- Backend: Django + Django REST Framework
- Async processing: Celery + Redis
- Retrieval and embeddings: ChromaDB + Voyage AI
- LLM orchestration: Anthropic Claude
- OCR: PyMuPDF and Tesseract-based support
- Frontend: React + Vite + TypeScript + Tailwind CSS
The backend is organized into domain apps for documents, orchestration, templates, compilation, retrieval, verification, and agent workflows.
- Python 3.10+
- Node.js 18+
- Redis
- API access for the configured AI services
For local development, SQLite is enabled by default. PostgreSQL can be used in production.
Create the backend environment file:
- Copy the example file in the project root:
.env.exampleto.env
- Fill in the required values, especially:
SECRET_KEYANTHROPIC_API_KEYVOYAGE_API_KEYREDIS_URL
- If you are using the frontend locally, copy the example file in the frontend folder:
frontend/.env.local.exampletofrontend/.env.local
- Set
VITE_API_BASE_URLto your backend URL, for example:http://localhost:8000/api/v1
From the project root:
- Install Python dependencies:
pip install -r requirements.txt
- Apply database migrations:
python manage.py migrate
- Install frontend dependencies:
cd frontendnpm install
Run the backend, worker, and frontend in separate terminals.
From the project root:
python manage.py runserver
From the project root:
celery -A config worker -l info
From the frontend folder:
npm run dev
Open the frontend URL shown by Vite, usually http://localhost:5173.
If API docs are enabled in the backend settings, the schema and Swagger UI are available at:
/api/v1/schema//api/v1/schema/ui/
Available scripts in frontend/package.json:
npm run dev— start the Vite development servernpm run build— type-check and build for productionnpm run preview— preview the production build locallynpm run generate:types— generate TypeScript API types from the backend schema
Run the test suite from the project root:
pytest
- Use PostgreSQL in production
- Use a persistent Redis instance for Celery and cached workflows
- Set
CORS_ALLOWED_ORIGINSto your frontend domain - Update
VITE_API_BASE_URLto the deployed backend API URL
apps/— core backend domains and agentsconfig/— Django project configurationfrontend/— React user interfaceinfrastructure/— OCR and storage integrationstests/— backend test suite