Most comprehensive frontend system design cheat sheet to help in approaching the system design interview in the best-structured way. Covered 7 most important frontend system design interview topics.
Anuj Sharma
Last Updated Sep 3, 2024
This interview mostly focuses on how well you can capture requirements and translate those requirements to design a system.
Primarily there are 2 types of questions you can expect
There are 3 major expectations in the frontend system design interviews
Best Framework to follow for frontend system design - “RADIO”
Clarify functional & Non Functional requirements. Define the scope of the front-end system design.
Which architecture to follow - Monolith or Micro-frontend or Mono-repo
How the application data look like and the entity's relationship
API Interface to interact with various functions of the system this can be REST API, GraphQL interface or functional interfaces.
Various optimizations to make frontend applications more performant & scalable, primarily “Network Optimizations”, “Asset Optimizations” & “Rendering Optimizations”.
In the rest of the notes we will deep dive into each of the RADIO framework steps one by one, let's start 👇👇👇
Any frontend system design round starts with requirements gathering, and generally, 2 types of requirements should be gathered as part of this stage.
💡 It is important to rather focus on remembering requirements, we should focus on the right questions to generate the functional and non-functional requirements.
The functionality the system will provide to the end users to fulfil their use-case. for example - for an e-commerce website, displaying catalogue items, and searching through the catalogue is the functional requirement.
❓Question: What user will the user use the system for? or what capabilities the system will provide to the users?
We can derive functional requirements via 2 approaches
All the requirements which are essential to make a frontend application more robust, performant, scalable, and secure are considered non-functional requirements.
❓Question: Who are the users?
❓Question: How will they going to use the system?
❓Question: What kind of experience do we want to support in the system?
It is a very important step after requirement gathering since we know most of the frontend system design interviews last for around 45 min to 1 hour. In this limited time, we can not dig deep into all the functional and non-functional requirements.
This step helps you to discuss all the functional and non-functional requirements, and come up with a scoped list of requirements on which you will going to focus in the rest of the interview
Let's say we need to build an e-commerce application like Amazon, and we have mentioned user management, authorization & authentication, and role-based access as a functional requirement. These kinds of requirements are common in most of applications, so In the scoping step, you can discuss and remove these kinds of trivial common requirements and focus on more specific requirements related to the application design.
There are 3 major approaches for architecting frontends
There are 4 Major Protocols for Communication between client-server or between services.
4 Common Approaches for Data Fetching
How data and overall webpage render on the client device.
DOM-based Vs Canvas
How is the overall webpage delivered to the user’s device? There are 3 popular techniques
A classic create-react app is an example of client-side rendering, without using any special package to make it server-side. This means only a single base “div” element is rendered and the whole application is rendered within div using JavaScript.
✅ You should cover this part only if you get a “YES” below questions from the interviewer
Q1 - What is the user age group? Do we need special support for senior citizens?
Q2 - Is this a general-purpose application? and expected to be utilized by specially-abled users?
✅ Primary considerations (You should cover the important ones, due to the limited time, otherwise there are many others for vision, hearing, voice & disabilities)
💠 Screen reader support - By utilizing semantic elements, aria-roles and aria-states
💠 Keyboard support - Keyboard navigation support for the Application
💠 Contrast colour support - Support contrasting colours, light/dark theme support.
✅ You should cover this part only if you get a “YES” below questions from the interviewer
Q1 - Does this application have a user base across the borders?
Q2 - Does this application require localization support for multiple local languages
For example - localization can still be applicable in India to support regional languages, along with English.
✅ Primary considerations
💠 Support for the language switch or auto-detect the browser's default language
💠 Which currency to show
💠 Time-zone & date time format support etc.
✅ You should cover this part only if you get a “YES” below questions from the interviewer
Q1 - Does this application work even if there is no internet connection, and will sync as soon as online?
Q2 - How much data support is required for offline access? With the answer to this question, you can decide which type of cashing you can utilize to support offline access
✅ Primary considerations
💠 Implementation of offline capabilities can be achieved through “Service workers”. You can consider making the app a PWA (Progressive web app) where the app will have more capabilities than just offline support.
Divided into 2 parts to cover them in depth within the length limit
1. Data Entities
2. Data Store
What are data entities? how do you represent them?
💠 Data entities represent the building blocks of the data which is required to render the part of the frontend application.
For example - In the News Feed frontend System, define data entities that are required to represent a single newsfeed
💠 Data Entities are similar to Objects (Real-world Entities) in Object Oriented Programming.
💠 Generally it's advisable to use TypeScript to represent the type of the data entities, you can assume these are the kinds of TS Interfaces that you need to design the system.
Let’s take an example of a complex system like Google Sheets,
here is a glimpse of data entities, (It's not the whole, there can be many more)
cell: {
calculatedValue: string
type: TableCellType
formula: formula
formatting: [FormatOptions]
width: number
height: number
}
type CellType {
type: enum [NUMBER, STRING, DATE, CUSTOM],
defaultFormula: formula
customFormula: String
}
type formula {
name: string
expression: string
}
type FormatOptions: enum {
BOLD,
STRIKETHROUGH,
ITALIC,
…
}
👉 In general, trivial data entities can be skipped after getting confirmation from the interviewer like User, Authentication/Authorization (Role base access), Caching entities etc.
👉 It's important to make sure that using the described entities, you will be able to represent the whole data/functionalities required in step 1 of requirement gathering.
👉 Keep it crisp so that can be practical to cover in 1 hour Interview.
Data Sore is important for easily storing and accessing application state-specific data and API responses. A few examples of data store libraries like Redux, Redux-toolkit, MobX
Follow the below pointers to create a Data Store for an application or component in the frontend system design interview
{
posts: [
{
id: 12758,
slug: "blogs/mypost1",
tags: ["concept", "javascript"]
},
{
id: 12698,
slug: "blogs/mypost2",
tags: ["concept", "css"]
}
]
}
Normalized data for Data Store, Now posts can be accessed directly posts[<id>]
{
posts: {
12758: {
slug: "blogs/mypost1",
tags: ["concept", "javascript"]
},
12698: {
slug: "blogs/mypost2",
tags: ["concept", "css"]
}
]
}
This step involves designing an API which will fuel the whole application with data from the server
Design the API using the protocol which has been selected as part of Data Fetching Protocols and consider the below points while designing the APIs
There are 2 parts of the API design - the URL and the response
Use API versioning to enable backward compatibility in case of a change in APIs.
Examples: /api/v1/posts
& /api/v2/posts
Consider long list support for the API design
Use required tokens to enable API security, popular ones are below
Authorization: bearer <JWT token>
Use Failure & Exception handling by adding Error Codes & Error Messages as part of the API response.
{
error: {
code: 2374,
message: [{
error_message: "Something went wrong",
error_description: "This error happened due to failure of xyz service."
}]
}
... rest of the API details
}
3 types of optimizations can be done to make frontend applications fast and optimized.
BEM block__element--modifier
<img loading="lazy/eager" src="" />
These are the additional topics, which can be covered if explicitly asked or time permits as part of the frontend Sytem Sesign Interview
Below are the important security considerations for most applications
Observability involves the systems and ways to measure the health of the overall system
How to ensure the quality of the application when several team members working on the same code base, and how to avoid regressions. There are a few primary testing & automation considerations like
Anuj Sharma
Last Updated Aug 29, 2024
Understand important web authorization techniques to enhance role-based authentication for any web application with popular techniques like Session & JSON Web Token (JWT)
Anuj Sharma
Last Updated Nov 16, 2024
A brief explanation of Cross-Origin Resource Sharing (CORS) concept to enable client application accessing resources from cross domain and HTTP headers involved to enable resource access.
Vivek Chavan
Last Updated Sep 15, 2024
You will get a clear understanding about working with any rest api and common concepts asked during interviews
Anuj Sharma
Last Updated Aug 29, 2024
Easy to understand 5 rules, that cover the behaviour of the "this" keyword in different contexts and helps you to master this keyword for any javascript interview.
Ram V
Last Updated Sep 20, 2024
Let's dive into how the function's bind method works to bind the context to any function and understand its internal workings by exploring bind method polyfill.
Anuj Sharma
Last Updated Aug 31, 2024
Understanding promise's methods is important to call APIs in parallel and it's an important concept to know for any machine coding interview.
© 2024 FrontendGeek. All rights reserved