Build your own URL Shortener
A URL shortening service with an API, redirects, unique short codes, rate limits and click counts.
- Intro
- About 4–8 h
- 4 checkpoints
- 1 tutorial · Nim
Pick a tutorial, then check yourself at each checkpoint. Work in any language you like.
Choose a tutorialWhy build it
The classic first system design exercise is also a good first build: ID generation, a key-value lookup on the hot path, caching and abuse prevention, in a few hundred lines.
You will be able to
- Generate short unique codes (a counter in base62, or random codes with collision checks).
- Serve redirects with the right status code and caching headers.
- Validate submitted URLs and rate-limit link creation.
- Estimate storage and read/write traffic for your design.
Skills it exercises
Recommended on Backend Engineer and System Design.
How you know you are there
Work in any language. Each checkpoint ends with something you can run or observe, so you can check it yourself.
- Checkpoint 1Self-check
Create and redirect
Done when: POST /links returns a short code, GET /<code> redirects with 301 or 302 (and you can say why), and unknown codes return 404.
- Checkpoint 2Self-check
Unique codes
Done when: A test creates 100,000 links without a duplicate code.
- Checkpoint 3Self-check
Validation and limits
Done when: Only http and https URLs are accepted, and more than N creations per minute from one client return 429.
- Checkpoint 4Self-check
Stats and caching
Done when: Clicks are counted without slowing redirects (batched or asynchronous writes), and hot links are served from a cache.
Stretch goals
- Custom aliases and expiry dates.
- A one-page capacity estimate for 100 million links.
Step-by-step guides
Pick one in a language you know (tutorial languages: Nim). They open on the author’s site.
- Nim
Writing a URL Shortening Service(external site)
Nim: a minimal service. The milestones above apply in any language.
Practice builds are self-paced: Tech Atlas does not track them or count them as evidence. To show a skill, take its knowledge check from the skill page.
Tutorials come from codecrafters-io/build-your-own-x (CC0, snapshot of 2026-07-14, commit aa17439; links checked on 2026-10-19). Each tutorial belongs to its author and keeps its own licence; Tech Atlas links to it and does not host it. Briefs, checkpoints and the mapping to skills are Tech Atlas editorial drafts.