Skip to main content

Careers and getting hired · Intermediate · 17 min

Answer a system design interview question as a junior developer

By Padding · Updated 18 Nov 2026
Any whiteboard tool · November 2026

You will work through "design a URL shortener" at junior level and end with a one-page diagram and a timed talk track that names one trade-off.

On this page

A system design round asks you to talk through how you would build something bigger than one program: a URL shortener, a chat app, a news feed. There is no single right answer, and nobody expects a junior developer to have run a system for millions of users. What the interviewer is scoring is how you think: whether you ask before you build, whether your numbers are roughly sane, whether you can follow one request through your own design, and whether you can say "this part will break first, and here is what I would do".

Junior and senior candidates get the same question but are held to different bars. At junior level, a clear, working design with a database, a cache and stateless app servers is a good answer, as long as you can explain each box. Seniors are expected to lead the conversation, go deep on two or three hard parts unprompted (sharding, consistency, multi-region), and talk about cost and operations. If you try to sound senior by naming every technology you have heard of, you usually do worse: the interviewer asks "why?" about one of them and the answer is not there.

In this tutorial you answer the most common practice question, "design a URL shortener", in the order an interview runs. You end with two things on one page: a diagram of every component a request touches, and a talk track with times, written in your own words. Practise it once and you have a pattern you can reuse for most junior system design questions.

Step 1 · Agree the requirements before you draw anything

The question is short on purpose. The interviewer wants to see you turn "design a URL shortener" into something you can build. Open a blank page or board and write two headings: Must do and Not doing. Then ask questions out loud and write the answers down where the interviewer can see them.

Questions worth asking for this problem:

  • Who creates short links: anyone, or only signed-in users?
  • Can people choose their own short code (a custom alias), or do we always generate one?
  • Do links expire?
  • Do we need click counts, or only the redirect?
  • Is this one country or worldwide? Mostly phones or desktops?

If the interviewer says "you decide", decide quickly, say why, and write it down. A sensible junior scope looks like this:

  • Must do: create a short link from a long URL; redirect a short link to its long URL fast; links last until deleted; count clicks per link.
  • Not doing (for now): custom aliases, user accounts, link editing, a dashboard.

Also write one line for the quality that matters most. For a shortener it is that redirects are fast and almost always available, because every click a user makes goes through you. Creating links can be a little slower.

Saying what you do not know is fine here and later. "I have not built analytics pipelines, so I would keep click counting simple and ask a colleague" is a better answer than inventing one.

Check it worked

Your page has a "Must do" list of three to five items, a "Not doing" list with at least two items, and one sentence naming the most important quality. If you cannot point to a line that says what you are not building, you have not scoped it yet.

Step 2 · Estimate the scale with rough numbers

Interviewers ask for numbers to see whether your design fits the load, not to test your arithmetic. Round hard, say your assumptions out loud, and use 100,000 seconds in a day when you are in a hurry (the real figure is 86,400).

Write these under a heading Numbers:

  • New links: assume 1 million a day. 1,000,000 ÷ 86,400 is about 12 writes a second.
  • Redirects: people click links far more than they create them. Assume 100 clicks per link created: 100 million a day, about 1,200 reads a second on average.
  • Peak: traffic is not flat. Assume the busiest hour is five times the average: about 60 writes and 6,000 reads a second.
  • Storage: one row holds the code, the long URL, a created time and a click count. Call it 500 bytes. 1 million a day × 365 × 5 years is about 1.8 billion rows, or roughly 1 TB over five years.
  • Code length: use letters and digits, 62 characters. Six characters give 62⁶, about 57 billion codes; seven give about 3.5 trillion. Six is enough for five years at this rate; seven leaves plenty of room.

Then say what the numbers mean: "This is read-heavy, about 100 reads for every write. Reads need to be fast, so I will want a cache. Writes are low enough for one database."

Check it worked

Under "Numbers" you have writes a second, reads a second, peak, storage and code length, each with the assumption that produced it. Read the last line out loud: it should be one sentence that says which way the load leans (read-heavy) and one decision that follows from it.

Step 3 · Sketch the API and the data model

Before boxes, write down what the system does from the outside. Two endpoints cover the "Must do" list. If you want a refresher on choosing methods and status codes, design REST endpoints covers it.

Text
POST /links
  body:    { "url": "https://example.com/a/very/long/path" }
  returns: 201 Created  { "code": "k7Pq2xA", "short": "https://sho.rt/k7Pq2xA" }

GET /{code}
  returns: 302 Found, Location: https://example.com/a/very/long/path
           404 Not Found if the code does not exist

Expect a question on 301 versus 302. A 301 means "moved permanently", so browsers may cache it and skip your server next time. That is faster for the user, but you stop seeing those clicks. A 302 (or 307) is temporary, so every click comes back to you and can be counted. Because click counts are on your "Must do" list, choose 302 and say so. That is your first trade-off.

Now the data model. One table is enough:

Text
links
  code        text, primary key      -- "k7Pq2xA"
  long_url    text, not null
  created_at  timestamp, not null
  clicks      bigint, default 0

Say how codes are made. Two common answers suit a junior round:

  • Random code, retry on clash. Generate seven random characters; the primary key rejects duplicates, so on a clash you generate again. Simple, and clashes are rare with 3.5 trillion possible codes.
  • Counter, then encode. Take the next number from a database sequence and write it in base 62. No clashes, but codes are guessable (anyone can step through them).

Pick one and give the reason. For a public shortener, guessable codes leak other people's links, so random is the safer default. Design the clinic booking schema is a fuller walk through tables and keys if you want more practice.

Check it worked

Your page shows two endpoints with method, path and success and error status codes, one table with a primary key, and one sentence on how codes are generated and why. Next to the GET line you have written "302, not 301" with the reason.

Step 4 · Draw the boxes

Now draw. Start from the user and move right, adding only boxes you can explain:

  1. Client. A browser or a mobile app.
  2. Load balancer. Spreads requests across app servers and stops sending to one that fails its health check. Load balance with Nginx upstream shows one in practice.
  3. App servers, at least two. They hold no state of their own, so you can add more or lose one without losing data. Say "stateless" out loud; interviewers listen for it.
  4. Cache. An in-memory key–value store (Redis or Valkey) mapping code to long URL. Your numbers said reads dominate, so most redirects should be answered from here.
  5. Database. One relational database (PostgreSQL, for example) holding the links table. It is the source of truth; the cache is a copy.

Label each arrow with what travels on it. Keep it to five boxes. A message queue, a CDN or a second region are all fair additions later, but only if the interviewer asks or your bottleneck step needs one.

Diagram of a URL shortener: a browser connects to a load balancer, which sends the request to one of two stateless app servers; the app server reads from a cache first and from the database on a miss, then returns a 302 redirect
Five boxes are enough for a junior answer. The numbers show one redirect.

If you are on a video call with a whiteboard tool, draw large and use plain labels. If the connection is weak, as it can be on prepaid mobile data, draw the boxes on paper beforehand, practise the question, and ask at the start whether you may hold the paper up or share a photo if the shared board lags. Most interviewers would rather see a clear sketch than wait for a frozen screen.

Check it worked

Your diagram has five labelled boxes and a labelled arrow between each pair that talk to each other. Cover the labels with your hand: you can still say what each box does in one sentence without looking.

Step 5 · Walk one request through the design

Pick the request that matters most, the redirect, and follow it out loud, touching each box on your diagram as you go. Number the arrows as you speak:

  1. The browser sends GET /k7Pq2xA.
  2. The load balancer passes it to a healthy app server.
  3. The app server asks the cache for k7Pq2xA. On a hit, it returns 302 with the long URL in the Location header. Done, in a few milliseconds.
  4. On a miss, it reads the row from the database, writes it into the cache with an expiry time (a TTL, say 24 hours) so rarely used links fall out, and returns the 302.
  5. It adds one to the click count. Say how: updating the row on every click would put 6,000 writes a second on the database at peak, which undoes the point of the cache. Instead, count in the cache and write the totals to the database every minute or so.

This pattern, check the cache, fall back to the database, fill the cache, is called cache-aside. Cache database results in Redis builds it for real.

Then walk the create request in three sentences: the app server generates a code, inserts the row (retrying on a clash), and returns 201 with the short link. It does not need the cache.

Check it worked

Every box on your diagram is touched by at least one of the two walk-throughs, and every arrow has a number. If a box is never used, remove it or explain what it is for. Time yourself: the redirect walk-through takes under two minutes.

Step 6 · Find one bottleneck and one failure

This is where junior candidates most often earn the strongest marks, because it shows you understand your own design rather than a memorised one. Pick one of each and say what you would do.

A bottleneck. With the numbers you wrote, the first thing to strain is database reads if the cache is cold or too small. A good answer: "I would size the cache to hold the most-clicked links. If the top 1 million links are 500 bytes each, that is about 500 MB, which fits in memory on one cache server. If reads still grow, I would add read replicas of the database." Mention rate limiting on POST /links too, answering 429 Too Many Requests, because a free link creator attracts spam.

A failure. Ask yourself what happens when each box disappears:

  • One app server dies: the load balancer stops sending to it. No data lost, because the servers are stateless.
  • The cache dies: every redirect goes to the database. It is slower, and at peak it may be too slow. The fix is a cache with a replica, and a timeout so app servers fall back to the database quickly instead of hanging.
  • The database dies: links cannot be created, and redirects work only for codes already in the cache. The fix is a standby copy you can switch to, and regular backups.

Now name the trade-off out loud, in one sentence that has both sides. For example: "Counting clicks in the cache and writing them every minute takes load off the database, but if the cache fails we can lose up to a minute of click counts. For this product, I think that is acceptable." An interviewer remembers a candidate who says "but" and "I think that is acceptable because".

If an interviewer pushes on something you have not done, such as splitting the database across many servers, say so plainly: "I have not sharded a database myself. I would expect to split by the code, because every lookup is by code, and I would want to read how our database supports it before committing." That is an honest answer with a reason in it.

Check it worked

Your page has a "Bottleneck" line and a "Failure" line, each with a fix. Somewhere on the page is a sentence containing the word "but" that names what your design gives up and why you accept it.

Step 7 · Write and time your talk track

Turn your page into a talk track: short notes in the order you will speak, with a time for each part. Most system design rounds run 45 to 60 minutes including introductions, so plan 40 minutes for the question itself and end five minutes early for questions.

Bar chart of a 40-minute talk track: requirements 5 minutes, numbers 4, API and data model 6, boxes 7, request walk-through 5, bottleneck and failure 8, questions 5
Spend the most time on the parts that show judgement: boxes, the walk-through and what breaks.

Write it on the same page as your diagram, beside or under it, as one line per part:

  • Requirements (5 min): create, redirect, click counts. Not doing: custom aliases, accounts. Redirects must be fast.
  • Numbers (4 min): 12 writes/s, 1,200 reads/s, peak ×5, 1 TB in five years, seven-character codes. Read-heavy, so cache.
  • API and data (6 min): POST /links, GET /{code}, 302 not 301. One links table. Random codes, retry on clash.
  • Boxes (7 min): client, load balancer, two stateless app servers, cache, database.
  • Walk-through (5 min): redirect with cache hit and miss; create.
  • Bottleneck and failure (8 min): cache size and read replicas; cache dies; trade-off on click counts.
  • Questions (5 min): "Which part would you want me to go deeper on?" and one question about how their team runs its own services.

Say it out loud once while your phone times you. Then do it again a day later from the diagram alone, without the notes. Many candidates in Nigeria and across Africa interview for remote roles with teams in other time zones; if that is you, check the interview time in your own zone the day before, and practise in the language the interview will be held in, including the technical words.

Check it worked

You have one page with the diagram and seven timed lines. Your recorded run finishes within 40 minutes, every component in the diagram appears in the talk track, and the bottleneck line names your trade-off.

Next steps

Use the same seven parts on a second question before your interview, such as "design a pastebin" or "design a rate limiter"; the boxes change less than you expect.

Need this done for you?

Padding does this work for growing companies, from the first diagnosis to a system that keeps working.

Digital Transformation

Get new tutorials

New tutorials, about twice a month.