A 40-post series that follows FotoFlow, a photo app, from one server and 100 users to 10 million users with direct messages. One problem, one fix, one honest cost at a time.
Craft & Skills
Durable developer practice: judgment, verification, system design, and workflow with AI.
The final design: 20 million open sockets and a promise that every message arrives, in order, exactly once. Dumb gateways, a connection registry, store-first durability and sync by cursor.
The home feed must load in 200 ms from two hundred followed accounts. Fan-out on read melts at 4.6 million lookups a second; fan-out on write melts on celebrities; the hybrid survives both.
The first full design walkthrough: turn a one-line brief into numbers, the simplest system, then fix codes, caching, storage and abuse one bottleneck at a time. The method is the point.
Two engineers draw FotoFlow's architecture: one produces classes, the other boxes, and both miss the real problems. The map and the room are two different documents, joined by contracts.
A Friday SSH deploy goes down for four hours and nobody knows which of thirty changes broke it. CI, one artifact promoted everywhere, blue-green, canaries and feature flags fix the ritual.
A one-cent rounding bug reaches thousands of orders because someone clicked through a test server by hand. Unit, integration, contract and e2e tests answer what else broke in minutes.
A lost backup disk, a certificate expiring at 3am, an API key committed to git. TLS in transit, envelope encryption at rest, and real secret management cover what authentication cannot.
A logged-in user changes one number in the URL and opens a stranger's private album. Object-level checks, 404 over 403, allow-lists and row-level security decide what they may see.
A million accounts now, and the first 'that was not me' tickets arrive. Hashed passwords with argon2id, safe cookies, single-use resets, and short-lived tokens decide who gets in.
A stats query scans hundreds of millions of rows on the production database while users wait. Batch with map, shuffle and reduce keeps analytics off it, and streaming answers in seconds.
A premium upgrade creates the subscription, then the card charge fails. No transaction spans five databases, so the saga pattern commits step by step and undoes with compensating actions.
The autoscaler replaces a photo server at 3 a.m., and the feed service keeps calling the corpse. Service registries, readiness versus liveness, draining, sidecars, and the one front door.
One weekly release where a feed bug delays everyone, and one memory leak that takes uploads down with it. What splitting by business capability buys, what it costs, and the strangler fig way to move.
FotoFlow's feed takes 2.4 seconds and every server looks healthy. Metrics say where it hurts, traces show which hop, logs explain why, and the post-mortem keeps it from happening twice.
FotoFlow's payment provider starts answering in 30 seconds, and the order service slowly loses all 200 threads. Timeouts, backoff with jitter, circuit breakers, and not charging the same card twice.
A customer's buggy script calls FotoFlow 5,000 times a second and everyone else times out. No attack, just no fairness rule. Token buckets, shared counters, and when to drop work on purpose.
Every FotoFlow component is up 99.9% of the time, yet the site still loses 26 hours a year. Redundancy, availability zones, and why most real outages are your own deploys.
FotoFlow's notifications only appeared after a pull-to-refresh, because plain HTTP cannot push. From polling to WebSockets, and what a million open connections cost.
The upload handler calls email, thumbnails, analytics and loyalty directly, so one flaky email service can stop all uploads. Publish one event instead, and let everyone subscribe.
A FotoFlow upload used to resize six versions while the phone watched a spinner. One busy morning the API ran out of threads. A queue turned minutes of waiting into milliseconds of confirmation.
FotoFlow's mobile app is loading whole photo collections to show one screen, and every new phone feature means a new endpoint. Three API styles, three different problems they solve.
FotoFlow stores photos as binary blobs in the database, and at 100,000 users the backups now take days. The fix is a split: bytes in object storage, facts in the database.
Two users tap like on the same photo within the same millisecond. FotoFlow's like counter goes up by one instead of two. Here is how databases stop two writes from silently eating each other.
FotoFlow's five-node database cluster needs failover. A timeout cannot tell dead from unreachable, and getting it wrong sells one seat twice: split brain.
FotoFlow runs in two regions and an undersea cable just died. Both copies are alive, both have users, and the last print is sellable exactly once. Choose.
FotoFlow has 50,000 users and three shards, and two shards just handed out the same order id. Counters stop being unique the moment you split a database.
FotoFlow's six cache nodes are picked with hash modulo N. One node dies and 80 percent of keys remap at once: a stampede that flattens the database.
FotoFlow's database has hit 20 terabytes and 40,000 writes a second. Replication copies all the data everywhere; only splitting the data itself scales writes and storage.
FotoFlow's single database is 90 percent busy and one crash away from total outage. Replicas fix both, then introduce lag, failover, and split brain.
FotoFlow has 15,000 users and a write-heavy table that crawls even with good indexes. The problem is not the queries; it is the storage engine underneath them.
FotoFlow has 10,000 users and the feed query takes two seconds. The database is not too small; it is reading fifty million rows to find one. An index fixes it in milliseconds.
FotoFlow has 10,000 users and the schema is about to be locked in. Tables, documents, or plain keys: each kind of database buys something and quietly gives something up.
FotoFlow's servers sit in Virginia, and a Sydney user waits 200 milliseconds per round trip while a page needs many. You cannot speed up light, but you can move the copies closer.
FotoFlow has 5,000 users and the database is 92 percent busy, because every page asks it for the same popular photos. A cache answers the hot reads in a millisecond, if you keep it correct.
FotoFlow has three servers and a load balancer, and now Alice's cart appears on one page and vanishes on the next. State is the invisible thing that pins users to one machine.
FotoFlow now runs three servers, but users only know one address, so every request lands on Server B while A and C idle. A load balancer becomes the front door, and its rules decide everything.
FotoFlow has 2,000 users and the lone server is pinned at 100 percent CPU. One decision forks the whole architecture: buy a bigger machine, or add more of them.
FotoFlow is still one server, but growth is coming. Five minutes of rough arithmetic tells you how many servers, terabytes, and gigabits per second you will need before you build anything.
FotoFlow has 500 users and one server getting crowded. Latency and throughput answer two different questions, and mixing them up makes you buy the wrong fix.
FotoFlow has 100 users on one server, and someone says the feed feels slow. Before touching anything, follow one page load hop by hop and see where the 155 ms really goes.
AI can hand you the answer to any bug in seconds. The skill you lose is knowing why the answer is wrong.
AI assistants write code quickly, but security review and verification cannot keep pace, so engineering judgment becomes the bottleneck.
Workflow automations fail overnight not because logic is wrong, but because nobody designed them to tolerate failure when no one is watching.
Adding a reviewer to an AI workflow does not create oversight. The real question is which actions stop for a human, and whether that human can catch the error.
Networks fail, so your automation retries. Without idempotency, every retry risks a duplicate charge, ticket, or order, and the HTTP spec will not save you.
Visual workflow tools promise speed, but every node you drag instead of code you write accrues a debt your team pays later.
A service hiccups, every client retries at once, and the hiccup becomes a full outage. Retries are not free; they multiply demand on a system already struggling.
Your team investigates in one system and responds in five others. The handoffs, not the tools, are what slow you down during incidents.
Multi-API workflows break between services, not inside them. Testing effort is rising fast, but ownership of the seams stays murky.
n8n is becoming enterprise infrastructure via SAP, but two critical sandbox escapes show the containment you rely on can silently fail.
Webhooks arrive as POST requests, and POST is not idempotent. If your handler does not deduplicate by event ID, a repeated delivery becomes a repeated action.
AI output ships faster, but responsibility does not transfer with it. Naming a human owner is the minimum, not the system.
When a machine states something fluently, your own biases decide whether you push back. Three old ideas explain why that fails.
A new study found people who solved problems with ChatGPT gave up faster and performed worse once the tool was taken away. Here is what that means for your team.
Teams ship more code than ever with AI, yet delivery stability drops. The bottleneck moved from typing speed to engineering judgment.
You read, you cram, you forget. Metacognition, spacing, and transfer explain what fast learning actually requires.
Agents now run for hours or days, but most orchestration frameworks were built for tasks that finish in minutes. Nobody owns the gap.
Reviewers who only hunt for bugs miss the design and complexity problems that cost you later. Google's own guide explains why.
AI now writes most first-draft code, yet clear writing decides who thrives. The tension: it may not save you from a shrinking market.
Firms promote great coders to architect, then wonder why systems drift from business goals. The gap is not technical depth; it is a job nobody defined.
Your services can be beautifully written and still fail together. The boundaries between components, not the code inside them, decide how failures spread.
AI writes code quickly, but without shared domain boundaries and architecture, speed just multiplies confusion between teams and systems.
Your component library works. The system fails because nobody owns maintenance, adoption, and what counts as finished.
Most architecture diagrams mix audiences and detail levels into one picture. The C4 model fixes this with four zoom levels, each for one reader.
You adopted events for decoupling and lost debugging, ordering, and clear schemas. Notification, state transfer, or sourcing: pick wrong and EDA hurts you.
Your product still ships. The layer connecting your systems is what slows it down, and attackers target it first.
Splitting a monolith can double your pain: many teams end up with a distributed monolith that deploys like one app but fails like many.
Your requirements will be wrong before launch. The fix is not better prediction, it is separating what changes slowly from what changes fast.