# VARtura

> AI-powered auditing platform for Brazilian electricity bills. Customers upload the invoice PDF; the platform extracts the data, checks tariff, flag surcharge, taxes and solar credits against the utility's rules, and returns a report with the recoverable amount.

- URL: https://leonardocosta.dev/en-us/projects/vartura
- Period: 2025-12 → present
- Website: https://vartura.com.br
- Technologies: Django REST Framework, Django, Python, Nuxt.js, Celery, PostgreSQL, Flutter, LlamaIndex, RAG, OpenAI API, Anthropic API, Redis, TypeScript, Grafana
- Featured project: ✓

VARtura audits Brazilian electricity invoices and shows, line by line, where the utility overcharged.

The flow starts at the PDF upload: the invoice is read, the data extracted with LLM assistance and normalised into a common model. The analysis then runs against the rules that apply to that state, that utility and that account type — TE + TUSD tariff, flag surcharge, ICMS calculation base, public lighting levy and SCEE solar credit compensation. The output is a report with the estimated recoverable amount and the steps to dispute it.

I worked across all three sides of the product:

• Backend — Django REST Framework on PostgreSQL, served by Daphne (ASGI), with Celery + Redis for asynchronous invoice and analysis processing. Subscriptions and recurring billing through Mercado Pago. Object-level permissions with django-rules, multi-company support with collaborators, and a fully translated message catalogue (pt-BR/en) enforced by tests.

• Web — Nuxt 4 with hybrid rendering: public marketing pages are prerendered for SEO while the authenticated app runs as an SPA. Pinia for state, session auth with CSRF, and consumption/savings charts.

• Mobile — a Flutter app (iOS and Android) for end users, built with Riverpod, go_router navigation and a Dio interceptor chain handling JWT refresh, plan gating and API error translation.


The analysis pipeline uses LlamaIndex with OpenAI and Anthropic models. It started as a RAG over the applicable rules; after measuring cost and recall in production, retrieval was replaced by deterministic rule injection with prompt caching, in a single model call per report. Observability runs on Prometheus, Loki and Grafana, with Sentry for errors.

- Portuguese version (pt-BR): https://leonardocosta.dev/pt-br/projects/vartura
- All projects: https://leonardocosta.dev/en-us/projects
