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
- React
- Redux Tool Kit
- Cloudinary
- NodeJS
- ExpressJS
- Git
- Github
- MongoDB
- JWT
- Bcrypt
- Express Rate limiter
- Express file Upload
- Nodemailer
- Render
- React-router
- Tailwind
- swr
- Clone the project or download zip file
- Navigate to the project directory
cd E-commerce
- Navigate to the respective client and server directory
cd client
cd server
- Install dependencies with
npm install
- Use
.env_sample
to configure the.env
- Run
npm start
in the client directory andnpm 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
- Pages -19
- Icons - idk:(
- Components - >13
NB: Change domain for stripe return url in production and testing
- "*" -- compulsory field
- "?" -- optional field
- Authorization roles - Admin, Seller, User
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.
- Endpoint to register user
POST: {{DOMAIN}}/api/v1/auth/register
{
"name" *: "your name",
"email" *: "youremail@something.com",
"password" *: "yourpassword"
}
- Endpoint to verify email
POST: {{DOMAIN}}/api/v1/auth/verify-email
{
"verificationToken" *: "verification token sent with mail",
"email" *: "your email"
}
- Endpoint to login user
POST: {{DOMAIN}}/api/v1/auth/login
{
"email" *: "your email",
"password" *: "uour password",
}
- Endpoint to logout
GET:{{DOMAIN}} /api/v1/auth/logout
{}
- Endpoint for forgot password
POST: {{DOMAIN}}/api/v1/auth/forgot-password
{
"email" *: "your email"
}
- Endpoint for reset password
POST: {{DOMAIN}}/api/v1/auth/reset-password
{
"email" *: "your email"
}
- Endpoint to get all user (Admin)
GET: {{DOMAIN}}/api/v1/user
{}
- Endpoint to get single user
GET: {{DOMAIN}}/api/v1/user/user-id
{}
- Endpoint to show current user
GET: {{DOMAIN}}/api/v1/users/show
{}
- Endpoint to update user information
PATCH: {{DOMAIN}}/api/v1/user/update
{
"name" ?: "new name",
"email" ?: "new email",
}
- Endpoint to update user password
PATCH: {{DOMAIN}}/api/v1/user/updatePwd
{
"oldPassword" *: "yourpassword",
"newPassword" *: "yournewpassword",
}
- Endpoint to update user profile picture
PATCH: {{DOMAIN}}/api/v1/user/updatePic
{
"avatar" *: "new profile pic"
}
- Endpoint to block/unblock user (Admin)
PATCH: {{DOMAIN}}/api/v1/user/user-id
{}
- Endpoint to get create product (Admin, Seller)
POST: {{DOMAIN}}/api/v1/products
{
"name" *: "Product Name",
"category" *: "kids/women/men/unisex",
"desc" *: "Description of product"
}
- Endpoint to get all products (Admin)
GET: {{DOMAIN}}/api/v1/products
{}
- Endpoint to get single product
// For users
GET: {{DOMAIN}}/api/v1/products/auth/product-id
{}
// For visitors
GET: {{DOMAIN}}/api/v1/products/product-id
{}
- Endpoint to delete product (Admin, Seller)
DELETE: {{DOMAIN}}/api/v1/products/product-id
{}
- 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"
}
- Endpoint to like/unlike product
PATCH: {{DOMAIN}}/api/v1/products/product-id
{}
- Endpoint to get current user products (Admin, Seller)
GET: {{DOMAIN}}/api/v1/products/my-products
{}
- Endpoint to create store
POST: {{DOMAIN}}/api/v1/store
{
"name" *: "Store Name",
"desc" *: "Description of store"
}
- Endpoint to get all stores
GET: {{DOMAIN}}/api/v1/store
{}
- Endpoint to get single store
GET: {{DOMAIN}}/api/v1/store/store-id
{}
- Endpoint to add get seller store (Admin, seller)
GET: {{DOMAIN}}/api/v1/store
{}
- 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)"
}
- Endpoint to delete store (Admin, Seller)
DELETE: {{DOMAIN}}/api/v1/store/store-id
{}
- Endpoint to get create review
POST: {{DOMAIN}}/api/v1/reviews
{
"title" *: "Review title",
"comment" *: "Review Comment",
"rating" *: 5,(Number 1-5 )
"product" *: "product ID"
}
- Endpoint to get all reviews
GET: {{DOMAIN}}/api/v1/reviews
{}
- Endpoint to get single review
GET: {{DOMAIN}}/api/v1/reviews/review-id
{}
- Endpoint to update review
PATCH: {{DOMAIN}}/api/v1/reviews/review-id
{
"title" ?: "New Review title",
"comment" ?: "New Review Comment",
"rating" ?: 1,(Number 1-5 )
}
- Endpoint to delete review
DELETE: {{DOMAIN}}/api/v1/reviews/review-id
{}
- Endpoint to get all orders
GET: {{DOMAIN}}/api/v1/orders
{}
- Endpoint to single order
GET: {{DOMAIN}}/api/v1/orders/order-id
{}
- Endpoint to current user order history
GET: {{DOMAIN}}/api/v1/orders/showCurrentUserOrder
{}
- Endpoint to get current vendor sales (Admin, Seller)
GET: {{DOMAIN}}/api/v1/orders/showCurrentUserSales
{}
- 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
},
- 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"
},
- 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
{},
- 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}}
{},
- 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
{},
- Implemented dark mode on all pages
- Send email when payment is successful