RAG Electoral Law Assistant
Deployed private application

Overview
A deployed, invitation-only application for source-grounded research across Mexican electoral law, regulations and approved reference material. The interface combines authenticated chat, retained conversation history, citations and role-based administration.
Problem
Legal research across multiple approved documents is slow and difficult to audit when answers cannot be traced back to the exact source material.
Context
The application is private. This case study describes the engineering approach without exposing credentials, private data or protected source material.
My role
I designed and built the TypeScript/Next.js application, ingestion and retrieval flow, authenticated product experience, usage controls and role-based administration.
Solution
The application ingests a manually approved corpus, retrieves relevant passages and generates grounded responses that retain reproducible citations. Protected storage and row-level access policies separate user and administrative capabilities.
Architecture
- Authenticated Next.js progressive web application
- Server-backed conversation history and usage controls
- Approved-corpus ingestion and hybrid retrieval
- PostgreSQL and pgvector retrieval layer
- Protected document storage
- Supabase Row Level Security for user and administrative boundaries
- Citation-preserving answer generation
Technologies
- Next.js
- Supabase Auth
- PostgreSQL
- pgvector
- Gemini
- Vercel
AI components
- Hybrid retrieval over an approved legal corpus
- Grounded answer generation
- Reproducible citations to underlying sources
Engineering decisions
- Use an approved source corpus rather than open-ended model knowledge.
- Preserve citations so every answer can be checked against the source material.
- Treat authentication, protected storage and role separation as product requirements.
What is implemented
- Authenticated chat and server-backed history
- Usage controls and role-based administration
- Document ingestion and hybrid retrieval
- Protected document storage and Row Level Security
- Grounded answers with retained citations
- Deployed private application
What is still in development or planned
None listed.
Current status
Deployed private application
Outcome
Turns paper-intensive legal research into fast, searchable and auditable access to approved source material.
Evidence and confidentiality
Private application; architecture and implementation details are available for discussion.