
Integer vs Decimal Money Postgres: Two ERPs, Two Answers
I ship integer rupiah in one product and Decimal(15,2) in another. Here is how rounding, percentages, JSON and currencies decide which one wins.
Read MoreBlog
Articles on backend architecture, API design, and database patterns — NestJS, PostgreSQL, and building reliable server-side systems.
102 articles

I ship integer rupiah in one product and Decimal(15,2) in another. Here is how rounding, percentages, JSON and currencies decide which one wins.
Read More
Envoy AI Gateway became Agent Router. I read the rename post and the 1.2 release notes to see what stayed and what breaks for MCP and credentials.
Read More
When a service should call another and wait, and when it should publish a message instead: availability arithmetic, latency, failure handling, consistency, and the 202 Accepted hybrid.
Read More
Partitioning splits a table inside one database server, sharding spreads data across several servers. Postgres DDL, EXPLAIN output and a shard router.
Read More
Latency vs throughput explained: what each measures, how Little's law links them, why batching and queues trade one for another, and how to optimise both.
Read More
A Bloom filter is a bit array plus k hash functions that answers maybe or definitely not. See the m and k formulas, a measured error rate and real uses.
Read More
How does service discovery work in microservices? Registry, heartbeat and TTL, client-side vs server-side, DNS in Docker Compose and Kubernetes, Consul.
Read More
How leader election works in distributed systems: a Postgres lease with a fencing epoch, Redis and etcd alternatives, Kubernetes Lease objects and split-brain.
Read More
Pub/sub vs message queue: competing consumers versus fan-out, delivery guarantees, ordering, replay, consumer groups, and a checklist for jobs, notifications and events.
Read More
How the Raft consensus algorithm works: terms and roles, randomized leader election, log replication and the commit index, quorum arithmetic for 3, 5 and 7 nodes, safety, and where etcd and Consul use it.
Read More
Backpressure is how a slow consumer tells a fast producer to slow down. Learn bounded queues, load shedding, Node.js drain and queue-depth autoscaling.
Read More
What the bulkhead pattern is, how one slow dependency drains a shared pool, how to isolate with pools, semaphores, queues and containers, and how to size each one.
Read More
How to retry failed requests safely: which errors to retry, the retry storm arithmetic, exponential backoff with jitter, Retry-After, retry budgets and idempotency keys, with a runnable TypeScript helper.
Read More
ACID vs BASE with Postgres examples: what each ACID letter protects, why BASE is a pun and not a standard, and how to choose per feature.
Read More
What database transaction isolation levels are and which to use. PostgreSQL READ COMMITTED, REPEATABLE READ and SERIALIZABLE, shown with real two-session output and a retry loop.
Read More
How to design a distributed key-value store the Dynamo way: consistent hashing, N/W/R quorums, vector clocks, hinted handoff, Merkle trees, gossip and an LSM node.
Read More
How to design a flash sale system that does not oversell stock: atomic decrements in Postgres and Redis Lua, TTL reservations, a waiting room, sharded counters and reconciliation.
Read More
What eventual consistency guarantees, how replicas converge with LWW, version vectors and CRDTs, and which features can tolerate stale reads and which cannot.
Read More
Two-phase commit vs saga for distributed transactions: how 2PC blocks and holds locks, what PostgreSQL PREPARE TRANSACTION offers, and when a saga fits better.
Read More
How to design a payment system that never loses or double-charges money: a payment state machine, an append-only double-entry ledger in integer cents, idempotency keys, webhooks and daily reconciliation.
Read More
How do you design a web crawler that scales? A worked design: URL frontier, robots.txt under RFC 9309, dedup, DNS caching, crawler traps and recrawl scheduling.
Read More
How to design a distributed job scheduler that runs each job once: slot rows, Postgres SKIP LOCKED leases, advisory locks, catch-up, retries and idempotent handlers.
Read More
How to generate unique IDs across many servers: auto-increment limits, UUIDv4 index damage, UUIDv7 under RFC 9562, Snowflake's 41/10/12 layout, clock rollback and block allocation.
Read More
How do apps find nearby drivers or places? Geohash vs quadtree explained with TypeScript, PostGIS ST_DWithin, Redis GEOSEARCH and write-rate maths.
Read More