How the Machinery Actually Works
Long-form engineering writing with diagrams you can poke at. No launch posts and no listicles: one system per article, taken apart until the surprising part is obvious.
Start here
CloudWhat Is Serverless, Really? The Honest Cost, Limits and Payoff
Serverless is not "no servers". It is a usage based renting a system that bills on usage milliseconds rather than by the hours provisioned. Here are the pros and cons and hard limitations.
8 min readRead the postSystem Design Deep Dives
Token bucket, sliding window, and the distributed implementation nearly everyone writes first — which lets through roughly twice the limit under concurrency, silently, and only at scale.
- 1Rate Limiting: Every Algorithm, and the Race Condition in the Obvious OneToken bucket, sliding window, and the distributed implementation nearly everyone writes first — which lets through roughly twice the limit under concurrency, silently, and only at scale.8 min read
- 2Building a News Feed: Fan-Out on Write, on Read, and Why You End Up Doing BothEvery feed design is one question — do you do the work when someone posts, or when someone looks? Both answers are wrong at the extremes, which is why every large platform runs a hybrid.7 min read
- 3A Payments Ledger: Why It's Append-Only, and What Idempotency Keys Actually ProtectA balance column is the wrong data structure for money. Here is the double-entry ledger that replaces it, and the retry semantics that stop a network timeout from charging someone twice.7 min read
- 4Caching in Front of a Database: Invalidation Is the Easy HalfThe hit ratio is arithmetic and the eviction policy barely matters. What actually pages you is the moment one hot key expires and every in-flight request becomes a database query at the same instant.9 min read
- 5Queues and Logs: "Exactly Once" Is a Property of Your Handler, Not Your BrokerThe broker cannot deliver exactly once and no vendor page will tell you that plainly. Here is what the guarantees actually mean, why a log is a different product from a queue, and where the duplicates come from.9 min read
- 6Sharding a Database: The Key You Pick Is the One Decision You Cannot Undo CheaplySplitting a table across machines is easy. Choosing what to split it on decides your skew, your query fan-out and your migration cost simultaneously — and the obvious keys are wrong in three different ways.8 min read
- 7Typeahead: The Only Feature Whose Deadline Is Set by the User's HandsSearch-as-you-type is not a search problem with a lower latency target. The deadline is the next keystroke, which means the answer has to exist before the question is asked.8 min read
- 8Building Chat: "Sent" Is Four Different Facts and the Tick Only Shows OneThe transport is the easy part. What makes a messaging system hard is that a recipient is several devices, ordering cannot come from anyone's clock, and every checkmark is a claim you have to be able to defend.7 min read
- 9Video Streaming: You Are Not Serving a File, You Are Serving Six Thousand of ThemThe upload is a job queue, the playback is a control loop, and the delivery is somebody else's network. Here is what actually happens between someone pressing upload and someone else pressing play.8 min read
- 10Matching Riders to Drivers: The Index Is Easy, the Write Rate Is NotFinding the nearest driver is a solved problem. Doing it while every driver moves every four seconds, at a cell boundary, without two riders being promised the same car — that is the system.7 min read
Context Engineering
Prompt engineering is what you write. Context engineering is everything else the model sees — and the window is a budget you spend against space, cost and attention at once.
- 1Context Engineering: The Window Is a Budget, Not a ContainerPrompt engineering is what you write. Context engineering is everything else the model sees — and the window is a budget you spend against space, cost and attention at once.10 min read
- 2Context Engineering: History, Tool Output, and What to MeasureRetrieval is the context you choose. Conversation history and tool results are the context that arrives whether you look at it or not — and together they are usually the bigger half.10 min read
Everything else we have written
- NetworkingWebSockets vs. Server-Sent Events: When to Use WhatBoth push data to the browser without polling. They are not interchangeable — one is bidirectional and stateful, the other rides plain HTTP and reconnects itself. Picking wrong costs you infrastructure, not correctness.7 min read
- NetworkingHTTP/3: What's New, and Where It Actually Earns Its KeepHTTP/3 doesn't run on TCP. That one sentence explains most of what changed — and most of why it helps some sites a lot and others barely at all.9 min read
- Build it yourselfLet's Build Tree-sitter: How Your Editor Parses Code On Every KeystrokeRegex-based syntax highlighting has been wrong for thirty years. Here is the parser that replaced it — incremental, error-tolerant, and fast enough to run between keystrokes.8 min read
- Build it yourselfLet's Build a Secure Wallet: Keys, Signatures and Every Way It LeaksA wallet holds no money. It holds a key — and every wallet that has ever been drained lost that key in one of about six ways. Here is the design that closes them.8 min read
- DatabasesWhat Postgres Actually Does With Your DataAn UPDATE never touches your row in place, a COMMIT does not mean your data is on the heap file, and your index is sometimes ignored on purpose. Here is the machinery underneath all three.9 min read
- Build it yourselfLet's Build a Load Balancer From ScratchPicking a backend is one line of code. Everything that makes a load balancer trustworthy — health checks, draining, hashing, backpressure — is the other ten thousand.9 min read
- Infrastructuren8n vs. Kestra vs. Airflow: Picking an OrchestratorAll three run steps in order and retry what fails. They were built for three different people — and that, not the feature list, decides which you run.9 min read
- ProtocolsThe Magic of WebSockets: How Your App Stays Live Without AskingWebSockets replace "are we there yet" with a phone line that stays open. Here is the handshake, the framing, what HTTP/2 changed, and the limits you should know.9 min read
- Build it yourselfLet's Build a URL Shortener That Survives a Billion LinksA URL shortener is the smallest system that still has every hard problem in it — key generation, read/write asymmetry, caching, abuse. Here is the whole design.7 min read
- InfrastructureWhat a CDN Actually Does (And When You Genuinely Don't Need One)A CDN is not a speed setting. It is a cache on the network, here is what it caches, why distance costs milliseconds, and when a single origin cache is the better answer.10 min read