How would you scale a food ordering app for 10,000 items?
Move search and filtering to the server (send the query, get filtered results). Use virtualization for rendering (only render visible items). Paginate the results. Cache search results. Do not render 10,000 DOM nodes.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Food Ordering App: Follow-Up Questions in Interviews
How would you scale for 10,000 items (server-side search, virtualization)? How would you persist the cart (localStorage, backend)? How would you handle concurrent updates? How would you add authentication and payment? How would you test and make it accessible?
Use localStorage for client-side: save on every cart change, load on page load. For cross-device, send the cart to a backend API associated with the user ID. Handle the storage event for multi-tab sync.
Unit test the cart logic (add, remove, quantity, total). Integration test filters and search. E2E test the full flow (browse -> add -> checkout). Test edge cases (empty cart, no results, quantity 0). Use Jest, React Testing Library, and Cypress.
Still have questions?
Browse all our FAQs or reach out to our support team
