Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
Concept:
The goal of this project is to design a service that shortens long URLs into a preferrable 8-bits long URL which can reduce that considerable space in writing long URLs. A URL shortener shortens a long URL into a concise, easy to memorize, easy to share and aesthetically pleasing short URL.
Design:
The URL shortener takes a long URL as an input from a user and returns a short URL. When a user sends a request whose body contains a long URL, a service (API) takes the long URL and create a unique short URL, the created short URL is a path on my domain and it must be unique so as to prevent two long URLs being linked to the same short URL. for example,
USER LONG URL: "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSGxwl4fhem6m2urbLPsROL7UHP2tjF4CowszALXe5IwDIMG7C2VdCqSyLCsNi4mrqWuKJgVE215SQCpX3TOTQSUgwhOnN_kBr2FB6omLvWww",
EXPECTED SHORT URL: https://my-domain.com/aXb324
Geographically, this program should be able to handle multiple users from different parts of the world. Users are expected to be able to communicate with this program via a mobile app, a desktop app, a web application through an API.
Active Users: 500,000 - 1,000,000 daily active users
1,000,000 - 3,000,000 monthly active users
Read vs. Write: 100 : 1
Queries per secs:
Storage: (Assuming every users have at least 5 long URLs stored on my DB for 3 years)
Throughput:
Security:
Reliability:
Scalability:
Component communication: There are different components in this program, and they communicate in different ways. The client component communicates with service layers by making REST API calls to the API endpoints. And the API endpoints communicate with the data layer by directly accessing the database.
A URL is submitted as a web page input which is send from the frontend as JSON data as a request to the appropriate API endpoint. The submitted data if it does not exist on the database is then transferred to the shortening service else, a response containing both the long URL and the short URL is returned via an API call from the DB to the user.
Components in this program communicates over the internet and uses HTTPS through REST API calls as the protocol. Requests and response are in form of JSON data.
Communication is synchronous and they wait for response to be sent before they continue to run.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
{
"long_url": "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcSGxwl4fhem6m2urbLPsROL7UHP2tjF4CowszALXe5IwDIMG7C2VdCqSyLCsNi4mrqWuKJgVE215SQCpX3TOTQSUgwhOnN_kBr2FB6omLvWww",
"short_url": "my-domain.com/aXybC23
}