List the key functional requirements for the system (Ask the AI for hints if stuck)...
List the key non-functional requirements (performance, scalability, reliability, etc.)...
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
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...
POST /shorten
Accepts URI string as body or query string parameter
Returns shortened URI string
GET /{shortened_uri}
Accepts shortened URI as path
Returns redirect to the original URI stored under received shortened URI key
DELETE /forget
Accepts shortened URI previously created on this server
Returns status code denoting whether the operation was successful
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.
Basically simple SRP module server with basic CRUD is enough. Client -> Server - Database. Potentially we can add caching between client and server for reads.
CREATE:
Client sends POST request to server with original URI to receive its shortened version
Server accepts original URI
Server derives short URI key from original URI
Server stores original URI value under shortened derived URI key
READ:
Client sends GET request represented by shortened URI previously returned from the server
Server accepts shortened URI and returns redirect to the original URI stored under shortened URI key in database
DELETE:
Client sends DELETE request w shortened URI
Server removes both shortened URI and its corresponding original URI from its registry
Define the data model. Identify the main entities, their attributes, and relationships. Consider the choice of database type (SQL vs NoSQL) and justify your decision based on access patterns...
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.