Agentic legal drafting MVP for Ohio landlord/tenant work. The app is structured around human-reviewed drafting: matter intake, candidate legal grounds, approved facts/sources, block-based drafting, validation, and DOCX export.
- Django + Django Ninja API
- React + Lexical editor shell
- Postgres + pgvector for relational data and source chunk embeddings
- Redis + Celery for AI, OCR, validation, and export jobs
- Docker Compose for local parity with container deployment
Copy-Item .env.example .env
docker compose up --buildThen open:
- Backend API docs: http://localhost:8000/api/docs
- Django admin: http://localhost:8000/admin/
- Frontend: http://localhost:5173
If deploying to AWS Lightsail or EC2:
- Firewall: Open ports
8000(Backend) and5173(Frontend) in your instance's networking settings/security groups. - Environment: Update your
.envfile to use the public IP/DNS:DJANGO_ALLOWED_HOSTS=<PUBLIC_IP> CORS_ALLOWED_ORIGINS=http://<PUBLIC_IP>:5173 VITE_API_BASE=http://<PUBLIC_IP>:8000/api
- Restart: Run
docker compose up --build -dto apply changes.
Create database tables after the containers are up:
docker compose exec backend python manage.py migrate
docker compose exec backend python manage.py createsuperuserDocker Desktop must be running before docker compose up. The backend is intended to run against Postgres because the initial migration enables the pgvector extension.
- Matter records with LegalServer-ready external IDs, problem codes, special problem codes, court, office, eviction ground, and subsidy metadata.
- Evidence, case notes, and claimable facts with verification status.
- Legal source and source chunk records with pgvector embeddings.
- Draft goals, candidate grounds, draft packages, draft blocks, and AI trace records.
- Stubbed motion-to-dismiss audit logic that proposes grounds from case signals.
- Django Ninja endpoints for matter selection, audit, ground review, draft package creation, and block editing.
- React/Lexical drafting workspace for reviewing the generated block package.
The current AI behavior is intentionally stubbed and deterministic. Replace the service functions in backend/core/services.py with provider-backed agents as each workflow matures:
- matter audit
- legal source retrieval
- missing-fact questionnaire generation
- draft-plan generation
- block drafting
- citation/fact validation
Keep each AI call wrapped by AITrace so Legal Aid can audit model inputs, outputs, selected sources, and human review decisions.
- Create or sync a matter.
- Select a drafting goal, such as
motion_to_dismiss. - Run a matter audit to generate candidate grounds.
- Advocate selects grounds, facts, and sources.
- Generate a block-based draft plan.
- Edit/review in the Lexical drafting surface.
- Validate facts/citations and export.
This scaffold intentionally stores legal logic in database-backed objects instead of burying it in DOCX/Jinja templates. DOCX files should become layout shells; clauses, source rules, and use conditions should live in the app.