The Desi Architect
Notes / Docker Sandboxes / Full-Stack URL Shortener Sandbox, Base62 & Write-Back Analytics
Docker Sandboxes · Tier 1: Building Blocks · Lab 21

Full-Stack URL Shortener Sandbox, Base62 & Write-Back Analytics

Build the core of a Bitly-style service and test it. Turn a database id into a short code with Base62, read it cold and warm, choose between a 301 and a 302, refuse bad input, create many codes at once, and count clicks without making visitors wait for a database lock.

Time45 minutes
StackPostgres 16Ports 18087, 15451, 16406
MemoryAbout 180 MB
Before thisLab 14Redis Cache-Aside Pattern, Invalid
Verified runWindows, Mac, LinuxBash and PowerShell
  1. 1PrepareWhat you will learn
  2. 2PredictGuess before you run
  3. 3RunStep by step
  4. 4ObserveWhat you should see
  5. 5Break itChange one thing
  6. 6Clean upLeave nothing running
On this page
  1. 00 / What You Will Learn
  2. 01 / Why It Matters
  3. 02 / What We Are Building
  4. 03 / Words You Need
  5. 04 / Predict First
  6. 05 / Step by Step
  7. 06 / What You Should See
  8. 07 / Look Inside
  9. 08 / Break It, Fix It
  10. 09 / In Real Projects
  11. 10 / Interview Corner
  12. 11 / Clean Up

00 /What You Will Learn

By the end you will be able to
  • Explain Base62 and how many ids 6, 7 and 8 characters hold.
  • Explain why an id from a database sequence never repeats, even with many creates at once.
  • Choose between a 301 and a 302 redirect, and say what each costs.
  • Explain negative caching and input validation for a public service.
  • Explain write-back click counting, what it saves, and what it can lose.

Before you start

Finish Lab 14 (Redis Cache-Aside) and Lab 15 (Database Indexing) first. You should know a cache hit from a miss and what a row lock is. Docker Desktop must be running.