A single source of truth
When the same rule is duplicated across twenty places, you fix the bug in eighteen of them and miss two. The story that taught me to define every rule once — and the first time that principle broke down.
Technical content on code philosophy and tooling, written from real experience.
When the same rule is duplicated across twenty places, you fix the bug in eighteen of them and miss two. The story that taught me to define every rule once — and the first time that principle broke down.
Every layer has a hidden cost: mental overhead, meaningless indirection, and hard-to-trace behaviour. Not from malice — a bad layer with a fake name is worse than no layer at all. The story of a project that shipped seven layers, then spent weeks hunting a single line.
When a function silently returns None or False, the failure location migrates to its caller — which has no idea what happened. The story of a project that was 'succeeding' by accident, and the shift toward explicit exceptions that fail with an honest message.
Before reaching for asyncio.gather and hand-managed tasks, ask one question: does the library you are about to use ship its own concurrency primitive? Real stories of how Redis pipelines, httpx and aiohttp do the same job more efficiently and more correctly than hand-rolled concurrency.
Architecting background worker systems that never lose a job: at-least-once delivery, mastering idempotency against duplicated executions, and dead-letter queue strategies with exponential backoff.
The asyncio habits that kept my async code correct: who owns the loop, shielding background tasks, sealing shared context, and catching blocking calls before they deadlock. Every point backed by real experience in async bots and APIs.
From a fresh box, done right: a real user instead of root, hardened SSH, a firewall, fail2ban, unattended security upgrades, and a usable swap — all idempotent and repeatable. The steps I automated in debian-bootstrap so any new server is hardened in one pass.
Multi-stage builds, non-root runtime, real healthchecks, and a two-service compose file where the app starts only after Redis is actually healthy. Why the smallest image is not always the fastest, from the fastapi-forge experience.
Three ways to use Redis in FastAPI: a TTL cache, a sliding-window rate limiter in Lua, and a distributed lock with safe release. Same principle throughout: atomic single commands. How to combine them without an excess layer (from the fastapi-forge project).
Beyond the cache, Redis is more than a storage box — a native toolbox for queues, distributed locks, sorted sets and sessions. Real applications from redisjobs and fastapi-forge: atomic LMOVE, SET NX PX, ZSET, and pipelines instead of gather.
Real-time isn't just a /ws route: it's about handling state, reconnects, pruning dead sessions, and identifying clients by token. How to build a shared notification room cleanly — points from real projects using websockets.
How to turn a 3-second query into 4 milliseconds: mastering EXPLAIN ANALYZE, composite indexes and column ordering, expression indexes, and eliminating the N+1 problem in modern Async SQLAlchemy.
Why plaintext logs fail in modern production: migrating to structured JSON, passing correlation-ids across asyncio tasks, and correlating traces with performance metrics to slash Mean Time to Resolution (MTTR).
How to apply schema migrations in PostgreSQL without table locks or downtime: the expand-and-contract pattern, safe default column additions, and building indexes with CONCURRENTLY in Alembic.
Protecting modern FastAPI endpoints against real-world exploits: applying defense-in-depth, tiered rate limiting, eliminating data exposure through strict Pydantic models, and locking down CORS and HTTP headers.