Bank Management System
TypeScript · Express 5 · PostgreSQL · Prisma · DockerRetail banking REST API: accounts, deposits, withdrawals and transfers.
- Locked every account a request touches with SELECT … FOR UPDATE in id order, so racing transfers queue instead of losing updates or deadlocking; a test fires 10 parallel withdrawals of 30.00 at 100.00 and asserts exactly 3 succeed. code test
- Built idempotent payments: an
Idempotency-Keyreplays the original result on retry, a reused key with a new body returns 422, and a unique index settles racing duplicates. code - Money as BigInt minor units in a double-entry ledger whose credits minus debits must equal total balances, with
CHECKconstraints as a last line of defence. code code - Refresh tokens stored only as SHA-256 hashes; replaying a rotated token revokes the whole token family. code