a User table, and a URL table.
User table contains everything related to the User and the URL table contain the mapping between ShortURL and Original URL.
We should consider to shard database table to divide the load on indexes to search and insert.
Load-balancers balance the load between APIs.
API then, first query the cache or fallback on the Database via a pgbouncer to optimise the use of the DB.
A garbage collector handle removing the data from the db once the TTL is passed.
The APIs are scalable horizontally.
We can add further replica nodes on the database to scale more on the reads.
I've decided to rely on the capacity of postgresql to scale
No archiving, so no history, Once deleted it returns nothing.
We could imagine to have citus to scale further more the DB on the writes and shard the read traffic as well, but to stay highly available it will require to have a patroni + replica for each shards.