Case Study · Backend Product Design
FairShare
A ledger-first expense tracker that prioritizes explainable balances, deterministic money handling, and safe retries for financially sensitive writes.
Most expense apps stop at balances. I wanted a system that could explain every balance, preserve history, and avoid corrupting money movement when clients retry requests.
Money handling
Deterministic scale-2 rounding with stable leftover-cent assignment
Safety
Idempotent expense creation and settlement confirmation
Auditability
Expense lifecycle events and confirmed transfers retained for explanation and history
What I built
Built the product architecture across a Spring Boot backend and Next.js frontend, with the backend centered on ledger effects, settlement flows, and explainability.
Results
Hard problems
Deterministic rounding and leftover cents
Equal, percentage, and share-based splits all leave residue at scale 2. The system normalizes amounts, makes rounding explicit, and assigns leftover cents in a stable order so retries and updates do not reshuffle money between users.
Safe retries on financially sensitive writes
Settlement confirmation and expense creation needed idempotency because duplicate writes immediately corrupt balances. I added explicit idempotency keys and confirmation IDs only where the correctness risk justified the complexity.
Editing expenses without ledger drift
Expense updates recalculate target shares, compute deltas against prior state, and adjust ledger effects transactionally. The service takes a pessimistic lock on the expense row to serialize concurrent edits safely.