

What kind of database is to be used? A NoSQL database like DynamoDB, MongoDB or Cassandra is a better option since we expect to store billions of rows and don’t need to employ associations between items. URL redirection and response time should happen in real time with minimal latency. This is necessary because if our service goes down, all URL redirections would fail. This is how a basic URL shortening service works.įor scalability and durability, a URL shortener service can employ the following features. When a call is made to the short URL, the database is looked up for the associated longer URL and redirects the web request to the long URL’s web page. The URL shortening service stores both the short and long URLs in the database mapped to each other. This URL returned to the client consists of the selected domain name plus the generated ID token appended to the end, for example.

When a client submits a long URL to be shortened by the service the URL shortening service generates and returns a short URL, by using some function (cryptographic hash function, iterating through IDs, random IDs, or some combination) to generate a token like XQ6953. This article is accompanied by a working code example on GitHub.Ī URL shortening service selects a short domain name as a placeholder. On our Node.js server, we will create REST API endpoints for the URL shortener and integrate them into React.js frontend applications, while storing all our URL data in a MongoDB database.
#Tiny url system design question how to
In this article, we will walk through the architecture of designing a URL shortening service, looking at both basic and advanced requirements, then we will explore how to create a Basic URL shortener using Node.js, React.js and MongoDB. URL shortener services convert long URLs into significantly shorter URL links. How to design a URL shortening service like is a frequently asked question in system design interviews.
