← All projects
Web Development · MERN

E-Commerce Platform — MERN stack with a real cart & checkout

A full store with a cart that survives a refresh, real stock, and a working checkout.

Most e-commerce projects are a product grid with a Buy button that does nothing, and they collapse the moment an examiner asks what happens when two people buy the last item. This one keeps the cart on the server so it survives refresh and login, decrements stock so it can never oversell, and runs a real Razorpay test-mode checkout that produces an order you can open in an admin panel. It behaves like a shop, not a screenshot.

Suits
BCA ·MCA ·B.Tech ·B.Sc IT
Level
Intermediate
Live sessions
8
Seats per college
2 / year

What it does

  • Product catalogue with search, category filters, and pagination
  • Server-side cart that persists across refresh, logout, and device
  • Stock decremented safely so two buyers can never oversell the last unit
  • Razorpay test-mode checkout with an order confirmation and receipt
  • Per-user order history with status tracking
  • Admin panel to manage products, stock, and incoming orders

What the sessions cover

  1. 01Architecture — why MERN, the auth flow, and how the layers talk
  2. 02MongoDB schema: products, users, cart, and orders
  3. 03JWT authentication and protected routes, front and back
  4. 04Cart logic and the oversell problem — why stock lives on the server
  5. 05Razorpay test integration and verifying the payment callback
  6. 06The admin panel: product CRUD and order management
  7. 07React + Redux Toolkit UI, and keeping cart state honest
  8. 08Deployment, environment secrets, and full mock viva

Stack

ReactNode.jsExpressMongoDBRedux ToolkitJWTRazorpay (test mode)

How it works

A shopper browses a catalogue served by an Express API that paginates on the database side, so the page loads 20 products at a time instead of the whole collection. Search and category filters become MongoDB query parameters backed by indexes on name and category, which is what keeps the catalogue fast once it holds a few thousand items.

Adding to the cart writes a document keyed to the user, not to the browser. A guest cart lives in localStorage and is merged into the server cart at login, so nothing is lost when someone signs in halfway through shopping. Redux Toolkit mirrors the server state and is refreshed from it rather than trusted on its own.

Checkout creates a pending order and a Razorpay order on the server. The Razorpay widget collects the test payment, and the callback is verified with an HMAC signature using the secret key before the order is marked paid. Only then is stock decremented, inside a conditional update that fails if fewer units remain than were ordered.

The data

Four collections: users (with a role field for admin), products (price, stock, category, images), carts (one per user, an array of product id and quantity) and orders (a snapshot of the line items and prices at purchase time, payment ids, and a status history). Prices are copied into the order so that changing a product later does not rewrite past invoices. Seed data is generated with a script, so the demo never depends on a scraped catalogue.

The hard parts examiners ask about

Overselling the last unit

Two buyers can read stock = 1 at the same moment. The fix is a single atomic findOneAndUpdate that matches stock >= quantity and decrements in the same operation, so the second request matches nothing and gets a clear out-of-stock error.

Trusting the payment callback

A client can claim a payment succeeded. The server recomputes the HMAC-SHA256 of order id and payment id with the Razorpay secret and compares it to the signature it received; an order is paid only when they match.

Price tampering

The cart sent from the browser carries product ids and quantities only. Totals are recalculated on the server from the database prices, so editing a price in DevTools changes nothing.

Viva questions on this project

Why does the cart live on the server and not only in Redux?
Redux state disappears on refresh and does not follow the user to another device. Persisting the cart per user in MongoDB makes it survive both, and Redux becomes a cache of that state rather than the source of truth.
How do you stop two customers buying the last item?
Stock is decremented with an atomic conditional update that only matches when enough units remain. Because the check and the write are one database operation, there is no window for a race between them.
How is a Razorpay payment verified?
The server builds the string order_id|payment_id, computes its HMAC-SHA256 with the key secret, and compares it with razorpay_signature. If they differ the order stays pending.
Where is the JWT stored, and why?
In an httpOnly cookie, so JavaScript on the page cannot read it, which limits the damage of a cross-site scripting bug. The trade-off is that CSRF has to be considered, handled here with SameSite cookies.
Why copy the price into the order document?
An order is a historical record. If the product price changes next week, the invoice for last week must still show what the customer actually paid.

Pick what you need

Direct UPI / bank transfer in monthly installments. Sessions start after the first installment; handover is after the final installment. Full terms — including what happens if you stop midway.

Source

₹5,500

single payment

  • Full source code
  • Local setup guide
  • Sample dataset / seed data
  • One handover call
Enquire about Source

Academic

₹10,000

or ₹5,000/month × 2

  • Everything in Source
  • Project report (synopsis + full document)
  • Presentation deck
  • ER / DFD / architecture diagrams
  • Deployment walkthrough
Enquire about Academic

Mentored

Most picked

₹16,000

or ₹5,400/month × 3

  • Everything in Academic
  • 8 live sessions on Google Meet
  • Line-by-line code walkthrough
  • Viva question prep + mock viva
  • One module varied for you (dataset / domain)
  • WhatsApp support until submission
Enquire about Mentored
Opening 3 seats

This page has no reviews on it yet. Be the reason it does.

The first 3 students get 40% off in exchange for an honest review and permission to show your finished project here. Same build, same sessions, same handover — the discount is the price of going first, and it is not coming back once those seats are gone.

Claim a seat on WhatsApp

Two things I hold myself to

  • Only 2 students from your college get this project in an academic year. On the Mentored tier one module is varied for you — the dataset, the domain, or a feature — so no two submissions read the same.
  • You build nothing. You just have to be able to explain it. The project is delivered finished — code, report, diagrams, deployed. Then daily 60-minute sessions on Google Meet after 8:00 PM IST, walking the code you are submitting, ending in a mock viva. Turn up and you will know it well enough to answer anything the panel asks.

Enquire about this project

Tell me your submission deadline and which tier fits. You get a session schedule and an installment split back — usually within a day.