
Master a complete MERN stack ecommerce site—from authentication to deployment—using Node, Express, MongoDB, and React with Redux Toolkit Query, plus Stripe payments and Cloudinary image hosting.
Explore the MERN stack e-commerce demo Shop It, featuring React and Redux front end, product search and filters, cart and checkout with stripe, admin dashboard, and invoice generation.
Install essential tools for the MERN stack ecommerce project: Visual Studio Code, Node.js, Git, Postman, and MongoDB Compass, then configure the terminal and test APIs.
install mongodb community server on macOS using homebrew, install Xcode command line tools, verify installation with mongo and mongo sh, and explore databases with show dbs.
Install the MongoDB community server on Windows, download the MongoDB shell and MongoDB compass, install them, set the system path via environment variables, then start mongod and connect.
Access version two of the shop-v2 project on the official GitHub repository, using section-specific branches to download code after each course section, such as the 003 error handling branch.
Set up the back end of a MERN e-commerce project by initializing the project, installing express, dotenv, and mongoose, creating app.js, configuring port with config.env, and running the server.
Install nodemon as a dev dependency and configure npm scripts to run the backend with nodemon in development, enabling automatic restarts on changes and setting NODE_ENV for development and production.
Create your first route for the product resource using Express router, implement a get products controller, register routes under /api/v1/products, and test with Postman.
Set up a Postman environment Shop It v2 with a domain variable pointing to localhost:4000, activate it, and create a Shop It v2 collection with a get all products request.
Connect to a MongoDB database with mongoose by using env-driven local and production URLs, initialize a db connect module, and call it from app.js to establish shop-it-v2.
Create a Mongoose product model with name, price, description, ratings, images (Cloudinary ids and urls), category (enum), seller, stock, reviews, and user references; export the model with timestamps.
Create and save a product in the database using the product model and mongoose via the admin route /api/v1/admin/products. Parse json with express.json and validate required fields to ensure creation.
Fetch all products from the database using the get products function and return them in the /api/v1/products response, preparing for the upcoming data seeder and crud operations.
Create a data seeder to populate the database with nine products using data.js and cedar.js, connecting with Mongoose, deleting existing products, and inserting new ones via npm.
Create a get single product route to fetch product details by id using Mongoose findById, returning 404 when not found and the product data when found.
Admins learn to update product details in a MERN e-commerce app by implementing a put /api/v1/product/:id route, using findByIdAndUpdate with new: true to return the updated document.
Implement a delete product endpoint by locating the product with request.params, deleting it with deleteOne, and returning a product deleted message, with route wiring and future global error handling explained.
Create a custom error handler class extending the default error, exporting it, with message and status code, plus optional stack trace for development and preparation for error middleware.
Create and integrate an error middleware in your MERN stack project to handle errors before each request, using a default 500 status and the internal server error message.
Master the difference between development and production errors with a MERN error middleware. Reveal full error details in development and show only a simple message in production.
Learn to handle unhandled promise rejections by wiring process.on('unhandledRejection'), log the error, shut down the server gracefully, close the server, and exit the process to stay stable.
Learn to handle uncaught exceptions in a Node.js backend by using process.on('uncaughtException'), log the error, announce shutdown, and exit with code 1, following prior handling of unhandled promise rejections.
Wrap controller functions with a global catch-async error handler to catch errors and pass them to the next middleware. Handle unhandled promise rejections and mongoose errors with clear client messages.
Master robust error handling for a mern stack ecommerce backend by addressing invalid mongoose id errors and validation errors, returning precise 404 and 400 messages.
Implement a keyword search for products using a custom API filters class that parses the query string, applies a case-insensitive regex on product names with Mongoose's find.
Build backend product filters by creating a query-copy filters function, removing the keyword, and applying category, price, and ratings with $gt/$gte/$lt/$lte.
Implement pagination in the backend by calculating current page and skip, applying a per-page limit with mongoose, and cloning the query to safely execute multiple requests.
Create the user model for authentication using a mongoose schema with name, unique email, password hidden in responses, avatar, role, and reset token fields with timestamps.
Register users by hashing passwords with bcrypt in a mongoose pre save hook, enforce minimum password length, and prevent duplicate emails, demonstrated via postman testing of the api routes.
Generate json web tokens (jwt) in a MERN app by adding a getJWTToken method to the user model, signing with a secret, and embedding the user id with seven-day expiry.
Implement a login route at /api/v1/login, validate inputs, fetch the user by email including the password, compare passwords with bcrypt, and return a signed token on success.
Create a JWT token from the user, store it in an HttpOnly cookie that expires in seven days, and return the token for authentication in a MERN app.
Implement is authenticated user middleware that reads a token from cookies, verifies it with JWT, attaches the user to the request, and protects routes with a 401 unauthorized response.
Learn to implement a logout route in a MERN stack app by clearing and expiring the authentication cookie, using httpOnly, and protecting routes with role-based authorization.
Implement an authorize roles middleware to verify authenticated users and restrict admin routes to admins. It checks the user role, returns 403 when unauthorized, and calls next to proceed.
Enable admin-only product creation by saving the user id on creation and wiring the product model to require a user reference via request.user.id.
Generate forgot password token using node's crypto to create a random hex token, hash it with sha256, store the hash, and set a 30-minute expiry for email delivery.
Configure nodemailer in a Node.js backend to send a password reset email, set up mailtrap for testing, and build a reset password HTML email template that includes a reset URL.
Configure and test a forgot password endpoint that creates a reset token with node mailer, saves it to the user, and emails a reset URL using a template.
Learn to securely reset a user password by hashing the reset token, validating a 30-minute expiry, enforcing password confirmation, updating the user password, and clearing reset fields after use.
Handle duplicate key and json web token errors in the MERN stack by providing clear messages for duplicate emails, invalid or expired tokens, and prep for user profile operations.
Fetch the current logged-in user's details through a protected /api/v1/me route in a MERN stack app, using request.user and isAuthenticatedUser to return name, email, role, createdAt, and updatedAt.
Create a put endpoint at /api/v1/password/update to fetch the current user, verify the old password, set the new password, save the user, and return success.
Set up a put endpoint /me/update to update a user's name and email, using findByIdAndUpdate with new: true. Confirm the updated profile by testing with Postman.
Create admin endpoints to get all users and a user by id in a MERN ecommerce app, enforcing admin access and handling not-found errors.
Update and delete users via admin routes api v1 admin users/:id, including changing roles. Test with postman and plan cloudinary avatar removal later.
build a complete order model with shipping details, user linkage, and order items, and set up endpoints to create, update, and delete orders with payment data.
Create and save a new order via a protected endpoint in a MERN stack ecommerce app, handling order items, shipping info, payments (cash on delivery), and database persistence.
Implement two api endpoints: get order details by id and get current user orders, using order.findById and order.find with the user id, and populate user name and email.
Create admin endpoints to get all orders and update order status (processing, shipped, delivered). Update stock for ordered products when shipping, iterating order items to adjust quantities.
Develop and test the admin delete order endpoint in the MERN ecommerce app, handling not-found errors and returning a success response after deletion.
If you want to learn Full Stack Web Development using MERN stack then you have arrived at the right page. In this course, you will How to Build a Fully Functional E-commerce website using the MERN Stack.
In this course, we will use four powerful technologies: React (Frontend), Node.js (Backend runtime environment), Express (Backend Framework), and MongoDB (Database).
But that's not all! We'll equip you with the Redux Toolkit for flawless state management, seamlessly process payments with Stripe, manage images effortlessly with Cloudinary, and ensure top-notch authentication and authorization practices with MERN stack.
SUPER FRIENDLY SUPPORT:
If you ever get stuck in any problem, I'm here to unstuck you. I always respond as fast as I can. Because I know there’s nothing worse than getting stuck into problems, especially programming problems. So, I am always here to support you.
So if you are really interested in full-stack development or if you want to learn real implementation of MERN stack, Then I will see you in the course. Below are course highlights that you can read:
Setting Up Environment
Starting with the ShopIT Backend
Adding Products Resource
Backend Error Handling
Adding Filter, Pagination, Search
Authentication & Authorization
User Routes
Adding Orders Resource
User Reviews
Starting with ShopIT Frontend
Implementing Redux
Adding Pagination, Search & Filters
Users & Authentication Frontend
Adding Shopping Cart
Handle Checkout & Payments
User Orders & Reviews
Admin Routes
Deployment