Software EngineeringHardSystem Design
Design a URL Shortener (High Level)
đ Problem
At a high level, design a URL shortener service (like bit.ly) â how would it generate short codes and redirect users?
đ§ Approach
Store each long URL in a database with an auto-incrementing ID. Convert that ID into a short base-62 encoded string (using a-z, A-Z, 0-9) to form the short code â this guarantees uniqueness without extra lookups. When someone visits the short URL, look up the code in the database and issue an HTTP redirect (302) to the original long URL.