Topic · 9 posts

Backend

Everything on LoomLoops tagged Backend, newest first.

All Backend posts

Payment Reconciliation in SQL: Match Your Ledger to the Bank

Payment reconciliation in SQL: match every ledger row to the provider's report and every payout to one bank deposit, then explain what is left over.

Double-Entry Ledger in Postgres: Enforce the Rules in the Database

Double-entry ledger design in Postgres: a deferred trigger rejects unbalanced transactions at COMMIT, and row locks in id order stop two payouts overdrawing.

How to Store Money in a Database Without Losing Cents

Store money in a database as integer minor units plus a currency code. Why 19.99 * 100 loses a cent, why yen and dinars break 'cents', and how to split 10.00.

The Transactional Outbox Pattern, Explained Simply

How the transactional outbox pattern fixes the dual write problem, with diagrams, Postgres SQL, polling vs CDC, ordering, duplicates and the metric to watch.

Idempotency Keys Explained: How to Make API Retries Safe

What idempotency keys are, why every payments API uses them, and how to build them on the server with Postgres, with diagrams, SQL and common mistakes.

Postgres as a Job Queue: How SKIP LOCKED Works (and When It Breaks)

How to build a reliable job queue in PostgreSQL with FOR UPDATE SKIP LOCKED, with copy-paste SQL, diagrams, and the three ways it breaks in production.

SQLite in Production: Settings for a High-Traffic Website

SQLite in production: the PRAGMA settings, WAL mode, one-writer pattern, checkpoints and Litestream backups for a busy site, and when to pick Postgres.

PostgreSQL Locks Explained: How to Find and Fix Blocking Queries

PostgreSQL locks explained: how one slow SELECT and a quick ALTER TABLE can stop a site, how to find blockers with pg_locks, and how to migrate safely.

SQLite Locking: Why You Get 'database is locked' and How to Fix It

How SQLite locking works, why you get 'database is locked' (SQLITE_BUSY) even with a busy timeout, and how WAL mode and BEGIN IMMEDIATE fix it.

Other topics