This project is a multi-vendor e-commerce platform that allows users to register, browse and purchase products, and vendors to list their own items for sale. Payments are processed through the Zarinpal gateway, and users can leave reviews for products.
- User registration via OTP, stored in Redis and resendable after 1 minute.
- Registration details include
phone
,otp
,name
,email
,password
. - Password hashing with
bcrypt.js
and storage in the database. - Generation of
access token
andrefresh token
usingJWT
, with a 15-minute validity foraccess token
and a 30-day validity forrefresh token
. - Storing hashed
refresh token
in Redis usingbcrypt.js
. - The first user to register is considered the site owner, and subsequent users are assigned a regular role.
- OTP-based login and login through
passport
(local and Google). - Admin can ban users.
- Admin can change user roles.
- User data can be retrieved via
access token
. - Password reset via email link (using
nodemailer
). - User address management including add, edit, delete, and view addresses, with the ability to save geographical location from the map.
- Cities are displayed based on the selected province.
- Ability to create nested categories up to three levels (main category, subcategory, and subsubcategory).
- Ability to delete, edit, and view categories.
- Categories can be fetched in a hierarchical and related manner.
- Users can post comments on products.
- Comment replies are supported.
- Comments are displayed after admin approval.
- Users can view their own comments.
- Admin can view and delete any comments.
- Users can add notes to products.
- Notes remain until the product is deleted.
- Users can edit and delete their notes.
- All notes added by a user are visible in their user panel.
- Vendors can create products with image upload (
multer
). - Ability to define specific attributes for each product (e.g., color, size).
- Pagination for products, comments, notes, and orders to optimize performance.
- Product comments are displayed only when clicked by users for better performance.
- Ability to fetch products with various filters via
aggregate
. - Admin can edit, delete, and view products.
- Short links for products (using
nanoid
). - Products are assigned unique slugs using
slugify
.
- Vendor registration (after admin approval).
- Vendor product supply requests.
- Vendors can view and manage their store information.
- Admin can disable or delete a vendor's store.
- Admin can view, approve, or reject vendor requests, with pagination for performance improvement.
- Users can add products to the shopping cart.
- Users can view products in the cart along with the total price.
- Users can view purchases from multiple vendors in the shopping cart.
- Users can remove items from the cart.
- Payments via Zarinpal gateway (using
sandbox
for testing). - Product stock is checked before confirming the order.
- Users can view the order status (
Processing
,Shipped
,Delivered
). - Admin can change order status and register the tracking code.
- Node.js and Express.js as the main framework.
- MongoDB with Mongoose as the database.
- Redis for storing temporary data like OTP and
refresh token
. - bcrypt.js for hashing passwords and
refresh token
. - JWT for authentication management.
- Yup for input validation.
- Passport.js for Google login and token-based authentication.
- Nodemailer for sending confirmation emails and password reset links.
- Axios for OTP requests, payment, and verification.
- Multer for handling image uploads.
- Nanoid for creating short product links.
- Slugify for generating unique product slugs.
- UUID for generating password reset links.
- Swagger for API documentation.
- Install
Node.js
andMongoDB
. - Install
Redis
.
npm install
npm start
npm start
📄 API Documentation
Once the project is running, the API documentation will be available at http://localhost:3000/apis/v1/.