DEV Community

Cover image for Build a Production Ready MERN Stack e-Commerce Website with React, Node.js, MongoDB, JWT & Razorpay.
Sudhanshu Gaikwad
Sudhanshu Gaikwad

Posted on

Build a Production Ready MERN Stack e-Commerce Website with React, Node.js, MongoDB, JWT & Razorpay.

A complete walkthrough of a full-stack online store with JWT auth, OTP verification, Razorpay payments, Cloudinary uploads, and a real admin dashboard and why you should fork it.

If you’ve ever wanted a clean, modern, fully functional e-commerce project that actually feels production-ready, meet eKart.
eKart is a complete MERN stack online shopping platform that goes far beyond the typical “todo + cart” tutorial. It includes secure authentication with OTP email verification, real payment processing via Razorpay, image uploads with Cloudinary, a polished admin dashboard with sales analytics, and a responsive user experience built with modern tools.

Anyone can clone it, fork it, run it locally, or deploy their own version. The project is open-source under the MIT License.


Why This Project Exists

Most MERN e-Commerce tutorials stop at the basics: product listing, a simple cart, and maybe a fake checkout. Real applications need authentication that actually works, email verification, secure payments, image handling, role-based access, and an admin side that can manage the whole store.
eKart was built to fill that gap. It is a single repository that contains both the frontend and backend, properly structured, with environment variable examples and clear installation steps.


What Users Can Do

  1. User Registration & Login
  2. JWT Authentication
  3. OTP Email Verification
  4. Secure Password Encryption
  5. Browse products, view details, and search
  6. Manage their profile
  7. View order history
  8. Product Details Page
  9. Search Products
  10. Add to Cart
  11. Update Cart Quantity
  12. Remove Cart Items
  13. User Profile Management
  14. Order History
  15. Razorpay Secure Payment
  16. Responsive Design


What Admins Can Do

  1. Admin Authentication
  2. Manage Users
  3. Add Products
  4. Edit Products
  5. Delete Products
  6. Upload Product Title, Product Info with 5 Images (Cloudinary)
  7. Create, edit, and delete products
  8. Access a dashboard with total users
  9. Sales charts (Recharts) and recent orders
  10. Manage orders and update order status
  11. Manage Payments
  12. Update Order Status
  13. Access a dashboard with total users, products, orders, revenue, and monthly
  14. Dashboard Analytics
  15. Sales Reports using Recharts
  16. User Control Permissions: User, Admin, Delete, Edit.


Tech Stack

Frontend :

  1. React.js 19 (Vite)
  2. Redux Toolkit
  3. Tailwind CSS
  4. Shadcn UI
  5. React Router DOM
  6. Axios
  7. Recharts
  8. React Medium Image Zoom

Backend :

  1. Node.js
  2. Express.js
  3. MongoDB + Mongoose
  4. JWT
  5. bcryptjs
  6. Nodemailer
  7. Multer
  8. Cloudinary
  9. DataURI

Payments :

  1. Razorpay (order creation + payment verification)

Other :

  1. Protected Routes
  2. OTP Email Verification
  3. CORS
  4. Environment Variables
  5. Cloudinary Image Upload

Project Structure (High Level)


eKart

├── Frontend
   ├── public
   ├── src
      ├── assets
      ├── components
      ├── pages
      ├── layouts
      ├── redux
      ├── hooks
      ├── services
      ├── utils
      ├── App.jsx
      └── main.jsx
   ├── package.json
   └── .env.example

├── Backend
   ├── config
   ├── controllers
   ├── middleware
   ├── models
   ├── routes
   ├── uploads
   ├── utils
   ├── app.js
   ├── server.js
   ├── package.json
   └── .env.example

├── README.md
├── LICENSE
└── .gitignore

Enter fullscreen mode Exit fullscreen mode

The separation is clean. Frontend and backend each have their own package.json and.env.example, so you can run them independently during development.


Authentication & Security Highlights

  1. JWT Authentication
  2. Protected Routes
  3. Password Hashing (bcrypt)
  4. OTP Email Verification
  5. Role-Based Authorization
  6. Admin Access

Payment Integration

  • User proceeds to checkout
  • Backend creates a Razorpay order
  • Frontend opens the Razorpay checkout
  • After successful payment, the backend verifies the signature
  • Order is created automatically This is the real integration pattern, not a mock.

Admin Dashboard

The dashboard shows:

  1. Total Users
  2. Total Products
  3. Total Orders
  4. Total Revenue
  5. Monthly Sales Analytics
  6. Recent Orders
  7. Revenue Charts It gives a practical feel of what a real store owner would need day-to-day.

API Modules

Authentication

  1. Register
  2. Login
  3. Logout
  4. Verify OTP

Users

  1. User Profile
  2. Update Profile

Products

  1. Get Products
  2. Product Details
  3. Add Product
  4. Update Product
  5. Delete Product

Cart

  1. Add Item
  2. Update Quantity
  3. Remove Item
  4. Get Cart

Orders

  1. Create Order
  2. View Orders
  3. Update Order Status

Payments

  1. Create Razorpay Order
  2. Verify Payment

Admin

  1. Dashboard Statistics
  2. Manage Users
  3. Manage Products
  4. Manage Orders

Getting Started in Minutes


git clone https://github.com/sudhanshugaikwad/free-mern-ecommerce-website.git

cd mern-ecommerce-website

Enter fullscreen mode Exit fullscreen mode

Frontend


cd Frontend
npm install
npm run dev

Enter fullscreen mode Exit fullscreen mode

Backend


cd Backend
npm install
npm run dev

Enter fullscreen mode Exit fullscreen mode

You will need to fill in the environment variables (examples are provided in both folders):

Backend .env


PORT=
MONGODB_URI=
JWT_SECRET=
EMAIL_USER=
EMAIL_PASS=
RAZORPAY_KEY_ID=
RAZORPAY_KEY_SECRET=
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=

Enter fullscreen mode Exit fullscreen mode

Frontend .env


VITE_API_URL=http://localhost:5000
VITE_RAZORPAY_KEY_ID=

Enter fullscreen mode Exit fullscreen mode

Future Roadmap

The project already has a solid foundation. Planned improvements include:

  • Product reviews & ratings
  • Wishlist
  • Coupon system
  • Inventory management
  • Better email/SMS notifications
  • Dark mode
  • Multi-language support

Why You Should Fork It

  • Clean, readable code
  • Modern stack (React 19 + Vite, Redux Toolkit, Tailwind + Shadcn)
  • Real-world features (OTP, Razorpay, Cloudinary, analytics)
  • MIT License use it commercially if you want
  • Active and ready for contributions

Whether you are learning the MERN stack, building a portfolio project, or looking for a solid base to customize into your own store, eKart is a great starting point.


Support the Project

If the project helps you, give it a ⭐ on GitHub. Stars make it easier for other developers to discover it.

GitHub: eKart mern-ecommerce-website

Live Demo: eKart

Built by Sudhanshu Gaikwad

GitHub: https://github.com/sudhanshugaikwad/free-mern-ecommerce-website
LinkedIn: https://www.linkedin.com/in/sudhanshugaikwad/

Happy coding, and feel free to fork, improve, and ship your own version of eKart!

Top comments (0)