
OTP Service
A Go microservice that generates, e-mails and verifies one-time codes for my projects.
A reusable service for e-mail verification, login codes and password-reset links, shared across personal projects (My Market List uses it in production). Each project has its own API keys, sender, locale, rate limits and purposes (signup, login, reset_password, change_email), each with its own kind (6-digit code or link token), TTL, max attempts and cooldown. It ships with HTML + text templates in pt-BR and en, OpenAPI docs, ADRs, health checks, Prometheus metrics, Docker Compose for local dev and a Render deploy.
Codes are short (10⁶ combinations), so the service must resist brute force and leaks — and stay correct under concurrent requests — while remaining simple to plug into any backend.
Hexagonal architecture with a pure domain; codes generated with crypto/rand and stored only as HMAC-SHA256 with a secret pepper; atomic Redis operations via Lua scripts; fixed-window rate limiting per e-mail, IP and project with Retry-After; an in-memory e-mail queue with graceful shutdown; and a stable error contract (RFC 7807).
One service that all my apps reuse for verification flows, covered by unit tests with -race, Redis integration tests via testcontainers, lint and govulncheck in CI.


