E-commerce web-application for selling clothing essentials
tomper-wear-server.onrender.com
This is the backend of TomperWear build with MERN stack and deployed with Render
🚀 Link to Client, Admin panel
🎥 Link to Video demo
Field | Type | Required | Unique | Default |
---|---|---|---|---|
name | String | True | False | - |
String | True | True | - | |
password | String | True | False | - |
privilege | String | False | False | low |
Field | Type | Required | Unique | Default |
---|---|---|---|---|
name | String | True | False | - |
description | String | True | False | - |
price | Number | True | False | - |
rating | Number | False | False | 0 |
images | Object.<{ public_id: String, url: String, }> |
True | False | - |
colors | Array.<{String}> | True | False | - |
sizes | Array.<{String}> | True | False | - |
company | String | True | False | - |
stock | Number | True | False | - |
numberOfReviews | Number | False | False | 0 |
reviews | Object.<{ name: String, email: String, rating: Number, comment: String }> |
False | False | - |
shipping | Boolean | False | False | True |
featured | Boolean | False | False | False |
admin | Schema.Admin | True | False | - |
createdAt | Date | False | False | Date.now() |
Field | Type | Required | Unique | Default |
---|---|---|---|---|
shippingInfo | Object.<{ address: String, city: String, state: String, country: String, pinCode: Number, phoneNumber: Number }> |
True | False | - |
orderItems | Object.<{ name: String, price: String, quantity: Number, image: String, color: String, size: String, product: Schema.Product }> |
True | False | - |
user | Object.<{ name: String, email: String }> |
True | False | - |
paymentInfo | Object.<{ id: String, status: String }> |
True | False | - |
paidAt | Date | True | False | - |
itemsPrice | Number | True | False | 0 |
shippingPrice | Number | True | False | 0 |
totalPrice | Number | True | False | 0 |
orderStatus | String | True | False | processing |
createdAt | Date | False | False | Date.now() |
deliveredAt | Date | False | False | - |
Method | Route | Parameters | Body | Description |
---|---|---|---|---|
GET | /api/products/ | - | - | Get list of all available products |
POST | /api/products/ | id | - | Get details of a single product |
POST | /api/admin/product/new | - | { name: String, price: Number, description: String, category: String, images: Array, colors: Array, sizes: Array, company: String, shipping: Boolean, featured: Boolean } |
Creates a new product |
PUT | /api/admin/product/ | id | { name: String, price: Number, description: String, category: String, images: Array, colors: Array, sizes: Array, company: String, shipping: Boolean, featured: Boolean } |
Update existing products detail |
DELETE | /api/admin/product/ | id | - | Deletes an existing product |
GET | /api/products/reviews/ | id | - | Get list of reviews of an existing product. |
POST | /api/products/reviews/ | - | { name: String, email: String, rating: Number, comment: String, productId: String, } |
- Creates a product review. - Updates and already existing review. |
DELETE | /api/admin/product/review/ | id | { reviewId: String } |
Delete a review for an existing product. |
Method | Route | Parameters | Body | Description |
---|---|---|---|---|
GET | /api/admin/order/ | - | - | Get all orders |
POST | /api/orders/ | - | { email: String } |
Get orders of a single user |
GET | /api/orders/ | id | - | Get a single order |
POST | /api/orders/new/ | - | { name: String, email: String, shippingInfo: Object, orderItems: Array., paymentInfo: Object, itemsPrice: Number, shippingPrice: Number, totalPrice: Number } |
Creates a new order |
PUT | /api/admin/order/ | id | { status: String } |
Update existing order's status |
DELETE | /api/admin/order/ | id | - | Delete an existing order |
Method | Route | Parameters | Body | Description |
---|---|---|---|---|
POST | /api/admin/register/ | - | { name: String, email: String, password: String, privilege: String } |
Creates a new admin user |
POST | /api/admin/login/ | - | { email: String, password: String } |
Login to admin dashboard |
GET | /api/admin/users/ | - | - | Get list of all admin users |
GET | /api/admin/users/ | id | - | Get single admin details |
PUT | /api/admin/users/ | id | { privilege: String } |
Update an admin user's privilege |
DELETE | /api/admin/users/ | id | - | Delete an existing admin user |
TomperWear is an E-commerce platform for small bussiness owners who want to expand their bussiness by providing an online purchase solution to their customers.
Users shopping through this platform enjoys following features:
- User authentication using google firebase.
- Secure payments via stripe.
- Users can change their username and display image.
- Users can filter products on various parameters.
- Users can sort products according to price and name.
- Users can add products to cart.
- Users can order products by providing their shipping information and card details for payments.
- Users can view their order's status and their previous orders.
- Users can review the products (or update their previous reviews) and benefit other customers.
- Users can send feedbacks to the owner.
- Responsive for all screen sizes.
The admin panel of TomperWear contains three classes of admins:
1. Super privileged admin Super privileged admins are the topmost in the hierarchy. They have the following permissions:
- Can view, create, update, and delete admin users.
- Can view, create, update, and delete products.
- Can view orders and update their status.
- Can delete orders.
This is privilege is ideal for the owner(s) of the bussiness.
2. Moderate privileged admin Moderate privileged admins comes below Super privileged admins. They have the following permissions:
- Can view, create, update, and delete admin users.
- Can view, create, update, and delete products.
- Can view orders and update their status.
- Can delete orders.
This is privilege is ideal for the manager(s).
3. Low privileged admin Low privileged admins are the lowermost in the hierarchy and have the least amount of privileges. The have the following permission:
- Can view, create, update, and delete admin users.
- Can view, create, update, and delete products.
- Can view orders and update their status.
- Can delete orders.
This is privilege is ideal for the delivery-agent(s).
Here is a table dipicting the admin privileges for better clarity
Admins | Product | Orders | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
view | create | update | delete | view | create | update | delete | view | update | delete | |
Super | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Moderate | - | - | - | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Low | - | - | - | - | - | - | - | - | ✔ | ✔ | - |
-
Clone the repo to your local machine.
-
Install the required dependency for server using :
npm install
-
Create a .env file inside the root folder and provide the following environment variables:
STRIPE_SECRET_KEY=<stripe_secret_key> DB_URI=<mongo_uri> JWT_SECRET=<your_jwt_secret> JWT_EXPIRE=5d COOKIE_EXPIRE=5 CLOUDINARY_CLOUD_NAME=<cloudinary_cloud_name> CLOUDINARY_API_KEY=<cloudinary_api_key> CLOUDINARY_API_SECRET=<cloudinary_api_secret>
-
Start the dev server using :
npm start
Password | |
---|---|
[email protected] | bob1212 |
[email protected] | test1212 |
Username | Password | |
---|---|---|
Test Super | [email protected] | testsuper1212 |
Test Moderate | [email protected] | testmoderate1212 |
Test Low | [email protected] | testlow1212 |
- Varun Kumar Tiwar - 2020IMT-112
(If you liked the project, give it star 😃)