A loss-management platform for autonomous micromarkets. Built in February to automate one person's billing routine, adopted by the entire operations team by June — audit, monitoring, billing and legal escalation, end to end.
It started with a complaint at home: "I don't even know what I have to do today, who do I have to charge? Who do I still need to answer? Who am I forgetting?" Answering it by hand took hours, every day.
01 — Origin
My partner handles debt recovery for Quadrado Express, a chain of autonomous micromarkets. The routine was fully manual: no predictability of the day's workload, no visibility of each customer's stage in the dunning ladder, and every message composed by hand, prone to error.
Instead of organizing the manual process, replace it. A system that knows every occurrence, tracks its stage automatically, calculates amounts, and assembles the outreach message — so the human only validates and sends. One user, one workflow, built to be extended.
02 — Evolution
Every phase came from real feedback, not a roadmap. Select a phase to see what was built and how the interface worked at that point.
The first version answered the original question. A billing queue showing every open occurrence and its stage on the dunning ladder, automatic value calculation from registered products, and message assembly with variable interpolation — name, amount, store, due date — ready to validate and fire via WhatsApp.
Feedback pulled the system upstream. A monitoring screen for registering occurrences — theft, partial payment, repeat offenders — with structured types, silent user lookup by CPF with auto-fill, deduplication keys, and an automatic history per customer. The system now recognized a returning user and surfaced their full record.
The legal stage entered the flow — when billing fails, the case escalates with its full history attached. The same period hardened the product: a KPI dashboard reading totals straight from Firestore, a design system with light/dark theming via CSS variables, modals rebuilt with React Portals, occurrence grouping for unified billing with independent installment tracking, and an admin-editable message template engine.
We presented the platform to Quadrado Express. They adopted it — and the requirements became theirs. The biggest addition: an audit module that reviews every store, surfaces product discrepancies, and dispatches monitoring to watch flagged stores. What began as one contractor's workflow now runs the loss-management operation end to end.
03 — The operation
The platform connects four roles into a single loss-management cycle. Select a stage to see what happens inside it.
Every store is reviewed per cycle. Product discrepancies surface automatically.
Flagged stores get watched. Each incident becomes a structured occurrence.
Occurrences enter the dunning ladder. Messages are assembled, values calculated.
If recovery fails, the case escalates with its complete history attached.
04 — Architecture
A lean, managed stack that survived four expansions without a rewrite. Select a module to zoom into how it works.
Page-per-role architecture with shared component patterns and a CSS-variable design system.
Role-based access mapping four profiles to the pages each team actually needs.
Real-time collections mirroring the operation: occurrences, users, collaborators, groups.
Email dispatch and two-way sync with the company's existing Google Sheets base.
Six dunning templates with variable interpolation, editable by admins with live preview.
Continuous deployment — every merge ships. The team is always on the latest version.
05 — Engineering notes
The "identified" criterion was simplified to a real name plus any contact — dropping the CPF requirement. A reclassification routine updated every existing record. Unidentified occurrences each get a unique user document, fixing a grouping bug where blank IDs collided.
Dashboard numbers query Firestore aggregates directly instead of summing the paginated list. The lazy load shows 50 records; the KPIs always reflect all of them. Small decision, real trust — the manager's numbers match reality.
Multiple occurrences from the same customer collapse into one group — invoice, agreement, or debt confession — with independently tracked installments. Settling the final installment resolves every linked occurrence automatically.
Light/dark mode is a CSS-variable layer with a single context toggle. Status colors, surfaces and shadows are tokens — the same components render both themes with zero conditional styling in JSX.
06 — Impact
07 — Continuous evolution
The platform ships weekly. The current engineering track moves it from a hardened internal product toward a multi-tenant SaaS.