This project is a prototype of a ecommerce implementation, which includes the below features.
The User Role has been designated so that users can view all the products, that are added by default by the database, and the Seller role as well.
The Seller Role has been designated so that sellers can perform CRUD (Create, Read, Update, Delete) operations with products. Sellers are provided with a section where they can view the products they added, and can perform further operations on them on that page.
Provided certain functionalities, where the user who is signing up to the web application has to follow certian rules while creating their account. JSON Web Tokens are used for authentication and authorization as well.
-
Email - Validation and sanitation of email addresses are done using custom regular expressions, which enable the application to accept only known email service providers.
-
Password - Sanitation of passwords are performed to prevent the same type of password and add password security to them. The passwords are stored in a hashed format using BcryptJS.
The Client-Side Application is developed using ReactJS, TailwindCSS, Material Tailwind, and Framer Motion. ReactJS is a client-side Javascript library that is used to create User Interfaces. Tailwind and Material Tailwind are used to provide a seamless experience. Framer Motion is a motion library used to add motion to the User Interface. Instructions on how to proceed with starting the client-side application will be provided under application-startup.
The server side application is made using NodeJS, ExpressJS framework and MongoDB as a DBaaS (Database as a Service). Instructions on how to proceed with starting the server-side application will be provided under application-startup.
A search functionality is provided to search for products for different categories, namely "mens", "womens" and "electronics".
Each of the newest products added by each and every seller is seen as the newest product using Badges. They indicate if a product is new in the application or not.
Once users add products to their cart, they are able to checkout their products from the cart as well. The checked out products for that particular ordder, along with the quantity is sent to the order database, that keeps track of the order history of each and every user, which can be referenced to view the order history.
To run this project, you will need to add the following environment variables to your .env file
REACT_APP_BACKEND_URL
= http://localhost:8000/app/auth
mongo
= MongoDB URL to connect to database.
port
= 8000
jwtsecret
= "abhishek"
Go to Server folder
cd server/
npm run start
on another terminal, go to Client folder
cd client/
npm run start
For a set of already added products, hit this route after starting the server-side application
http://localhost:{port}/app/auth/getProductJSON
- Route:
/
- Description: The home page of the application, displaying all the products fetched from the database.
- Route:
/login
- Description: A page providing users/sellers to login to the web application.
- Route:
/register
- Description: A page providing users to register to the web application.
- Route:
/addProducts
- Description: A page providing sellers to add products to their dashboard.
- Route:
/editProducts
- Description: A page providing sellers to edit the added products from the dashboard.
- Route:
/sellerProducts
- Description: A page providing sellers to access their dashboard and edit or delete their added products. (Only shows products the logged in seller has added.)
- Route:
/single/:id
- Description: Shows detailed information about a single product based on its ID.
- Route:
/cart
- Description: Shows detailed information about the products added in the cart for each user.(This is only for users, not for sellers.)
- Route:
/mens
- Description: Shows detailed information about products that are filtererd using the mens category.
- Route:
/womens
- Description: Shows detailed information about products that are filtererd using the womens category.
- Route:
/electronics
- Description: Shows detailed information about products that are filtererd using the electronics category.
- Route:
/newest
- Description: Shows detailed information about products that are recently addded. (latest 20).
Each Route has the following path
http://localhost:{port}/app/auth
- Route:
POST /register
- Description: Allows users to register with the application.
- Route:
POST /login
- Description: Handles user login and authentication.
- Route:
POST /getCurrentUser
- Description: Fetches the details of the currently logged-in user.
- Route:
POST /addCart
- Description: Adds a product to the user's shopping cart.
- Route:
POST /getCart
- Description: Retrieves the products in the user's shopping cart.
- Route:
POST /removeCart
- Description: Removes products from the user's shopping cart.
- Route:
GET /getProductJSON
- Description: Retrieves product data in JSON format.
- Route:
GET /getDefaultProducts
- Description: Fetches a list of default products available.
- Route:
POST /getSingleProduct
- Description: Retrieves details of a single product based on the request.
- Route:
POST /addProduct
- Description: Adds a new product to the seller's inventory.
- Route:
POST /getProduct
- Description: Retrieves product information from the seller's inventory.
- Route:
POST /updateProduct
- Description: Updates an existing product's information in the seller's inventory.
- Route:
POST /deleteProduct
- Description: Deletes a product from the seller's inventory.