System Prompts Are Not Afterthoughts - They Are Your Architecture

Most teams treat the system prompt as a text field. Someone pastes a paragraph into a string literal, the demo works, and it ships. Then three weeks later a support engineer tweaks one sentence to fix a single bad conversation, redeploys, and the app quietly starts returning malformed JSON for 4% of requests. Nobody notices for a day because there is no test that would catch it. That is what a system prompt actually is: the highest-leverage, least-governed piece of code in your entire application. ...

13 min

Design a Distributed Job Scheduler - System Design

Everyone thinks a job scheduler is a while loop with a sleep. “Check the clock, if a job is due run it, sleep a second, repeat - cron already does this, it is fifty lines.” That mental model survives exactly until the interviewer asks the questions that turn it into a real system: you run three copies of the scheduler for availability, so when a job comes due, does it fire once or three times? The scheduler process was down for ten minutes during a deploy - the 2am backup job never fired, is it gone forever or does it run late? A job takes an hour and the worker running it crashes at minute 55 - does anyone notice, and does it restart from scratch or double-charge the customer? You have ten million jobs due at midnight because everyone set their cron to 0 0 * * * - does the whole system fall over at the top of the hour? ...

34 min

Design a Food Delivery System (Swiggy / Zomato) - System Design

“Design Swiggy” looks like a restaurant catalogue with a Buy button. Browse restaurants, tap dishes into a cart, pay, wait for food. The interviewer lets that picture stand until they ask the question that breaks it: a single order is a contract between three independent parties who do not trust each other and are never all online at once - a customer who has already paid, a restaurant that has to accept and cook, and a delivery partner who has to be found, sent to the restaurant, and routed to the door. None of them is under your control. The restaurant can reject. The partner can cancel at the pickup. The customer can change the address mid-cook. And the whole thing has a hard 40-minute deadline before the food is cold and the order is a refund. ...

31 min

Design Google Maps / Nearby Search - System Design

“Design Google Maps” sounds like it is about drawing a map. It is not. The map tiles are the easy, cacheable part. The interviewer is really asking two hard questions stacked on top of each other. First: there are hundreds of millions of places on Earth - restaurants, petrol pumps, ATMs, chemists - and a user standing on a street corner types “coffee” and wants the ten nearest open cafes, sorted, in under a second. How do you find “things near this point” out of a planet’s worth of static points without scanning the whole globe? Second: that same user then taps one of those cafes and asks for directions, and you have to compute the fastest route across a road graph with hundreds of millions of edges, weighted by live traffic, in a few hundred milliseconds. How do you plan a shortest path across a continent without running Dijkstra over the entire road network on every request? ...

28 min

Streaming LLM Responses Without Making Your UX Feel Broken

Streaming looks solved. You flip stream=True, loop over deltas, append text to a div, and the demo feels magical. Then it ships, and the bug reports start. The response cuts off halfway on flaky mobile connections. The JSON you were parsing mid-stream throws because you got half a key. A tool call fires but your renderer already committed to showing text. A user hits stop and the backend keeps burning tokens for another thirty seconds. ...

11 min

The Rupee Cost of Starting Your SIP Five Years Late

“I will start next year, once my salary jumps and the car loan is done.” It sounds responsible. Delay a five-year plan by five years and you have lost one-sixth of it, so surely the damage is one-sixth, about 17%. It is not. A five-year delay on a 30-year SIP runway does not cost you 17% of your corpus. It costs you roughly 46% of it. On a ₹10,000/month SIP aimed at retirement, that gap is about ₹1.61 crore of wealth that simply never gets created. ...

8 min

Build Your Own MCP Server - The Tutorial Nobody Wrote

Search “MCP server” and you get a thousand guides that all stop at the same place: paste this JSON into your Claude config, restart, done. That is installation. Nobody writes the other half - how to actually author a server, wire it to a real backend, protect it with auth, and ship it so other people can install it. This post is that half. I have shipped a couple of internal MCP servers over the last few months. The protocol is simple, but the gap between “works in Claude Desktop on my laptop” and “a thing other engineers can trust” is wide, and it is mostly made of the parts the tutorials skip. So we will build a real server end to end: a task tracker that reads projects, runs tools, authenticates callers, and publishes to the registry. ...

10 min

Design a Distributed Unique ID Generator - System Design

Almost every large system needs one boring-sounding thing: a way to mint unique identifiers. Tweet IDs, order IDs, message IDs, row keys. It sounds trivial until you write down the real constraints: the IDs must be unique across thousands of machines, they must be generated at hundreds of thousands per second, no single box is allowed to be a bottleneck or a point of failure, and (the part people miss) they should be roughly sortable by creation time so you can use them as primary keys and range-scan recent data. ...

22 min

Design a Key-Value Store (like DynamoDB) - System Design

A key-value store looks like a solved problem for about thirty seconds. “Put a value under a key, get it back later, it is a hash map.” Then the interviewer says: it has to survive a machine catching fire, it has to stay writable when the network splits the cluster in half, it has to hold petabytes across thousands of nodes, and two clients are going to write the same key at the same instant from two different data centers. Now every easy answer is wrong. Which node owns a key when nodes are constantly joining and leaving? If you replicate a write to three nodes and one is down, do you fail the write or accept it? When two writes race, which one wins, and how do you even know they raced? And can the caller ask for “fast and maybe stale” on one request and “slow and correct” on the next? ...

29 min

Design a Metrics and Monitoring System - System Design

Everyone thinks a monitoring system is a database with a graph on top. “Every server writes its CPU and memory somewhere, you draw a line chart, and you send an email when the line goes red.” Then the interviewer adds the constraints that turn it into a real system: it is not a hundred servers, it is millions of time series reporting every few seconds; the same metric name with a slightly different label becomes a brand-new series, so a careless user_id label can explode your storage a thousandfold overnight; a query for “p99 latency across the fleet for the last 30 days” must not scan a trillion raw points; and an alert that fires two minutes late during an outage is worse than useless because the pager is how you find out production is down. ...

32 min

Small-Cap SIP: What 15-Year Rolling Returns Actually Show

A small-cap fund SIP page will show you one number: “18% CAGR since inception.” It will not show you that the same fund made you sit on a losing SIP for four straight years between 2018 and 2020, or that had you needed the money in December 2019 instead of December 2021, your 15-year outcome would have been 30% smaller on identical contributions. Small-cap SIPs do build serious wealth. But the headline return is an average that quietly assumes you held through the worst equity drawdowns available in the Indian market without flinching, and that you were lucky enough to redeem in an up-year. Change the exit year by 24 months and the entire result moves. This post runs the rolling 15-year windows so you can see what the holding period actually demands. ...

9 min

Design a Distributed Message Queue (like Kafka) - System Design

Everyone thinks a message queue is a list. “Producers push messages onto the back, consumers pop them off the front, done - it is a queue, the name is right there.” That mental model survives exactly until the interviewer asks the questions that make it a real system: what happens when the consumer crashes halfway through a batch, does the message come back or is it gone? What happens when you have a thousand consumers and one queue, how do they share the load without stepping on each other? What happens when the broker holding your messages dies, are the messages gone with it? And when the network retries a publish, does the message land once or twice, and who pays for the duplicate? ...

34 min

Design YouTube / a Video Streaming Platform - System Design

A video platform looks trivial for about five seconds: POST /video to upload, GET /video to play. Then you remember that one uploaded file is a 4GB 4K master that has to become a dozen different renditions, that a viewer on a train switching between 5G and a tunnel needs the stream to drop from 1080p to 240p without stalling, that the actual bytes are served to billions of people from machines physically close to them and never from your origin, and that the view counter under the video is being incremented tens of thousands of times per second on the popular ones. The upload button is the easy 1%. The real system is this: turn one giant immutable master file into many small streamable segments, store those segments once and serve them from the edge, let the player pick the right quality moment to moment, and count views and watch time at a scale where a naive UPDATE ... SET views = views + 1 would fall over on day one. ...

31 min

Design a Real-Time Leaderboard - System Design

Everyone thinks a leaderboard is a SELECT ... ORDER BY score DESC LIMIT 100. “Store the scores, sort them, return the top 100, done.” Then the interviewer adds the real constraints: it is not just the top 100, a player who ranks 4,192,304th wants to see their own rank and the ten people around them; scores update constantly as millions of people play, and a single kill or a single point can move someone up thousands of positions; the board must feel live, so a score bump should show up in a second, not on the next nightly batch; and there is not one board, there is a global all-time board, plus a daily board, a weekly board, and one per region, all at once. ...

28 min

Design a Web Crawler - System Design

Everyone starts a web crawler the same way: a queue of URLs, a while loop, fetch, parse out the links, push them back on the queue, repeat. It works on ten pages. Then the interviewer turns it into the real problem: crawl the whole web - billions of pages - politely (never hammer one server), without downloading the same page twice, without getting stuck in an infinite maze of dynamically generated URLs, across hundreds of machines, and refresh it all continuously because the web changes under you. ...

27 min

Design an Ad Click Aggregator - System Design

Everyone thinks an ad click aggregator is a SELECT COUNT(*) ... GROUP BY ad_id. “Log every click, count the rows, show the advertiser their numbers, done.” Then the interviewer adds the constraints that make it a real system: it is not a thousand clicks, it is millions of clicks per second at peak; advertisers pay per click so a double-counted or dropped click is literally money moving the wrong way; the dashboard must feel live, so a click should show up in seconds, not in tomorrow’s batch; and the same numbers must also be provably correct at the end of the day for billing, even though clicks arrive late, out of order, and sometimes twice. ...

28 min

How to Interview for an AI Engineer Role in 2026

If you prep for an AI engineer interview by grinding gradient descent derivations and softmax cross-entropy, you will walk in ready for a job that mostly no longer exists. The role that companies are hiring for in 2026 is not “person who trains models.” It is “person who builds reliable systems on top of models they did not train.” Those are different jobs, and the interview loops have quietly split to match. ...

12 min

Term Insurance Cover: The Income-Replacement Math, Not a Round Number

“Take 1 crore cover.” It is the most repeated line in Indian personal finance, and it is a psychological number, not a financial one. One crore feels large. It rhymes with “crorepati.” It sits neatly in a WhatsApp forward. None of that has anything to do with whether it would actually keep your family in their current life if you died tomorrow. The right cover is not a round figure you pick because it sounds reassuring. It is a number you calculate. And when you calculate it properly - replacing the income your family loses, clearing what you owe, funding the goals you promised, and subtracting what you already have - most earning Indians land somewhere between Rs. 1.75 crore and Rs. 3 crore. The round Rs. 1 crore is usually a serious shortfall dressed up as prudence. ...

10 min

Design BookMyShow / a Ticket Booking System - System Design

“Design BookMyShow” looks like a catalogue app: list cities, list movies, list showtimes, take a payment, print a QR code. The interviewer lets that version breathe for about a minute, then drops the question the toy design cannot answer: a cricket final goes on sale at 10:00 AM, 2 million people hit the same match’s seat map in the same second, and seat H14 in the same stadium can only be sold to exactly one of them. Two people are staring at the same seat, both tap “pay,” both cards are valid. Who gets it, and how do you make sure the other one never gets a confirmation for a seat that is already gone? ...

30 min

Design Dropbox / a File Sync and Storage Service - System Design

A file sync service sounds like a glorified upload button until you count the bytes. The naive version is a single PUT /file that stores a blob and a GET /file that returns it - and it works right up to the moment a user edits one paragraph in a 2GB video project and your service happily re-uploads all 2GB over their home DSL line. Multiply that by 700M users across 4 devices each, all expecting a saved file to appear on every other device within seconds, and the upload button collapses. The entire engineering problem of Dropbox is this: move the minimum number of bytes to keep N devices holding identical file trees, while storing those bytes once no matter how many users or versions contain them, and reconciling edits that happen concurrently on devices that were offline and never saw each other. ...

27 min