URL Shortener

> Preview exemplar: this is a study outline, not an operational service or a claim about production capacity.

Design a contract that accepts a long URL, returns a short token, and resolves that token on a later redirect. Discuss token generation, storage, expiration, abuse controls, and analytics consistency.

Key concepts
token generationredirect lookupcachingabuse controls

Reference discussion flow

1. Define create-link and redirect requests, including invalid and expired tokens.

2. Store each token-to-URL mapping in durable storage with an optional expiration time.

3. Cache frequently requested mappings while keeping the durable record authoritative.

4. Send click events to an asynchronous analytics path so redirects do not wait on reporting.

URL Shortener -- LeetPrep Studio | LeetPrep Studio