LegalAI is a full-stack Indian legal assistant workspace built around the frozen product scope:
- AI legal assistant for grounded Q&A
- IPC to BNS mapping
- Legal document explainer for PDF and TXT files
- Legal document drafter
- Basic authentication
- Logging and history storage
LegalAI/
├── backend/
│ ├── app/
│ ├── data/
│ ├── scripts/
│ ├── main.py
│ ├── requirements.txt
│ └── .env.example
├── frontend/
│ ├── app/
│ ├── components/
│ ├── lib/
│ └── package.json
├── docker/
├── docs/
└── README.md
The backend uses FastAPI with SQLAlchemy and JWT auth.
Implemented endpoints:
GET /api/v1/healthPOST /api/v1/auth/registerPOST /api/v1/auth/loginGET /api/v1/auth/mePOST /api/v1/queryGET /api/v1/map?code=420POST /api/v1/uploadPOST /api/v1/draftGET /api/v1/history
cd backend
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
copy .env.example .env
uvicorn main:app --reloadThe default database is local SQLite for quick startup. Set DATABASE_URL to PostgreSQL when you are ready for the production database phase.
The frontend uses Next.js App Router and connects to the backend through NEXT_PUBLIC_API_BASE_URL.
Pages included:
//login/chat/mapping/upload/draft/history
cd frontend
npm install
npm run devCreate a .env.local file in frontend/ if needed:
NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8000/api/v1Basic Docker files are included for local containerized setup.
backend/data/is reserved for uploads and legal datasets.backend/scripts/process_ipc.pycan still be used for dataset preparation.- The current query workflow uses a conservative placeholder retrieval pipeline so the full RAG stack can be added next without rewriting the API surface.