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...
API that takes in a long url writes it to DB and returns a short url
We have another API that takes in a short URL and returns a long URL
We can aslo implemnt URLs to ensure security and validation
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.
We use a relational database such as MySQL as the source of truth, storing:
short_url_id (primary key)long_urlInstead of hashing with linear probing, we use a globally unique ID generator:
[a-zA-Z0-9]) to form the short URLWhy this works
We implement a multi-tier cache (e.g., Redis/Memcached) in front of the database.