All projects
backend apis
A URL shortener with click analytics
Build a REST API that turns long links into short codes, redirects on lookup, and counts the clicks.
Why it matters
Almost every backend interview starts with resource design and status codes. A shortener forces you to make real decisions about both — what a POST returns, why a redirect is 302 and not 200, what happens on a duplicate — and gives you something a reviewer can hit with curl in ten seconds.
What you build
- A POST endpoint that accepts a long URL and mints a short code
- A GET endpoint that redirects a short code to its target
- Click counting that does not slow the redirect down
- Validation that rejects malformed and unsafe URLs
If you want more
- Custom aliases
- Link expiry
- Rate limiting per client
Build it
One table storing the code, the target URL and a created timestamp, with a unique index on the code.
Material for the whole build
Demonstrates REST resource design, persistence, and correct HTTP semantics in a service someone can try in one command.
Get a plan built around projects like this