Architecture decisions, things that broke, and what I learned along the way.
NOTE 01
Distributed systems
What Happens When Stripe Charges the Customer but Your Server Crashes?
A successful charge can outlive the server request that initiated it. I walk through a Node.js, PostgreSQL, Stripe, and Kafka design that records orders before payment, publishes events through a transactional outbox, and reconciles payment state through verified webhooks. An inbox makes repeated events safe; delayed retries and dead letter queues handle failures. Saga compensation refunds payments when fulfillment fails. The central lesson: design for repeatable business operations across systems that cannot share a database transaction.
Chapters (27)⌄
A practical guide to reliable distributed payment workflows using idempotency, Kafka, webhooks, transactional outbox, retries, DLQs, and Saga compensation.
Start With a Normal Database Transaction :
Stripe Changes Everything :
The Classic Failure
Idempotency Making Retries Safe :
Don’t Create the Order After Payment:
Initial Order Transaction:
Now We Need Kafka:
The Dual-Write Problem :
Transactional Outbox Pattern :
Payment Service Consumes the Event :
Stripe Web hooks Become the Durable Signal
The Inbox / Processed Events Pattern
Payment Success Transaction
Kafka Delivers PAYMENT_SUCCEEDED
The Hard Failure: Database Commit Succeeds but Kafka ACK Does Not
When Should We Commit the Kafka Offset?
What Happens When Processing Keeps Failing?
Retry With Exponential Backoff
But What If Payment Succeeded and Order Cannot Be Fulfilled?
Building a Real-Time E-Commerce ETL Pipeline with Kafka, Spark, and Airflow
I follow synthetic order events from a Python producer into Kafka, then use Spark Structured Streaming to write checkpointed Bronze Parquet data. Silver removes duplicate orders and invalid records; Gold builds dimensions and sales facts in PostgreSQL. Airflow schedules the batch transformations while streaming ingestion runs independently. The walkthrough explains local Docker compute, cloud object storage, repeatable writes, and the additional quality checks, deployment changes, and monitoring a production pipeline would need.
Building a Multilingual, Multi-Tenant RAG Engine in Django
How can a RAG API answer across languages without retrieving another customer's documents? I combine Django authentication with tenant-filtered pgvector searches and local multilingual E5 embeddings. Separate query and passage prefixes keep retrieval aligned with the model's training. Gemini receives only relevant context, with a distance threshold allowing the system to decline unsupported questions. The article connects those boundaries to ingestion, tenant quotas, source attribution, and the need to rebuild embeddings when changing models.
Chapters (12)⌄
Repo:
The problem statement:
Multi-tenancy, explained properly:
Multilingual Within a Tenant Understanding the Difference:
Authentication: tenant identity lives in the token:
This is the difference between a multi-tenant system and a data breach waiting to happen: the boundary is enforced by the token and the query filter, in that order, on every request.
Grounded generation, with an honest “I don’t know”:
I Built a RAG Back end in Django on PostgreSQL 18 + Windows. Here’s Every Way It Broke
A small CSV-to-answer backend became a debugging lesson in environment files, PostgreSQL schema permissions, installing pgvector on Windows, and mismatched AI providers. I describe moving to Gemini and aligning its embedding output with a 768-dimensional database column before ingesting 61 records. Cosine retrieval and a relevance threshold then ground answers in the stored material. The prototype also exposes its limits: row-based chunking, no reranking, provider quotas, and database privileges that need tightening before production.
Chapters (11)⌄
Everyone says RAG is five easy steps. It was five steps plus a guided tour of every way PostgreSQL can betray you on Windows.
The Plan (naive, doomed)
Boss Fight 1: settings.DATABASES is improperly configured
I like working through complex problems with people who care about the details. Have a product to build, an engineering role, or an interesting challenge? Let’s start a conversation.
Open to full-time roles, contract work, and conversations about things worth building.