User needs to be able to have a short url that redirects user to real url.
DB needs to be able to handle large amount of requests to get real url.
Must be quick and scale across millions of URLs.
Must be easily usable.
Works on all devices.
Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
/sign-up --> User provides a POST body with email and password.
/verify?id=xxxx --> User verifies an account with given email and if link is valid than user can sign up.
/log-in --> User provides POST Body with email and password, if correct user gets token
/forgot --> User is able to reset password for given email.
/reset?id=xxx --> POST body with new password resets password for given email.
/create --> If user is not on cooldown and has token, then a new url is created.
/view?id=xxxx --> Anyone can view the new url, there is a cooldown issued by IP (To avoid spam)
User must first create an account using OAuth2, email / password.
User must verify email by answering an verification email.
User then logs in and authenticates and recieves a token.
User then can attempt to create url shortener link by sending payload of link.
If user is not on cooldown (1 minute), the service then generates a link by assigning it a unique uuid, and sending a response payload with the sites url followed by uuid.
https://urlshort.com/view?id=xxxx_xxxx_xxxx_xxxx
After user enters site, a request is sent to the db to fetch the actual link, and then user is redirected to the actual link.
SQL database with a Users table and Links table.
Users table has 3 columns,
email, password, last_sent.
Links has 3 columns,
creator, url, id.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.