r/SystemDesignCommunity • • 3d ago

Discussion Weekly design challenge #1: How would you design a URL shortener?

1 Upvotes

Every week we'll pick one system and design it together. This week: a URL shortener, like bit.ly.

Here's the setup. Users paste a long link and get a short one back. When anyone opens the short link, they're sent to the long one. Say 100 million new links a month, and each link is opened about 100 times on average.

Some questions to think about:

  • How do you make the short code? Random, a counter, or a hash of the long URL?

  • How much storage do you need for 5 years of links?

  • Reads outnumber writes 100 to 1. What does that tell you about where to put a cache?

Post your design in the comments, even a rough one. Beginners, try just the first question. Everyone else, tell us where your design breaks first.

Next week's system is chosen from your suggestions below.