Project Case Study

Swiggy MERN Platform

An authentic, full-stack food delivery platform with zero-config in-memory database auto-seeding, live order tracking, and dynamic promo validation.

Live Demo → GitHub Repo

How It Started

Food delivery platforms are incredibly complex systems involving live tracking, cart state management across sessions, dynamic pricing, and promo validation. I wanted to build an authentic clone of Swiggy to challenge myself with these full-stack architectural problems.

The goal was to build a robust MERN stack application (MongoDB, Express, React, Node.js) that not only functions perfectly locally but can also cleverly fall back to static hosting (like GitHub pages) using a dual-mode client fallback engine.

Architecture & Flowchart

        graph TD
          User((User)) -->|Browses Menu & Cart| ReactFrontend[React 19 Vite App]
          ReactFrontend -->|API Requests| ExpressBackend[Express Node.js API]
          ExpressBackend -->|Validates Promo/Order| Controller[Business Logic Controller]
          Controller -->|Reads/Writes Data| MongoDB[(MongoDB Database)]
          ReactFrontend -.->|Fallback if API unreachable| StaticData[Static JSON Fallback Engine]
          StaticData -.->|Simulates API| ReactFrontend
      

Challenges Faced

1. Dual-Mode Deployment

To make the project accessible without needing a live backend server running 24/7, I engineered a dual-mode system. The React frontend attempts to connect to the REST API. If the API is unreachable (e.g. when hosted statically on GitHub Pages), it gracefully falls back to an in-memory mock engine that simulates API responses, database seeding, and cart state, providing a seamless user experience.

2. Dynamic Cart & Promo Logic

Handling state for carts, taxes, and promotional codes required precise calculations. The backend uses Mongoose to model complex order schemas, while the frontend handles optimistic UI updates, ensuring that users see their totals update instantly before the backend confirms the final price.