Skip to main content

Blog

Backend & APIs

Articles on backend architecture, API design, and database patterns — NestJS, PostgreSQL, and building reliable server-side systems.

102 articles

Integer vs Decimal Money Postgres: Two ERPs, Two Answers
BackendOctober 202610 min read

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 More
Envoy AI Gateway Is Now Agent Router: What 1.2 Changes
BackendOctober 202612 min read

Envoy AI Gateway Is Now Agent Router: What 1.2 Changes

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
Sync vs Async Microservices Communication: How to Choose
BackendOctober 202611 min read

Sync vs Async Microservices Communication: How to Choose

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
Database Partitioning vs Sharding: What Is the Difference?
BackendOctober 202610 min read

Database Partitioning vs Sharding: What Is the Difference?

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: Differences, Trade-offs and Tuning
BackendOctober 202610 min read

Latency vs Throughput: Differences, Trade-offs and Tuning

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
Bloom Filter Explained: Where It Fits in System Design
BackendOctober 202611 min read

Bloom Filter Explained: Where It Fits in System Design

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
Service Discovery in Microservices: How It Works
BackendOctober 202611 min read

Service Discovery in Microservices: How It Works

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
Leader Election in Distributed Systems: Leases and Fencing
BackendOctober 202612 min read

Leader Election in Distributed Systems: Leases and Fencing

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: Differences and When to Use Each
BackendOctober 202610 min read

Pub/Sub vs Message Queue: Differences and When to Use Each

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
Raft Consensus Algorithm Explained: Elections and Logs
BackendOctober 202614 min read

Raft Consensus Algorithm Explained: Elections and Logs

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 in Distributed Systems: Stop a Fast Producer
BackendOctober 202611 min read

Backpressure in Distributed Systems: Stop a Fast Producer

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
Bulkhead Pattern Explained: Isolate Failures in Backend Systems
BackendOctober 202611 min read

Bulkhead Pattern Explained: Isolate Failures in Backend Systems

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
Retry with Exponential Backoff and Jitter in TypeScript
BackendOctober 202613 min read

Retry with Exponential Backoff and Jitter in TypeScript

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: Database Consistency Models and When It Matters
BackendOctober 202611 min read

ACID vs BASE: Database Consistency Models and When It Matters

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
Transaction Isolation Levels Explained in PostgreSQL
BackendOctober 202613 min read

Transaction Isolation Levels Explained in PostgreSQL

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
Design a Distributed Key-Value Store, Dynamo-Style
BackendOctober 202613 min read

Design a Distributed Key-Value Store, Dynamo-Style

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
Design a Flash Sale System That Never Oversells Stock
BackendOctober 202614 min read

Design a Flash Sale System That Never Oversells Stock

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
Eventual Consistency Explained: When Is Stale Data Acceptable?
BackendOctober 202610 min read

Eventual Consistency Explained: When Is Stale Data Acceptable?

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: Distributed Transactions Compared
BackendOctober 202610 min read

Two-Phase Commit vs Saga: Distributed Transactions Compared

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
Design a Payment System: Ledger, Idempotency, Reconciliation
BackendOctober 202614 min read

Design a Payment System: Ledger, Idempotency, Reconciliation

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
Design a Web Crawler: URL Frontier, robots.txt and Dedup
BackendOctober 202614 min read

Design a Web Crawler: URL Frontier, robots.txt and Dedup

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
Design a Distributed Job Scheduler That Runs Each Job Once
BackendOctober 202613 min read

Design a Distributed Job Scheduler That Runs Each Job Once

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
Distributed ID Generator: Snowflake vs UUIDv7 vs ULID
BackendOctober 202612 min read

Distributed ID Generator: Snowflake vs UUIDv7 vs ULID

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
Geohash vs Quadtree: How Nearby Driver Search Works
BackendOctober 202614 min read

Geohash vs Quadtree: How Nearby Driver Search Works

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

More in this category