We basically just have 2 endpoints.
Let's design as a REST API
Let's design it simple.
Let's add 2 server instances with a load balancer between the client and the servers.
The servers first call a cache database like redis (we can have a replica for redundancy).
Probably we can use Cache on Write approach so the cache database is always in sync with the persistent database (can be postgres)
So when client creates a short url and other client gets, we know we can have a cache hit.
The persisted database can have also a replica
Primary key: id
source_url: string
short_url: string
created_at: timestamp
expire_at: timestamp
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.