Skip to content
Interview prep · questions

Design and architecture interview questions

12 questions, from core to senior. Say your answer out loud first, then open the model answer and check it against the points a strong answer covers.

We have 40 minutes for a frontend system design question. How do you structure your answer and use the time?

  • Core
Show the model answer

I follow five steps, called RADIO: Requirements, Architecture, Data model, Interface and Optimizations. First I ask questions and agree on the main features and the limits. Then I draw the main parts on the client and the server and say what each one does. Next I describe the data: the entities, their fields, and where each piece of state lives. Then I define the interface, which is the API between the parts: component props, and server calls with their request and response shapes. Last I go deep on optimizations: performance, accessibility, errors and edge cases. For 40 minutes I plan about 4 minutes for requirements, 8 for architecture, 4 for the data model and 8 for the interface. That leaves about 16 minutes for optimizations, because the deep questions come there. I watch the clock and move on when a step has used its time.

A strong answer covers

  • Five steps in order: Requirements, Architecture, Data model, Interface, Optimizations
  • Questions and an agreed scope come before any drawing
  • Interface means the API between parts: component props and server calls
  • A time split for 40 minutes, with the largest share for optimizations
  • The clock is watched, and each step ends when its time is used

Likely follow-up

The interviewer gives you one sentence and no requirements. What do you ask first?

How do you choose between offset and cursor pagination, and between infinite scroll and numbered pages?

  • Core
Show the model answer

I choose by how the data changes and how people use the list. Offset pagination sends a page number and a size. It is simple, the user can jump to any page, and the page number fits in a link. But when items are added or removed while the user reads, an item can appear twice or be skipped. A large offset is also slow in the database. Cursor pagination sends a pointer to the last item. It stays correct and fast when the data changes, but it cannot jump to page 50. On the screen, infinite scroll suits a feed that people browse without a goal. Numbered pages suit search results and tables, where people return to a place, share a link and need the footer. Infinite scroll is also harder for keyboard and screen reader users, so I often use a Load more button.

A strong answer covers

  • Offset: simple, can jump to any page, fits in a link
  • Offset problems: duplicates or skipped items when the data changes, and slow large offsets
  • Cursor: correct and fast when the data changes, but no jump to a page number
  • Infinite scroll for a feed; numbered pages for search results and tables
  • Infinite scroll costs: the footer, returning to a place, keyboard and screen reader use

Likely follow-up

A user opens an item from an infinite list and presses Back. How do you return them to the same place?

How do you cache server data on the client, and how do you keep it fresh?

  • Core
Show the model answer

I keep server data in a cache with one key per query, and I treat it as a copy that can be old. The key contains everything that changes the result: the resource, the id, the filters and the page. With stale-while-revalidate, the screen shows the cached data at once, the client fetches again in the background, and the new data replaces the old. After a mutation I invalidate the keys that the change affects, so they load again, or I write the server response directly into the cache. There are two cache shapes. A per-query cache stores each response under its key. It is simple, but one item can sit in two queries with different values. A normalized cache stores each entity once by id, so one update shows everywhere, but it needs more setup. For most REST applications I choose a per-query cache with careful invalidation.

A strong answer covers

  • The key holds everything that changes the result: resource, id, filters, page
  • Stale-while-revalidate: show cached data at once, fetch again in the background
  • After a mutation: invalidate the affected keys, or write the response into the cache
  • Per-query cache: simple, but one item can sit in two queries with different values
  • Normalized cache: each entity stored once by id, with more setup

Likely follow-up

A user changes their name on the profile page. Which cached data must change, and how do you do it?

What is an optimistic update, and when would you not use one?

  • Core
Show the model answer

An optimistic update changes the screen before the server answers, because we expect the request to succeed. I use it for small actions that almost always succeed and are easy to undo: a like, a checkbox, a rename. The steps are these. I cancel running fetches for that data, so they do not overwrite my change. I save the current value. I write the new value into the cache and send the request. If the request fails, I put the saved value back and show a clear message. When it ends, I fetch again, so the client matches the server. I do not use it when a wrong screen is costly or when the server decides the result: payments, bookings, stock, permissions. There I show a pending state and wait for the real answer.

A strong answer covers

  • The screen changes before the server answers, because success is expected
  • Good for small actions that are easy to undo: like, checkbox, rename
  • The old value is saved and put back on failure, with a message
  • A fetch after the request makes the client match the server
  • Not for payments, bookings, stock or permissions: show pending and wait

Likely follow-up

The user clicks Like twice fast and the first request fails. What should the screen show?

Which states does every view that loads data need, and how do you design them?

  • Core
Show the model answer

Every data view needs five states: loading, empty, error, partial and success. For loading I prefer a skeleton with the same shape and size as the real content. Then the page does not jump when the data arrives. A spinner is fine for a short action, such as saving a form. Empty means the request worked but there is nothing to show, so I explain why and offer the next action. Error means the request failed, so I say what happened in plain words and give a retry button. Partial means that some parts loaded and others failed, or that old data is shown while new data loads. I keep what works on the screen and mark the rest. I reserve space for images and late content to avoid layout shift. I also announce loading and errors to screen readers with a status or alert region.

A strong answer covers

  • All five named: loading, empty, error, partial, success
  • A skeleton with the final shape and size; a spinner only for short actions
  • The empty state explains why and offers the next action
  • The error state has a plain message and a retry; working parts stay visible
  • Space is reserved to avoid layout shift, and changes are announced to screen readers

Likely follow-up

A page has five widgets and one of them fails to load. What does the user see?

How do you organize the code of a large frontend application?

  • Core
Show the model answer

I organize it by feature or domain, not by file type. Each feature, for example checkout or search, has one folder with its components, hooks, API calls, state and tests together. A change to one feature then touches one folder, and it is clear who owns it. Each feature has a public API, usually an index file that exports what other code may use. Everything else is private. Imports go in one direction: the app layer uses features, and features use shared code. A feature never imports the internal files of another feature. Shared code has rules too. It holds only general things, such as UI components and helpers, with no business logic, and it never imports from a feature. I enforce these boundaries with a lint rule, so they do not depend on code review. Code moves to shared only when a second feature really needs it.

A strong answer covers

  • Folders by feature or domain, each with its own components, hooks, API calls and tests
  • A public API for each feature (an index file); everything else is private
  • Imports go one way: the app uses features, and features use shared code
  • Shared code is general, has no business logic and never imports a feature
  • A lint rule enforces the boundaries

Likely follow-up

Two features need almost the same component. When do you move it to shared, and when do you keep two copies?

How do you decide where a piece of state should live in a React application?

  • Senior
Show the model answer

Every piece of state gets one owner, and everything else reads it or computes from it. I first ask what kind of state it is. Server data, such as a list of orders, belongs in the server cache, not in a global store. State that must survive a reload or be shared in a link belongs in the URL: filters, the page, the open tab. State that one component needs, such as an open menu or an input value, stays local. I lift it up only when another component needs it. What remains is global client state, such as the theme, and it is usually small. The main mistake is duplicated state: copying props or server data into local state, or storing a value that can be computed. Two copies drift apart, so I keep one and derive the rest during render.

A strong answer covers

  • One owner for each piece of state; the rest read it or derive from it
  • Server data lives in the server cache, not in a global store
  • Filters, page and open tab live in the URL: they survive a reload and fit in a link
  • Local state first; it is lifted up only when another component needs it
  • No copies of props or server data in state; computed values are derived during render

Likely follow-up

A filter is in the URL, and the user is editing it in a form. Which one is the source of truth?

How would you design live updates in a web application, for example new messages or changing prices?

  • Senior

The model answer to this senior question opens with a year in the app. What a year includes

How do you design the API of a reusable component, for example a Select or a Modal?

  • Senior

The model answer to this senior question opens with a year in the app. What a year includes

What are micro-frontends, and when would you use them?

  • Senior

The model answer to this senior question opens with a year in the app. What a year includes

How would you move a large legacy frontend to a new framework without stopping feature work?

  • Senior

The model answer to this senior question opens with a year in the app. What a year includes

How do you know that your frontend works well for real users in production?

  • Senior

The model answer to this senior question opens with a year in the app. What a year includes