ZO
zobiakanwal/legal-ai-assistant
An AI-powered FastAPI backend for selecting and filling legal document templates using GPT-4.
Legal AI Assistant π§ββοΈβοΈπ€
This is an AI-powered assistant for generating and filling legal document templates.
Users can describe their legal issue, and the assistant selects the appropriate template, collects details step-by-step, and generates a ready-to-use document.
π οΈ Tech Stack
- Frontend: React + TypeScript + Vite + TailwindCSS
- Backend: FastAPI (Python)
- AI Integration: OpenAI GPT-4 API
- Document Handling: python-docx
- Environment Management: dotenv
π Project Structure
legal-assistant-app/ βββ backend/ # FastAPI backend with AI + docx handling β βββ main.py β βββ summarize_templates.py β βββ templates/ β βββ .env.example β βββ requirements.txt βββ frontend/ # Vite + React frontend with chat interface β βββ src/ β βββ public/ β βββ package.json β βββ tsconfig.json βββ .gitignore βββ README.md
π§ͺ Setup Instructions
πΉ Backend (FastAPI + OpenAI)
# Create and activate virtual environment
python -m venv venv
venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Create a .env file based on the example
# .env
OPENAI_API_KEY=your_openai_api_key
# Run the FastAPI server
uvicorn main:app --reloadπΉ Frontend (React + Vite)
# Navigate to the frontend folder:
cd frontend
#Install frontend dependencies:
npm install
#Start the development server:
npm run devπ Features
- β AI selects the best legal template based on user input.
- β Asks one question at a time to collect details efficiently.
- β Auto-fills legal document placeholders using GPT.
- β Allows download of ready-to-use .docx legal files.
- β Built-in support for multiple legal categories and templates.
π Environment & Security
This project uses .env to manage sensitive keys like your OpenAI API key.
Example .env file:
#.env.example
OPENAI_API_KEY=your_openai_api_key
π Live Demo
π§ Deployment link coming soonβ¦
On this page
Languages
Python48.8%TypeScript42.1%CSS5.4%JavaScript2.1%HTML1.5%
Contributors
Created July 10, 2025
Updated August 4, 2025