The problem
A home equity operation goes through many hands (partner, analysis, legal, payment) and every stage requires documents and checks. Without a single place, operations stalled and nobody knew which stage they were in or what was missing to move on.
E-mail is a service with no tables. Whoever needs to send uses MailClient from libs/mail: it builds the text from the template in the person's language and makes an asynchronous POST /emails with a service token. The mail service only turns that into SMTP.
Decisions and why
- @Async in the client
- "Forgot password" answers immediately; sending happens afterwards and never breaks the request.
- Templates in the library, per language
- password-reset_pt.txt and password-reset.txt: the text lives in a file, not in code, and falls back to the default language.
- Service token
- Only services with the right scope send e-mail; mail does not accept user calls.
- mail owns no tables
- It only turns HTTP into SMTP. Less state, nothing to migrate, Mailpit instead of SMTP in dev.
requestresponse
Pick a scenario above to watch the message travel through the architecture.
What it looks like
Replica of the pipeline board with fictional data (internal system) esteira.evilrabbit.com.br/lines/triage
Triagem
Conferência de dados2
Marina SouzaGMR$ 480 mil 1 d
Paulo HenriqueR$ 1,2 mi hoje
Combate à fraude1
Ricardo AlvesAPR$ 750 mil 4 d
Validação dos documentos2
Carla PradoGMR$ 610 mil 2 6 d
João ReisR$ 295 mil 2 d
Aguardando aprovação0
Nada aqui