SystemTutor
About
Sign in
Loading course documentation…
SystemTutor

COURSES

  • Data Structures & Algorithms
  • CSS MasterclassNew course
  • System DesignNew course

PRACTICE

  • Algorithm practice
  • CSS practice

LEGAL

  • Privacy Policy
  • Terms of Service
  • About

© 2026 SystemTutor. All rights reserved.

Built with 🫶 by Shatlyk

System design
Design Process and RequirementsBack-of-the-Envelope Estimation Scope and size a short-link service Keep the redirect service online
Design foundations

Design Process and Requirements

Turn an ambiguous request into a scoped design with explicit trade-offs.

Lesson goal

Define requirements, trace a request and its data, and choose one important design question to investigate.

Before you begin — Recall how clients and services agree on an API contract and how to define a user-visible requirement.

“Build a URL shortener” sounds specific until you try to implement it. Must users sign in? Can destinations change? What happens when a stored link is unavailable? A useful design starts by making these decisions visible.

Define what the system must do

Functional requirements describe behavior. For a first short-link service, users submit a destination URL and receive a short link. Visitors open that link and are redirected. Administrators can disable abusive links. These are actions you can demonstrate.

Non-functional requirements describe qualities and constraints of that behavior. Redirects might need to remain available during a server failure, or complete within an agreed latency target. Traffic, retention, cost, and acceptable data loss shape the implementation even though they are not separate user features.

Make each target testable. For example, a team might propose, “At peak load, 95% of redirect requests receive a response within 200 ms, measured at the application.” That gives the team an operation, a threshold, and a place to measure. Link creation needs its own target because it performs different work. The numbers here illustrate the decision the team must make.

For this exercise, assume public redirects, authenticated creation, immutable destinations, and the ability to disable a link. Leave custom aliases and click analytics outside the first version. Recording exclusions prevents a small service from silently becoming a much larger product.

The first release includes creation, resolution and disabling. Aliases and analytics sit outside the agreed scope.

Trace the simplest complete design

Start with a client, one application, and persistent storage. On creation, the application records a mapping between a short code and the submitted destination. On resolution, it reads the mapping and checks its active state before sending a redirect. Disabling changes that state, so subsequent authoritative lookups find an inactive link and return no destination. These three paths tell us what data the database must hold.

Creating a link saves a mapping. A visitor resolves the active mapping. An administrator can disable it so later visitors receive no redirect.

The creation response should follow the successful save. Returning a short link first creates a failure window: the application might crash before recording the destination, leaving the user with a link that never worked.

Use scale to choose the deep dive

Suppose, as a teaching assumption, the service creates 100,000 links and handles 1,000,000 redirects daily. Reads outnumber writes ten to one. That suggests investigating the lookup path, but the ratio alone does not prove that a cache is necessary. Estimate peak demand and measure the proposed implementation.

Choose one design question and follow it through. If the problem is repeated database reads for popular links, a cache may reduce database work. The next question is then how a disabled link stops being served from that cache. Improving performance creates a freshness decision.

Record a decision in a form another person can review:

QuestionInitial decisionConsequence to investigate
Can destinations change?No, but links can be disabledCached active state still needs invalidation
Where is the mapping authoritative?Persistent databaseA cache miss needs database access
What needs to scale first?Determine from peak lookup demandMeasure before adding infrastructure

Review failure as part of the flow

Ask what the client knows if a creation request times out. The mapping may have been saved even though the response was lost. Repeating the request can create another mapping unless the API defines retry behavior. The same logical creation needs a way to recognize an earlier attempt. You will design that behavior in Resilience and Safe Retries.

End a design review by stating what is decided, what remains uncertain, and which measurement or experiment will reduce that uncertainty. A high-level design is useful because people can challenge its assumptions before they become implementation costs.

Check your understanding

A proposal adds five services, a cache, and two databases before defining whether destinations can change. What should the next review focus on?

Compare your reasoning

Establish the required behaviors and trace creation, resolution, and disabling through persistent state. Then use traffic and failure requirements to justify each additional component. Destination mutability affects correctness and cache behavior, so it belongs before that implementation choice.

Key Takeaways

  • Scope: Define behavior, quality requirements, assumptions, and exclusions separately.
  • Flows: Trace both the request and the state it reads or changes.
  • Deep dives: Investigate the bottleneck or correctness question most relevant to the requirements.
  • Trade-offs: Explain the consequence of a choice and how you will validate it.

How is this lesson?

Previous lessonChoosing an API contractNext lessonBack-of-the-Envelope Estimation
Edit on GitHubReport on GitHub
On this page
%

On this page

Define what the system must doTrace the simplest complete designUse scale to choose the deep diveReview failure as part of the flowCheck your understandingKey Takeaways