DroitDraft is a state-of-the-art AI-powered legal document generation platform. This repository is a monorepo containing both the FastAPI backend and the Next.js frontend.
- Docker: For running the PostgreSQL database.
- Python 3.9+: For the backend.
- Node.js 18+: For the frontend.
- Git: For version control.
The project relies on three key Docker services:
- PostgreSQL: Primary data store for users and templates.
- MinIO: S3-compatible storage for uploaded evidence files.
- ChromaDB: Vector database for legal research and RAG.
-
Start all required containers:
docker start postgres_db compassionate_buck great_banzai
-
Database Permissions (First-time setup):
docker exec -it postgres_db psql -U droitdraft_user -d droitdraft_dev -c "GRANT ALL ON SCHEMA public TO droitdraft_user;"
- Navigate to backend:
cd backend - Setup Venv:
python -m venv .venvand activate it. - Install Core:
pip install -r requirements.txt - Environment: Create
.env. EnsureGROQ_API_KEYandGEMINI_API_KEYare present. - Seeding: To load the professional Maharashtra templates:
python scripts/seed_db.py - Run:
uvicorn app.main:app --host 0.0.0.0 --port 8002 --reload
- Navigate to frontend:
cd frontend - Install:
npm install - Run:
npm run dev -- -p 3001Available athttp://localhost:3001
- Maharashtra Template Library: 7 verified proformas for Wills, Sale Deeds, Probate Petitions, and Legal Notices.
- Evidence-Grounded Drafting: Upload PDF/Image evidence (Death Certificates, IDs). The AI extracts facts and auto-fills the templates.
- MinIO Storage: Secure S3-compatible storage for uploaded evidence files.
- Legal Research Sandbox: Interactive sidebar for real-time legal Q&A using RAG.
- ChromaDB Vector Store: 56+ legal documents indexed for research.
- Natural Legal Citations: AI cites Acts and Sections naturally (e.g., "Section 10 of the Indian Contract Act, 1872").
- Insert to Draft: One-click transfer of cited authorities into the editor.
- Ghost Typing: AI-powered inline autocomplete that suggests the next legal sentence in gray text.
- Tab-to-Accept: Press
Tabto accept AI suggestions instantly. - Context-Awareness: Suggestions adapt based on the current draft and extracted case facts.
- Agentic Drafting Flow: Powered by Llama 3.3 (Groq) with Gemini fallback.
- Smart Editor: Markdown-to-HTML rendering with automatic date injection.
- JWT & Session Security: Long-lived sessions (24h) with secure JWT authentication.
- PROJECT_STATUS.md: Comprehensive verification guide for all features.
- roadmap.md: Development roadmap and future plans.
- docs/system_architecture_diagram.md: Highly detailed architecture diagrams, including a structured block diagram with explicit per-agent interactions, runtime sequence, and ingestion pipeline.