Articles

Technical content on code philosophy and tooling, written from real experience.

Code philosophy

A single source of truth

Code philosophy ريفاكتورهندسة كودتجربة

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.

10 October 2026 · 6 min read Read

Against excess layers

Code philosophy هندسة كودتبسيطتجربة

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.

12 October 2026 · 5 min read Read

Exceptions over failure indicators

Code philosophy معالجة أخطاءتجربة

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.

13 October 2026 · 5 min read Read

Native concurrency first

Code philosophy التزامنasyncioRedis

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.

13 October 2026 · 6 min read Read

Resilient Background Task Architecture: Queues, Retries, and Idempotency

Code philosophy ArchitectureQueuesConcurrencySystems

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.

15 October 2026 · 8 min read Read

Engineering in practice

asyncio in practice

Engineering in practice asyncioPython

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.

13 October 2026 · 7 min read Read

Deploying on Debian without fear

Engineering in practice DebianSystem

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.

13 October 2026 · 8 min read Read

Docker for Python, practically

Engineering in practice DockerPython

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.

13 October 2026 · 7 min read Read

FastAPI + Redis — cache, rate limit and lock together

Engineering in practice FastAPIRedis

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).

13 October 2026 · 8 min read Read

Redis beyond the cache

Engineering in practice RedisPython

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.

13 October 2026 · 7 min read Read

WebSockets in FastAPI without magic

Engineering in practice WebSocketsFastAPI

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.

13 October 2026 · 8 min read Read

PostgreSQL Indexing and Query Optimization for Python APIs

Engineering in practice PostgreSQLDatabasePythonPerformance

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.

14 October 2026 · 9 min read Read

Structured Logging and Distributed Tracing in Production

Engineering in practice ObservabilityLoggingPythonTracing

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).

14 October 2026 · 8 min read Read

Zero-Downtime Database Migrations with Alembic

Engineering in practice DatabaseAlembicPostgreSQLDevOps

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.

15 October 2026 · 8 min read Read

Hardening API Security: Defense in Depth and Layered Rate Limiting

Engineering in practice SecurityFastAPIArchitectureAPI

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.

15 October 2026 · 8 min read Read