2–5 years · Mid — Node.js · Express · MongoDB · React · REST APIs · Authentication
Reviews performance metrics to identify impacted routes; checks recent code changes for resource-heavy operations; uses logging to trace execution paths; inspects database queries for inefficiencies; isolates the feature to test in a staging environment.
You find that a third-party API call is the bottleneck. What changes would you make to mitigate this issue?
Considers the access patterns, ensuring frequent queries can be optimised; mentions embedding comments if they are always accessed with the post; discusses referencing if comments are large or needed independently; evaluates trade-offs in data duplication and consistency; considers future scalability.
What would change if comments needed to be updated frequently?
Enables detailed logging around the feature to capture error details; checks for race conditions or state inconsistencies; utilises monitoring tools to track performance metrics; reproduces the issue in a controlled environment to isolate variables; reviews recent code changes that may have introduced bugs.
What if the issue only occurs under specific load conditions?
Identifies the source of state management, checks for direct state mutations; reviews context providers or global state solutions; implements logging to track state changes; considers lifting state up or using local component state; suggests memoisation to prevent unnecessary re-renders.
You implemented a global state management solution but users are still facing issues. What steps do you take next?
Implements a refresh token strategy where the access token is short-lived while the refresh token has a longer lifespan; stores refresh tokens securely, ideally in HttpOnly cookies; uses a secure endpoint to exchange refresh tokens for new access tokens; considers revocation strategies for compromised tokens.
What measures would you take to mitigate the risk of token theft?
Utilises virtualisation libraries like react-window or react-virtualized to only render visible items; leverages memoisation with React.memo or useMemo for expensive components; checks for unnecessary re-renders using React DevTools; suggests pagination for managing large data sets.
If virtualisation isn't an option, what else could you try?
Load six more — you will get questions you have not seen first.
Give me six more →Say your answer out loud before revealing. Reading the answer first feels like learning and is not.