Requirements
Functional Requirements:
- Create a short URL for a given long URL.
- Return the long URL associated with a given short URL.
Non-Functional Requirements:
- The service must work even with milions access per day;
- The service must work 24/7
API Design
High-Level Design
The system architecture will feature a load balancer that will distribute the load across different servers. Each server will read from and write to a database. Since the application's focus is not on reading and writing to the database—because the user provides input and the system processes the URL—we can use only one database to store a URL and retrieve it if the user needs to shorten the same URL again later.
Detailed Component Design
Load balancer: responsible for balancing the application load.
Servers: responsible for storing the front-end and back-end instances of the application. They will be on different hosts, allowing for vertical scaling. However, if necessary, we can increase the number of server instances.
Database: responsible for storing shortened URL information.