Blog
Thoughts on backend engineering, payment systems, and things I've learned.
Building a Type-Safe Server-Driven UI Framework in TypeScript
The architectural decisions behind MACHBANK's SDUI framework — factory functions over classes, discriminated unions for compile-time safety, header-based protocol versioning, and the TypeScript trick that made it all type-safe.
Why Every Financial Flow Deserves a State Machine
The pattern that shows up in every payment system worth trusting: explicit states, atomic transitions, and a clear answer to 'where are we?' — applied to both a real-time QR payment flow and a daily financial settlement system.
Designing a Daily Financial Settlement System That Can't Run Twice
How we built MACHBANK's automated provider compensation flow — a five-step event-driven state machine that moves money across bank accounts every business day, handles Chilean holidays, reconciles two independent amounts, and guarantees exactly-once execution per step.
How We Cut Auth Latency 20x by Removing the Database
The story of rewriting MACHBANK's SDK channel authentication layer — what profiling revealed about a six-phase OAuth PKCE flow backed by MongoDB, why the Lambda authorizer was calling a microservice on every single request, and the specific decisions that eliminated both bottlenecks.
How Two Functions Gave Us Full Visibility Into Every External Provider
When your platform depends on third-party providers, blind spots are expensive. This is the story of how a single wrapper function over Axios gave MACHBANK real-time dashboards, status code breakdowns, latency tracking, and webhook analytics — without touching any business logic.