Building a URL Shortening Platform
· 3 min · urlunicorn.com
What Is URL Unicorn?
URL Unicorn turns long URLs into short, trackable links. Paste in any URL and get back a compact link you can share anywhere. Every click is tracked with timestamp, location, device, and referrer data, giving you a clear picture of how your links perform.
Custom aliases let you choose memorable short codes instead of random strings, so your links look intentional and on-brand.
Architecture Overview
Short Link Click
-> CloudFront (edge routing)
-> Lambda@Edge (resolve alias)
-> DynamoDB (lookup destination + log click)
-> 301 Redirect to original URL
Link Creation
-> API Gateway
-> Lambda (validate URL, generate/check alias)
-> DynamoDB (store link record)
Redirect speed is the most important metric for a URL shortener. Using Lambda@Edge, the redirect logic runs at the CloudFront edge location closest to the user. DynamoDB global tables replicate link data across regions, keeping read latency under 10ms. The full redirect completes in under 50ms from most locations.
Click Tracking and Analytics
Each redirect logs a click event to DynamoDB with the visitor's approximate geographic location (from IP), device type, browser, operating system, and HTTP referrer. These events are aggregated into a dashboard showing clicks over time, top referrers, geographic distribution, and device breakdown.
Click data updates in near real time. Within seconds of a link being clicked, the analytics dashboard reflects the new data.
Custom Aliases and Link Management
When creating a link, users can specify a custom alias like /spring-sale instead of accepting a randomly generated code. The system checks alias availability instantly against DynamoDB and reserves it atomically to prevent conflicts.
Links can be edited after creation to change the destination URL, updated with expiration dates, or deactivated without deleting the analytics history. A link management dashboard lists all created links with quick stats and action buttons.