Giter Club home page Giter Club logo

tomper-wear-ecommerce-backend's Introduction

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

๐Ÿ’พ Database schemas

Admin schema

Field Type Required Unique Default
name String True False -
email String True True -
password String True False -
privilege String False False low

Product schema

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()

Order schema

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 -

๐ŸŒ APIs

Products

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.

Orders

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

Admin

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

๐Ÿงพ Description

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.

โœจ Features

Client

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.

Admin

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 - - - - - - - - โœ” โœ” -

โš™ Tools and Technologies used

  1. React.js
  2. React-icons
  3. Styled-Components
  4. Firebase
  5. Stripe
  6. Formspree
  1. React.js
  2. Chakra-ui
  3. React-icons
  1. Node.js
  2. Express.js
  3. MongoDB
  4. JWT
  5. Cloudinary
  6. Bcrypt.js
  7. Stripe

๐Ÿ›  Installation and setup

  1. Clone the repo to your local machine.

  2. Install the required dependency for server using :

    npm install
  3. 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>
  4. Start the dev server using :

    npm start

๐Ÿค Test user credentials

Client

E-mail Password
[email protected] bob1212
[email protected] test1212

Admin

Username E-mail Password
Test Super [email protected] testsuper1212
Test Moderate [email protected] testmoderate1212
Test Low [email protected] testlow1212

๐Ÿ˜Ž Team Members

  1. Varun Kumar Tiwar - 2020IMT-112



(If you liked the project, give it star ๐Ÿ˜ƒ)

tomper-wear-ecommerce-backend's People

Contributors

varunkt001 avatar prxdevs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.