Design Search Autocomplete / Typeahead - System Design

Everyone thinks autocomplete is a LIKE 'prefix%' query. “Index the search terms, run a prefix match, return the top ten, done.” Then the interviewer adds the real constraints: the dropdown must update on every keystroke, so you are firing a query every ~50ms while someone types; it must feel instant, which means the whole round trip - network, lookup, ranking, render - has a budget under 100ms; the corpus is billions of queries and the popular ones shift by the hour; and “top ten” is not alphabetical, it is ranked by popularity, which a prefix index does not give you for free. ...

25 min

EPF + VPF vs an Index Fund Over a 30-Year Career

The pitch for Voluntary Provident Fund is seductive and, for most of your salary, correct: 8.25% compounded, tax-free, government-backed, no market risk. Point out to someone that an FD nets 5% after tax and they nod along; tell them VPF beats it hands down and they max it. The usual conclusion follows quickly: since 8.25% tax-free is worth roughly 12% pre-tax for a 30% taxpayer, and equity “only” does 11-12%, just pour everything into VPF and skip the volatility. ...

9 min

REITs vs InvITs in India - Where the Yield Actually Comes From

Most people buy a REIT or an InvIT because a screener showed a 6% or a 12% yield next to it, and 12% looks like a fixed deposit that quietly ran away from home. That number is almost always the wrong thing to anchor on. The yield on these instruments is not one thing. It is a blend of interest, dividend, and your own money being handed back to you, and each of those three is taxed differently and means something completely different for the future value of what you hold. ...

11 min

Design a Distributed Cache (like Redis) - System Design

Everyone thinks a cache is a hash map with a size cap. “Store key-value pairs in RAM, evict when it fills up, done.” Then the interviewer makes it distributed: the data no longer fits on one machine, you have twenty cache nodes, and now the hard questions arrive. Which node owns a given key, and what happens to every other key when you add node twenty-one? How do you decide what to throw out when memory is full, and does that decision cost you a lock on the hot path? When the source-of-truth database changes, how does the stale copy in the cache get corrected without a thundering herd? And when one celebrity key gets ten million reads a second, how do you stop a single node from melting? ...

30 min

Design a Payment System / Digital Wallet - System Design

“Move 500 rupees from Alice to Bob” sounds like an UPDATE statement. Then you think about it. What if the request times out and the client retries - did the first one go through? What if the debit succeeds and the process crashes before the credit? What if two withdrawals from the same wallet run at the same instant and both read the old balance? What if the bank tells you a transfer succeeded but your database says it failed? What if a support agent needs to prove, three years later, exactly where a specific rupee went? The one-line update is actually a distributed system with an idempotency layer, an immutable ledger, a state machine per transaction, an integration with unreliable external banks and gateways, and a reconciliation job that catches the cases where all of that still drifted. ...

31 min

Design Google Docs / Collaborative Editing - System Design

A document editor sounds trivial until you put two people in the same document. One editor is a text box that saves to a database: type, PUT /document, done. The interviewer nods, then asks the question that detonates the whole design: what happens when Alice and Bob both type into the same sentence at the same time? Alice inserts “Hello " at position 0 while Bob inserts “World” at position 5, their edits cross in flight over the network, and now each person’s copy of the document has to end up identical to the other’s - even though they applied the same two edits in a different order. Get that wrong and the document silently corrupts: characters land in the wrong place, text duplicates, people lose work. That is unacceptable in a system whose entire promise is “we will never lose your writing.” ...

28 min

NPS at 60: The Annuity Reality Behind the 60% Lumpsum

Everyone sells NPS on the way in: the extra Rs 50,000 deduction under 80CCD(1B), the low-cost fund management, the equity exposure. Almost nobody walks you through the way out. And the exit is where NPS quietly changes character - from a market-linked wealth builder into a life insurance product you did not really choose to buy. Here is the part that surprises people at 60: you do not get to keep all your money. By law, at least 40% of your NPS Tier 1 corpus must be used to buy an annuity from an insurance company. You cannot withdraw it, you cannot SWP it, you cannot leave it in equity. It converts into a fixed monthly pension at whatever annuity rate insurers are offering that year. ...

9 min

Postgres Is Still Eating Your Stack - The 2026 Extension Edition

Most “just use Postgres for everything” posts stop at the fun part. They show you that pgvector exists, that SKIP LOCKED gives you a queue, that tsvector does search, and then they wave their hands and tell you to collapse your stack. What they never tell you is where the floor gives out. Every one of these extensions has a specific number - a QPS, a row count, an ingest rate - past which it stops being clever and starts being a liability. ...

11 min

Arbitrage Funds vs Liquid Funds for Parking Short-Term Cash

The default advice for parking cash you will need in 3 to 12 months is a liquid fund. It is safe, it redeems fast, and it beats a savings account. Almost nobody stops to ask whether it is the best post-tax option, because “liquid fund” has become a reflex. For a 30% bracket investor, the reflex is wrong. An arbitrage fund earns roughly the same gross return as a liquid fund but is taxed as an equity fund, and that single accounting fact is worth about 0.7% to 2% extra per year after tax. Nobody markets this because there is no product being sold - it is just a tax quirk sitting in plain sight. ...

9 min

Design a Notification System (Push, Email, SMS) - System Design

“Send the user a notification” sounds like one function call. Then you write it down. Which channel - push, email, SMS, in-app? What if the user turned push off but left email on? What if APNs is down for ten minutes? What if the order service retries and now the user gets charged-confirmation SMS three times? What if a bug in one service starts emitting a million notifications a second and you SMS your entire user base at a rupee each? The one-line function is actually a distributed system with a fan-out, a provider integration layer, a retry engine, a preference store, and a rate limiter, and every one of those is a place it breaks. ...

29 min

Design a Rate Limiter - System Design

Everyone thinks the rate limiter is a for-loop with a counter. “Count requests per user per minute, reject when it goes over 100, done.” Then the interviewer asks the questions that actually matter: which algorithm, where does the counter live when you have 40 API servers behind a load balancer, how do you stay accurate when two servers increment the same user’s counter at the same millisecond, and how much latency does this add to every single request in the system. Now it is a real problem. ...

24 min

Design Uber / a Ride-Hailing System - System Design

“Design Uber” sounds like a CRUD app with a map on top. A rider taps a pin, a driver shows up, money moves. The interviewer lets you believe that for about thirty seconds, then asks the question that breaks the toy version: there are 5 million drivers on the road right now, each one broadcasting its GPS position every few seconds, and a rider standing on a corner wants the nearest available car in under a second. How do you find “the closest driver” out of millions of constantly-moving points, hundreds of thousands of times per second, without scanning the whole planet on every request? ...

28 min

Guardrails for LLM Apps - The Layers Between the Model and the User

The most common mistake in LLM apps is treating the model as the safety layer. You write a careful system prompt, add “do not answer off-topic questions, do not produce harmful content, always return valid JSON,” and ship it. Then a user asks your customer-support bot for medical advice, it hands out a dosage, and you learn that a system prompt is a suggestion, not a contract. Guardrails are the code that sits around the model and turns suggestions into constraints. The model is a probabilistic text generator. Everything you actually guarantee has to be enforced outside it. This post builds a guardrail pipeline from the naive version to something you can put in front of real users, with a clear answer to the question that matters: what does each layer catch that the others miss? ...

13 min

Prepay the Home Loan or Invest the Surplus? The Breakeven Math

The standard advice is a one-liner: your home loan is at 8.5%, equity returns 11-12% over the long run, so never prepay - invest the surplus and let the gap compound in your favour. It sounds airtight and it is repeated everywhere. It is also often wrong, because it quietly assumes the entire interest you pay is tax-deductible. On a large home loan in the early years, most of it is not. The Section 24 cap of Rs. 2 lakh is where the clean story falls apart. ...

10 min

Spec-Driven Development - Writing the Spec Is Writing the Code Now

The most productive engineers I know stopped bragging about how fast they type. When a coding agent can produce 400 lines of correct code from a paragraph, typing speed is not the bottleneck anymore. The bottleneck is the paragraph. If the paragraph is vague, you get 400 lines of confidently wrong code, fast. If the paragraph is precise, you get something you can ship. The spec is now the leverage point, and most people are still treating it like a throwaway comment. ...

11 min

Choosing an Embedding Model in 2026 - It's Not the Leaderboard

Most teams pick an embedding model the same way they pick a sorting algorithm: look up the benchmark, take the top result, ship it. For sorting algorithms that works fine. For embeddings it reliably produces a retrieval system that looks great on paper and underperforms on the actual product. The MTEB leaderboard is not useless. But it is measuring retrieval on academic corpora with clean, well-formed queries against documents that look nothing like your internal docs, your customer support tickets, or your codebase. Ranking third on MTEB while being the worst model for your domain is entirely possible, and it happens constantly. ...

11 min

Design a URL Shortener (TinyURL) - System Design

Everyone thinks the URL shortener is a trivial problem. “It’s a hash map. Store long URL, return short URL, done.” Then the interviewer asks: how do you generate the key, how do you avoid collisions, what happens when one popular link gets 50,000 redirects a second, and how do you serve that redirect in under 10ms across the globe. Now it’s a real system. The whole problem is deceptively read-heavy and deceptively about one decision: how you mint short keys. Get the key generation wrong and everything downstream (collisions, hot shards, wasted storage) gets worse. Get it right and the rest is caching and sharding you already know. ...

17 min

Design Twitter's News Feed - System Design

The Twitter timeline looks trivial until you say the numbers out loud. “Show me a list of tweets from people I follow, newest first.” It is a join. SELECT * FROM tweets WHERE author IN (my followees) ORDER BY time DESC LIMIT 50. Done. Then the interviewer points out that some users follow 5,000 accounts, some accounts have 100 million followers, the timeline must load in under 200ms, and 300 million people refresh it all day. The join is now the most expensive query on the internet. ...

22 min

Design WhatsApp / a Chat Messaging System - System Design

A chat app sounds like the easiest system you will ever build. “User A sends a message, user B receives it.” One INSERT, one SELECT. The interviewer lets you say that, then asks the questions that turn it into one of the hardest real-time systems in the building: how does B receive it instantly when B might be offline, on a train, or logged in on three devices at once? How do you show the second grey tick the moment it lands on B’s phone, and the two blue ticks the moment B actually opens the chat? How do hundreds of millions of phones hold an open connection to your servers at the same time without melting? ...

25 min

The Real Rupee Cost of a 1% Expense Ratio Over 25 Years

A 1% expense ratio sounds harmless. It is less than what Zomato charges in delivery fees, less than a bank locker’s annual rent. Surely it is not worth losing sleep over. Run that 1% through 25 years of compounding and it does not cost you 1% of your corpus. It costs you 16% of your final wealth - roughly Rs 27 lakh per Rs 10 lakh invested, or Rs 24 lakh on a Rs 10,000/month SIP. The money does not disappear in a single charge you can see on your statement. It is silently extracted each year from a growing base, accelerating in rupee terms every single year. ...

10 min