donnemartin/system-design-primer

▲ 192 stars today★ 377,189⑂ 59,206

Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.

About donnemartin/system-design-primer

donnemartin/system-design-primer is an open-source project on GitHub, mainly written in Python. Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards. It currently holds 377,189 stars and 59,206 forks with 637 open issues, and was last pushed on 2026-09-15 (repository created 2017-02-26).

Project Overview

Git Homed tracks it on the Today's Trending board, currently at rank #29 with 192 new stars today.

GitHub Repository Details

Repository donnemartin/system-design-primer · default branch master · size 11273 KB · watchers 6,902 · source: GitHub REST API and repository README

README

English ∙ 日本語 ∙ 简体中文 ∙ 繁體中文 | العَرَبِيَّة‎ ∙ বাংলা ∙ Português do Brasil ∙ Deutsch ∙ ελληνικά ∙ עברית ∙ Italiano ∙ 한국어 ∙ فارسی ∙ Polski ∙ русский язык ∙ Español ∙ ภาษาไทย ∙ Türkçe ∙ tiếng Việt ∙ Français | Add Translation

Help translate this guide!

The System Design Primer


Motivation

Learn how to design large-scale systems.
> Prep for the system design interview.

Learn how to design large-scale systems

Learning how to design scalable systems will help you become a better engineer.

System design is a broad topic. There are a vast number of resources scattered throughout the web on system design principles.

This repo is an organized collection of resources to help you learn how to build systems at scale.

Learn from the open source community

This is a continually updated, open source project.

Contributions are welcome!

Prep for the system design interview

In addition to coding interviews, system design is a required component of the technical interview process at many tech companies.

Practice common system design interview questions and compare your results with sample solutions: discussions, code, and diagrams.

Additional topics for interview prep:

Anki flashcards


The provided Anki flashcard decks use spaced repetition to help you retain key system design concepts.

Great for use while on-the-go.

Coding Resource: Interactive Coding Challenges

Looking for resources to help you prep for the Coding Interview?


Check out the sister repo Interactive Coding Challenges, which contains an additional Anki deck:

Contributing

Learn from the community.

Feel free to submit pull requests to help:

Content that needs some polishing is placed under development.

Review the Contributing Guidelines.

Index of system design topics

Summaries of various system design topics, including pros and cons. Everything is a trade-off.
> Each section contains links to more in-depth resources.


Study guide

Suggested topics to review based on your interview timeline (short, medium, long).
Imgur

Q: For interviews, do I need to know everything here?

A: No, you don't need to know everything here to prepare for the interview.

What you are asked in an interview depends on variables such as:

More experienced candidates are generally expected to know more about system design. Architects or team leads might be expected to know more than individual contributors. Top tech companies are likely to have one or more design interview rounds.

Start broad and go deeper in a few areas. It helps to know a little about various key system design topics. Adjust the following guide based on your timeline, experience, what positions you are interviewing for, and which companies you are interviewing with.

| | Short | Medium | Long | |---|---|---|---| | Read through the System design topics to get a broad understanding of how systems work | :+1: | :+1: | :+1: | | Read through a few articles in the Company engineering blogs for the companies you are interviewing with | :+1: | :+1: | :+1: | | Read through a few Real world architectures | :+1: | :+1: | :+1: | | Review How to approach a system design interview question | :+1: | :+1: | :+1: | | Work through System design interview questions with solutions | Some | Many | Most | | Work through Object-oriented design interview questions with solutions | Some | Many | Most | | Review Additional system design interview questions | Some | Many | Most |

How to approach a system design interview question

How to tackle a system design interview question.

The system design interview is an open-ended conversation. You are expected to lead it.

You can use the following steps to guide the discussion. To help solidify this process, work through the System design interview questions with solutions section using the following steps.

Step 1: Outline use cases, constraints, and assumptions

Gather requirements and scope the problem. Ask questions to clarify use cases and constraints. Discuss assumptions.

Step 2: Create a high level design

Outline a high level design with all important components.

Step 3: Design core components

Dive into details for each core component. For example, if you were asked to design a url shortening service, discuss:

Step 4: Scale the design

Identify and address bottlenecks, given the constraints. For example, do you need the following to address scalability issues?

Discuss potential solutions and trade-offs. Everything is a trade-off. Address bottlenecks using principles of scalable system design.

Back-of-the-envelope calculations

You might be asked to do some estimates by hand. Refer to the Appendix for the following resources:

Source(s) and further reading

Check out the following links to get a better idea of what to expect:

System design interview questions with solutions

Common system design interview questions with sample discussions, code, and diagrams.
> Solutions linked to content in the solutions/ folder.

| Question | | |---|---| | Design Pastebin.com (or Bit.ly) | Solution | | Design the Twitter timeline and search (or Facebook feed and search) | Solution | | Design a web crawler | Solution | | Design Mint.com | Solution | | Design the data structures for a social network | Solution | | Design a key-value store for a search engine | Solution | | Design Amazon's sales ranking by category feature | Solution | | Design a system that scales to millions of users on AWS | Solution | | Add a system design question | Contribute |

Design Pastebin.com (or Bit.ly)

View exercise and solution

Imgur

Design the Twitter timeline and search (or Facebook feed and search)

View exercise and solution

Imgur

Design a web crawler

View exercise and solution

Imgur

Design Mint.com

View exercise and solution

Imgur

Design the data structures for a social network

View exercise and solution

Imgur

Design a key-value store for a search engine

View exercise and solution

Imgur

Design Amazon's sales ranking by category feature

View exercise and solution

Imgur

Design a system that scales to millions of users on AWS

View exercise and solution

Imgur

Object-oriented design interview questions with solutions

Common object-oriented design interview questions with sample discussions, code, and diagrams.
> Solutions linked to content in the solutions/ folder.
Note: This section is under development

| Question | | |---|---| | Design a hash map | Solution | | Design a least recently used cache | Solution | | Design a call center | Solution | | Design a deck of cards | Solution | | Design a parking lot | Solution | | Design a chat server | Solution | | Design a circular array | Contribute | | Add an object-oriented design question | Contribute |

System design topics: start here

New to system design?

First, you'll need a basic understanding of common principles, learning about what they are, how they are used, and their pros and cons.

Step 1: Review the scalability video lecture

Scalability Lecture at Harvard

Step 2: Review the scalability article

Scalability

Next steps

Next, we'll look at high-level trade-offs:

Keep in mind that everything is a trade-off.

Then we'll dive into more specific topics such as DNS, CDNs, and load balancers.

Performance vs scalability

A service is scalable if it results in increased performance in a manner proportional to resources added. Generally, increasing performance means serving more units of work, but it can also be to handle larger units of work, such as when datasets grow.1

Another way to look at performance vs scalability:

Source(s) and further reading

Latency vs throughput

Latency is the time to perform some action or to produce some result.

Throughput is the number of such actions or results per unit of time.

Generally, you should aim for maximal throughput with acceptable latency.

Source(s) and further reading

Availability vs consistency

CAP theorem


Source: CAP theorem revisited

In a distributed computer system, you can only support two of the following guarantees:

Networks aren't reliable, so you'll need to support partition tolerance. You'll need to make a software tradeoff between consistency and availability.

CP - consistency and partition tolerance

Waiting for a response from the partitioned node might result in a timeout error. CP is a good choice if your business needs require atomic reads and writes.

AP - availability and partition tolerance

Responses return the most readily available version of the data available on any node, which might not be the latest. Writes might take some time to propagate when the partition is resolved.

AP is a good choice if the business needs to allow for eventual consistency or when the system needs to continue working despite external errors.

Source(s) and further reading

Consistency patterns

With multiple copies of the same data, we are faced with options on how to synchronize them so clients have a consistent view of the data. Recall the definition of consistency from the CAP theorem - Every read receives the most recent write or an error.

Weak consistency

After a write, reads may or may not see it. A best effort approach is taken.

This approach is seen in systems such as memcached. Weak consistency works well in real time use cases such as VoIP, video chat, and realtime multiplayer games. For example, if you are on a phone call and lose reception for a few seconds, when you regain connection you do not hear what was spoken during connection loss.

Eventual consistency

After a write, reads will eventually see it (typically within milliseconds). Data is replicated asynchronously.

This approach is seen in systems such as DNS and email. Eventual consistency works well in highly available systems.

Strong consistency

After a write, reads will see it. Data is replicated synchronously.

This approach is seen in file systems and RDBMSes. Strong consistency works well in systems that need transactions.

Source(s) and further reading

Availability patterns

There are two complementary patterns to support high availability: fail-over and replication.

Fail-over

Active-passive

With active-passive fail-over, heartbeats are sent between the active and the passive server on standby. If the heartbeat is interrupted, the passive server takes over the active's IP address and re

GitHub Stars & Activity

377,189Stars
59,206Forks
637Open issues
PythonLanguage

GitHub Popularity

GitHub stars377,189
Forks59,206
Open issues637
Primary languagePython
LicenseNOASSERTION
Stars gained today192
Created2017-02-26
Last pushed2026-09-15

Trending History

Daily boardrank #29 · ▲ 192 stars

Related GitHub Projects

1

EbookFoundation / free-programming-books

Python★ 401,256⑂ 67,383▲ 165 stars
→
2

anthropics / skills

Python★ 189,081⑂ 22,291▲ 390 stars
→
3

sherlock-project / sherlock

Python★ 101,574⑂ 12,004▲ 1,766 stars
→
4

django / django

Python★ 91,688⑂ 35,962▲ 99 stars
→
5

jamiepine / voicebox

Python★ 60,059⑂ 7,540▲ 378 stars
→
6

microsoft / VibeVoice

Python★ 56,737⑂ 6,386▲ 245 stars
→
7

spotDL / spotify-downloader

Python★ 26,745⑂ 2,314▲ 59 stars
→
8

google / skills

Python★ 23,613⑂ 1,971▲ 443 stars
→

More Trending Repositories