Food Ordering App: Swiggy Interview Experience
Real Swiggy interview experience building a food ordering app. Here is what to expect and how to crack it.
Food Ordering App: Swiggy Interview Experience
Here is a real Swiggy interview experience building a food ordering app in the machine coding round.
The Question
Build a food ordering app with:
- A menu of food items (name, price, image, rating, category).
- Search by name.
- Filters (veg/non-veg, category, price range).
- Cart with add, remove, quantity change.
- Cart total and checkout.
Time
90 minutes.
What They Evaluated
- Functionality: does the cart work? Do filters work? Does search work?
- Code quality: is the code modular and clean?
- Edge cases: empty cart, no results, quantity 0.
- UI: does it look like a real food app?
- Approach: how did you structure the state and rendering?
What Worked
- Starting with the data (menu array) and state (cart object).
- Building the menu rendering first, then filters, then cart.
- Using a single state object for all data.
- Handling edge cases (empty cart, no results).
- Adding basic CSS at the end (grid layout, colors, padding).
What Did Not Work
- Spending too much time on CSS early (functionality first).
- Not handling the empty cart state.
- Not debouncing the search.
Follow-Up Questions
- "How would you scale this for 10,000 items?"
- Virtualization, pagination, server-side search.
- "How would you persist the cart?"
- localStorage or a backend API.
- "How would you handle concurrent cart updates?"
- Optimistic UI, conflict resolution.
- "How would you add a coupon/discount system?"
- Apply a discount code to the total before checkout.
Tips
- Build the cart logic first (it is the hardest part).
- Use an object for cart state (itemId -> quantity).
- Handle edge cases (empty cart, no results, quantity 0).
- Add basic CSS at the end (grid, flexbox, colors).
- Be ready for follow-ups on scaling and persistence.
The Takeaway
Swiggy's food ordering app question tests cart logic, filters, search, and state management. Build cart first, then menu, then filters. Handle edge cases. Add basic CSS. Be ready for follow-ups on scaling, persistence, and concurrent updates.
Build a food ordering app with a menu, search, filters (veg/non-veg, category, price), cart (add, remove, quantity), cart total, and checkout. 90 minutes. They evaluate functionality, code quality, edge cases, UI, and approach.
How would you scale for 10,000 items (virtualization, pagination, server-side search)? How would you persist the cart (localStorage, backend)? How would you handle concurrent updates (optimistic UI)? How would you add coupons (discount code on total)?
The cart logic. Managing add, remove, quantity change, and total calculation. Use an object mapping item ID to quantity. Handle quantity 0 (remove from cart). Calculate total by summing price * qty for each item.
10 min: plan data and state. 40 min: build menu rendering and cart. 20 min: add search and filters. 10 min: handle edge cases. 10 min: CSS and testing. Build cart logic first (it is the hardest part).
Functionality first (cart, menu, filters, search). Then edge cases (empty cart, no results, quantity 0). Then CSS (grid, flexbox, colors). Do not spend too much time on CSS early. A working app with basic CSS scores higher than a beautiful app that does not work.
Ready to master React completely?
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.
Master React
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course.

