๐ Building a 100% AI-Generated Document Translator
Overview: A full-stack, production-grade web application created entirely via AI/Vibe Coding. It converts complex legal terms, fine print, and bureaucratic bills into everyday Portuguese while enforcing WCAG AAA accessibility and strict LGPD compliance.
1. ๐ Introduction
Recently, I set out to test the limits of Vibe Coding by building an end-to-end software product using AI-driven development.
The result is the Real-World Document Translator (Tradutor de Documentos da Vida Real). Its goal is to bridge the accessibility gap for elderly individuals, people with low vision, and folks with limited literacyโallowing anyone to understand legal and financial contracts without needing a lawyer.
2. ๐ฏ The Challenge
Translating legal documents through AI presents two major technical hurdles:
| Challenge | Impact / Risk |
|---|---|
| Privacy & LGPD | Raw documents contain sensitive PII (CPFs, bank accounts, emails). Standard regex fails due to OCR noise (broken numbers, homoglyphs). |
| Accessibility | Most web tools ignore low-vision users and the elderly, lacking high contrast, scalable typography, and native screen reader tools. |
3. ๐ก Technical Solution & Architecture
Through iterative prompting and AI engineering, we designed a zero-trust, highly accessible architecture.
๐ก๏ธ Cybersecurity & Privacy (LGPD by Design)
-
BFF (Backend for Frontend): Built with FastAPI to keep API keys secure inside
.envvariables. - OCR-Resilient PII Sanitizer: Automatically normalizes homoglyphs and masks sensitive data before sending prompts to the LLM.
- Zero-Data Retention: 100% ephemeral processingโno database, no disk storage, instant memory sanitization.
- Upload Security: Inspects Magic Bytes and enforces strict file limits to block malicious uploads.
๐๏ธ Universal Accessibility (WCAG AAA)
- Dynamic Typography: Controls ($A-$, $A$, $A+$) paired with a minimum $48\text{px}$ touch area for mobile/keyboard usability.
- Native Text-to-Speech (TTS): Web Speech API integration with slowed playback controls tailored for elderly users.
๐๏ธ System Architecture Flow
[ User ] โโโโถ๏ธ [ Accessible Frontend (HTML/CSS/JS) ]
โ
โผ
[ Secure BFF (FastAPI) ]
โโโ File Validation (Magic Bytes)
โโโ PII Sanitization (OCR-Resilient)
โโโ API Key Guard (.env)
โ
โผ
[ Google Gemini API / Mock AI ]
4. ๐ Real-World Application
- Digital Inclusion: Empowers vulnerable groups to independently review financial, rental, and legal agreements.
- Enterprise Privacy Standards: The OCR-resilient PII masking module can be integrated into banking, healthcare, and HR platforms handling sensitive documentation.
- Zero-Cost Local Sandbox: Features a Smart Mock AI mode, allowing developers to run and test full accessibility workflows locally without incurring API charges.
5. ๐ง Reflection & Career Impact
Building this project 100% through AI was a major technical milestone. It proved that Vibe Coding isn't just about speeding up syntaxโit's about directing AI to construct secure, accessible, and architecturally sound systems.
Key takeaways from this build:
- Advanced FastAPI backend structure and custom security pipelines.
- Accessible front-end design complying with WCAG AAA standards.
- Stress testing anonymization logic against dirty OCR data using PyTest.
๐ ๏ธ Quick Start Guide
Want to test it locally? Follow these simple steps using Python 3.10+:
๐ Links & Live Demo
- ๐ Live Application: Tradutor de Documentos da Vida Real
- ๐ GitHub Repository: luizgarcg/tradutor-documentos
bash
# 1. Clone repo & install dependencies
pip install -r backend/requirements.txt
# 2. Run the application
python backend/server.py
# 3. Open [http://127.0.0.1:8000](http://127.0.0.1:8000) in your browser
Note: If no Gemini API key is configured, the server automatically defaults to Smart Mock AI mode for instant offline testing!
Top comments (0)