Designing an E commerce platform

Functional requirements search: The search functionality provides users with the ability to list all products that best match their query. We should also be able to tell weather we are able to deliver a product to the users location or not. For example, if a product cannot be shipped to the user, it should be communicated to the user. cart: users should be able to add items into their cart. wishlist: users should be able to add items to their wishlist. checkout + payment view orders: users should be able to track their active orders Non functional requirements Imagine there is a sale on an item with 50% off. And everybody is waiting for 12:00 so they can order. In such situation, we do not want 2 users to order the same product. Hence, the system should be highly consistent. Secondly, the system should have low latency, therefore, they can book as fast as possiblem, when there is a sale. ...

September 25, 2025 · 5 min · abdulrahim

The design of a Search Engine

Introduction First let’s start with a similar problem akin to web search. Imagine you have 100 files in your current directory, and you do something like: 1 grep "Abdul" . The grep program will return you a list of files which contain the given string or pattern. But how do you think does that works under the hood. In a naive approach, the grep program would open each file in the directory, search for the given string/pattern and if any result is obtained, then add this file to the output list. ...

September 25, 2025 · 3 min · abdulrahim

Netflix CDN

Introduction You are netflix. Now your main servers are hosted in the USA, however, you have users all over the world. Now suppose, a user from India request a video (movie/TV etc.) that is hosted in a USA data center. To serve the request, you need to transmit data all across the world, which increases the users latency and makes up for a bad user experience. And if there are millions of users in India, requesting data from USA, then the network will become like red hot steel. ...

September 24, 2025 · 3 min · abdulrahim

The design of twitter

Introduction Firstly I would like to talk about the scale of twitter, which will help us to understand the requirements of a system like twitter. Twitter handles about 600 tweets per second. Which means that approximately 600 tweets are made each second. On the contrary, approximately 60,000 tweets are read each second. This clearly shows that twitter is a read heavy system. There are approximately 300 million users of twitter. Some of them are active users (users who frequently visit twitter), while most of them are passive users (i.e. users who’d only visit once in a while, say 1 month). ...

September 24, 2025 · 9 min · abdulrahim

Leetcode 715: Range Module in 6 line python. The epitome of python sorcery demystified

Leetcode 715. Range Module is one of the most convoluted problems on leetcode. And your confidence is further shattered when you find out, that it can be solved in just 6 lines of code. Upon seeing these 6 lines, you realize that this is nothing less than a rosetta stone. In this blog post, I will run the code through all possible edge cases by hand. Range Module A Range Module is a data structure that tracks intervals of numbers using half-open ranges [left, right). It supports adding, querying, and removing ranges efficiently. ...

August 8, 2025 · 9 min · abdul