Blog

Thoughts on backend engineering, payment systems, and things I've learned.

Designing A/B Testing for a Server-Driven UI

When the server already composes every screen, a variant is just a different presenter. The hard parts are elsewhere: stable assignment, honest exposure logging, and making sure a variant never reaches an app that can't render it. A design write-up, before the first experiment runs.

5 min read

One Cause Behind Three Broken Metrics

An event-loop gauge stuck at 1.000, every HTTP span emitted twice, and negative connection counts — three symptoms across a fleet of 200+ Node.js services that looked like configuration problems and turned out to be one caret in a package.json.

4 min read

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.

9 min read

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.

5 min read

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.

9 min read

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.

9 min read

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.

6 min read