Writing
Blog
Engineering notes, architecture decisions, and the occasional post-mortem.
The settlement job that quietly wrote NaN: a Prisma Decimal post-mortem
How PlayZeet's bet-settlement job started writing amount: NaN with no error, why Prisma.Decimal arithmetic silently coerces, and the boundary fix that closed the whole class of bug.
Integrating NOWPayments crypto payments in NestJS without double-crediting wallets
A production guide to NOWPayments in NestJS: verifying IPN webhooks (the sorted-key HMAC-SHA512 gotcha), idempotent wallet crediting, BullMQ reconciliation, and whitelist + TOTP payouts.
Peer-to-peer betting is a correctness problem wearing a socket costume
The real architecture behind a P2P betting backend: a matching engine that never double-matches, an idempotent pari-mutuel settlement job, and a BullMQ + Redis queue layer that makes webhooks safe to replay.
Prisma Decimal is not a number: the silent NaN that corrupts money math
Why adding two Prisma.Decimal values produces NaN with no error, how it poisons a ledger, and the boundary-normalization pattern that makes the whole class of bug impossible.