Skip to content

FatScythe/E-Commerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Ayรฉtรญ Adorn

Ayรฉtรญ Adorn

Description: E-commerce web application built with the MERN Stack, with 3 mode of payment using Flutterwave, Paystack or Stripe.


Link to the live website: Ayeti-Adorn


Frontend Design: Freestyled it : )

Homepage


โœจ Built With:

  1. React
  2. Redux Tool Kit
  3. Cloudinary
  4. NodeJS
  5. ExpressJS
  6. Git
  7. Github
  8. MongoDB
  9. JWT
  10. Bcrypt
  11. Express Rate limiter
  12. Express file Upload
  13. Nodemailer
  14. Render
  15. React-router
  16. Tailwind
  17. swr

๐Ÿ“š Getting Started

๐Ÿ› ๏ธ Installation

  1. Clone the project or download zip file
  2. Navigate to the project directory
    cd E-commerce
  3. Navigate to the respective client and server directory
    cd client
    cd server
  4. Install dependencies with npm install
  5. Use .env_sample to configure the .env
  6. Run npm start in the client directory and npm run dev in the server directory

NB: In client directory package.json, it's been proxied to localhost:5000, change depending on backend PORT number

Client Side

  1. Pages -19
  2. Icons - idk:(
  3. Components - >13

NB: Change domain for stripe return url in production and testing

Server Side / API

NB:

  1. "*" -- compulsory field
  2. "?" -- optional field
  3. Authorization roles - Admin, Seller, User

Authentication

Authentication is enabled in this app using JWT and cookies. Token is sent with each request, that requires authentication and it's verified on the server.

  1. Endpoint to register user
POST: {{DOMAIN}}/api/v1/auth/register
{
    "name" *: "your name",
    "email" *: "youremail@something.com",
    "password" *: "yourpassword"
}
  1. Endpoint to verify email
POST: {{DOMAIN}}/api/v1/auth/verify-email
{
   "verificationToken" *: "verification token sent with mail", 
   "email" *: "your email"
}
  1. Endpoint to login user
POST: {{DOMAIN}}/api/v1/auth/login
{
   "email" *: "your email",
   "password" *: "uour password",
}
  1. Endpoint to logout
GET:{{DOMAIN}} /api/v1/auth/logout
{}
  1. Endpoint for forgot password
POST: {{DOMAIN}}/api/v1/auth/forgot-password
{
   "email" *: "your email"
}
  1. Endpoint for reset password
POST: {{DOMAIN}}/api/v1/auth/reset-password
{
   "email" *: "your email"
}

Users

  1. Endpoint to get all user (Admin)
GET: {{DOMAIN}}/api/v1/user
{}
  1. Endpoint to get single user
GET: {{DOMAIN}}/api/v1/user/user-id
{}
  1. Endpoint to show current user
GET: {{DOMAIN}}/api/v1/users/show
{}
  1. Endpoint to update user information
PATCH: {{DOMAIN}}/api/v1/user/update
{
    "name" ?: "new name",
    "email" ?: "new email",
}
  1. Endpoint to update user password
PATCH: {{DOMAIN}}/api/v1/user/updatePwd
{
    "oldPassword" *: "yourpassword",
    "newPassword" *: "yournewpassword",
}
  1. Endpoint to update user profile picture
PATCH: {{DOMAIN}}/api/v1/user/updatePic
{
   
    "avatar" *: "new profile pic"
}
  1. Endpoint to block/unblock user (Admin)
PATCH: {{DOMAIN}}/api/v1/user/user-id
{}

Products

  1. Endpoint to get create product (Admin, Seller)
POST: {{DOMAIN}}/api/v1/products
{   
    "name" *: "Product Name",    
    "category" *: "kids/women/men/unisex",   
    "desc" *: "Description of product"
}
  1. Endpoint to get all products (Admin)
GET: {{DOMAIN}}/api/v1/products
{}
  1. Endpoint to get single product
// For users
GET: {{DOMAIN}}/api/v1/products/auth/product-id
{}
// For visitors
GET: {{DOMAIN}}/api/v1/products/product-id
{}
  1. Endpoint to delete product (Admin, Seller)
DELETE: {{DOMAIN}}/api/v1/products/product-id
{}
  1. Endpoint to update product (Admin, Seller)
PATCH: {{DOMAIN}}/api/v1/products/product-id
{
    "name" ?: "Product Name",    
    "category" ?: "kids/women/men/unisex",   
    "desc" ?: "Description of product"
}
  1. Endpoint to like/unlike product
PATCH: {{DOMAIN}}/api/v1/products/product-id
{}
  1. Endpoint to get current user products (Admin, Seller)
GET: {{DOMAIN}}/api/v1/products/my-products
{}

Stores

  1. Endpoint to create store
POST: {{DOMAIN}}/api/v1/store
{   
    "name" *: "Store Name",      
    "desc" *: "Description of store"
}
  1. Endpoint to get all stores
GET: {{DOMAIN}}/api/v1/store
{}
  1. Endpoint to get single store
GET: {{DOMAIN}}/api/v1/store/store-id
{}
  1. Endpoint to add get seller store (Admin, seller)
GET: {{DOMAIN}}/api/v1/store
{}
  1. Endpoint to update store (Admin, Seller)
PATCH: {{DOMAIN}}/api/v1/store/store-id
{
     "name" ?: "store new name", 
     "desc" ?: "store new description", 
     "insta" ?: "link to store instagram page", 
     "fb" ?: "link to store facebook page", 
     "tiktok" ?: "link to store tiktok page", 
     "open": "Boolean(true/ false)" 
}
  1. Endpoint to delete store (Admin, Seller)
DELETE: {{DOMAIN}}/api/v1/store/store-id
{}

Reviews

  1. Endpoint to get create review
POST: {{DOMAIN}}/api/v1/reviews
{ 
    "title" *: "Review title",
    "comment" *: "Review Comment",
    "rating" *: 5,(Number 1-5 )    
    "product" *: "product ID"
}
  1. Endpoint to get all reviews
GET: {{DOMAIN}}/api/v1/reviews
{}
  1. Endpoint to get single review
GET: {{DOMAIN}}/api/v1/reviews/review-id
{}
  1. Endpoint to update review
PATCH: {{DOMAIN}}/api/v1/reviews/review-id
{
    "title" ?: "New Review title",
    "comment" ?: "New Review Comment",
    "rating" ?: 1,(Number 1-5 )   
}
  1. Endpoint to delete review
DELETE: {{DOMAIN}}/api/v1/reviews/review-id
{}

Orders

  1. Endpoint to get all orders
GET: {{DOMAIN}}/api/v1/orders
{}
  1. Endpoint to single order
GET: {{DOMAIN}}/api/v1/orders/order-id
{}
  1. Endpoint to current user order history
GET: {{DOMAIN}}/api/v1/orders/showCurrentUserOrder
{}
  1. Endpoint to get current vendor sales (Admin, Seller)
GET: {{DOMAIN}}/api/v1/orders/showCurrentUserSales
{}
  1. Endpoint to create order
POST: {{DOMAIN}}/api/v1/orders
{
    "email" ?: "your name",
    "name" ?: "your email",
    "address" *: "your address",
    "city" *: "your city",
    "country" *: "your country",
    "cartItems" *: [
        {
            "product": "product ID","name": "Product 1", "amount": 2, "image": "/uploads/example.jpeg", "price":200 
        },
        {
            "product": "product ID","name": "Product 2", "amount": 1, "image": "/uploads/example.jpeg", "price": 400
        }
    ],
    "shippingFee": 20
},
  1. Endpoint to update order (Admin)
PATCH: {{DOMAIN}}/api/v1/orders/order-id
{
    "status" *: "paid" 
    ["pending", "failed", "paid", "delivered", "canceled"],
    "payStackAccessCode" ?: "paystack access code",
    "stripeClientSecret" ?: " stripe client secret",
    "flutterTrxId" ?: "flutter wave transaction id"
},

Payment

  1. Paystack
1. Accept Payment: 
POST: {{DOMAIN}}/api/v1/payment/paystack/acceptPayment
{
  "email" *: "youremail", 
  "amount" *: "amount to be paid in (Naira)", 
  "ref" ?: "unique reference id" 
},

2. Verify
GET: {{DOMAIN}}/api/v1/payment/paystack/reference-id
{},
  1. Stripe
1. Create Payment Intent: 
POST: {{DOMAIN}}/api/v1/payment/stripe/create-payment-intent
{
    "total" *: "cart total", 
    "shipping" ?: "shipping fee", 
    "id" *: "order ID"
},

2. Verify
GET: {{DOMAIN}}/api/v1/payment/stripe/verifyPayment/{{transaction-id}}/{{orderId}}
{},
  1. Flutterwave
1. Accept Payment: 
POST: {{DOMAIN}}/api/v1/payment/flutterwave/acceptPayment
{
  "name" *: "customers name",
  "email" *: "customers email", 
  "amount" *: "amount to be paid in (Naira)", 
  "ref" *: "unique reference id, usually order id" 
},

2. Verify Payment:
GET: {{DOMAIN}}/api/v1/payment/paystack/reference-id
{},

Future Feature

  1. Implemented dark mode on all pages
  2. Send email when payment is successful

About

An E-commerce web app made with the MERN stack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages