Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
We implement two endpoints:
Our controller will catch the requests for these two flows:
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...
our url generation service randomly generates a string 5 characters long, checks for it in the db, if it doesn't exist, it saves and returns it(if it doesn't it keeps generating new ones). our redirect service checks the cache first for the url and if it's not there, it will check the database and return the actual url.