How I built a billing system with a real double-entry ledger in Node + PostgreSQL (opens in new tab)
Most billing code has the same bug hiding in it: it stores the account balance as a number and mutates it — balance += amount. It works fine, right up until a payment gets entered twice, or you have to fix last month's reading, and suddenly nobody can explain how an account reached its current total. I learned the right way to do this building a real utility billing system (a client project that fell through — so I turned the engine into a product). The one decision that made it trustworthy: ...
Read the original article