Easyfoundationsstorage and delivery
Design URL Shortener
Build a scalable URL shortening service that supports creation, redirection, caching, and analytics ingestion for a fast user experience.
What to build
- Create a short URL for a valid long URL with optional custom alias, expiration time, and owner metadata.
- Redirect a short URL to the original destination while handling missing, disabled, or expired links.
- Record click events with timestamp, referrer, coarse geography, device type, and short code.
- Expose basic link management for authenticated owners, including list, disable, and update expiration.
Constraints
- Support high read throughput for redirects.
- Keep short URLs available with low latency and cache hit rates.
- Ingest click analytics asynchronously.
Core flows
- Create short URL: Create mapping and optionally cache.
- Redirect short URL: Serve redirect from cache if available.
Quality targets
- Performance: Serve cached redirects with very low latency and keep the redirect path minimal.
- Scalability: Optimize for read-heavy traffic with horizontal stateless services, cache replication, and partitioned storage.
- Availability: Keep redirects available during partial database or analytics pipeline outages.
Architecture hints
Start with these concepts, then connect the request path in the workspace.
clientapi gatewayservicenosql dbredis cacherate limiter
Full brief locked
Sign in to see scenarios, rubric, interview prompts, failure modes, and the complete architecture guide.