LedgerLine processed payouts through a five-year-old monolith where retries created duplicate charges, deploys required Sunday maintenance windows, and a single Postgres primary carried every read. Growth had stalled because the platform could not be trusted.
02 — Approach
What we built
We carved domains along money boundaries — ledger, payouts, reconciliation — each with typed contracts and idempotency keys. Reads moved to replicas with Redis caching, writes flowed through Kafka with exactly-once semantics, and Terraform codified multi-AZ infrastructure with per-PR preview environments.
Zero-downtime deploys; lead time from 11 days to under 8 hours
Reconciliation pipeline with drift alerts — finance closes in hours, not days
LedgerLine had product-market fit and a platform that punished growth: every traffic spike became an incident, every deploy a negotiation with finance. Fourteen weeks later, settlement was boring — the highest compliment infrastructure can earn.
We split the monolith into ledger, payouts, and reconciliation services with OpenAPI contracts generated from types. Each service owns its data; cross-domain reads go through versioned events, never direct table access. The strangler pattern kept the old rails running while traffic shifted slice by slice.
Payments fail mid-flight — webhooks time out, clients retry, queues redeliver. Idempotency keys on every mutation plus exactly-once Kafka consumers turned retries from a revenue risk into a non-event. Finance got a replay dashboard; engineering got sleep.
“APHYP didn't just rewrite our backend — they gave us a platform finance and engineering both trust. Settlement went from scary to boring.”