├── server ├── .gitignore ├── config │ ├── keys.js │ ├── db.js │ ├── uploadFolderCreateScript.js │ └── function.js ├── .env ├── routes │ ├── braintree.js │ ├── auth.js │ ├── orders.js │ ├── users.js │ ├── customize.js │ ├── categories.js │ └── products.js ├── models │ ├── customize.js │ ├── categories.js │ ├── users.js │ ├── orders.js │ └── products.js ├── package.json ├── middleware │ └── auth.js ├── controller │ ├── braintree.js │ ├── customize.js │ ├── orders.js │ ├── categories.js │ ├── users.js │ └── auth.js └── app.js ├── client ├── src │ ├── components │ │ ├── shop │ │ │ ├── wishlist │ │ │ │ ├── Mixins.js │ │ │ │ ├── index.js │ │ │ │ ├── FetchApi.js │ │ │ │ └── SingleWishProduct.js │ │ │ ├── partials │ │ │ │ ├── index.js │ │ │ │ ├── Action.js │ │ │ │ ├── style.css │ │ │ │ ├── Footer.js │ │ │ │ ├── FetchApi.js │ │ │ │ └── Mixins.js │ │ │ ├── dashboardUser │ │ │ │ ├── index.js │ │ │ │ ├── DashboardUserContext.js │ │ │ │ ├── FetchApi.js │ │ │ │ ├── Layout.js │ │ │ │ ├── SearchFilter.js │ │ │ │ ├── Sidebar.js │ │ │ │ ├── Action.js │ │ │ │ ├── UserProfile.js │ │ │ │ └── UserOrders.js │ │ │ ├── productDetails │ │ │ │ ├── Details.js │ │ │ │ ├── ProductDetailsContext.js │ │ │ │ ├── FetchApi.js │ │ │ │ ├── index.js │ │ │ │ ├── Submenu.js │ │ │ │ ├── Action.js │ │ │ │ ├── style.css │ │ │ │ ├── Mixins.js │ │ │ │ ├── ProductDetailsSectionTwo.js │ │ │ │ └── ReviewForm.js │ │ │ ├── order │ │ │ │ ├── CheckoutPage.js │ │ │ │ ├── FetchApi.js │ │ │ │ └── Action.js │ │ │ ├── home │ │ │ │ ├── style.css │ │ │ │ ├── index.js │ │ │ │ ├── Mixins.js │ │ │ │ ├── OrderSuccessMessage.js │ │ │ │ ├── HomeContext.js │ │ │ │ ├── Slider.js │ │ │ │ ├── ProductCategory.js │ │ │ │ ├── ProductByCategory.js │ │ │ │ └── SingleProduct.js │ │ │ ├── layout │ │ │ │ ├── index.js │ │ │ │ ├── PageNotFound.js │ │ │ │ └── layoutContext.js │ │ │ ├── auth │ │ │ │ ├── ProtectedRoute.js │ │ │ │ ├── AdminProtectedRoute.js │ │ │ │ ├── CartProtectedRoute.js │ │ │ │ ├── fetchApi.js │ │ │ │ ├── LoginSignup.js │ │ │ │ ├── Login.js │ │ │ │ └── Signup.js │ │ │ └── index.js │ │ ├── admin │ │ │ ├── index.js │ │ │ ├── partials │ │ │ │ ├── AdminFooter.js │ │ │ │ └── AdminSidebar.js │ │ │ ├── layout │ │ │ │ └── index.js │ │ │ ├── orders │ │ │ │ ├── FetchApi.js │ │ │ │ ├── index.js │ │ │ │ ├── SearchFilter.js │ │ │ │ ├── OrderContext.js │ │ │ │ ├── Actions.js │ │ │ │ ├── UpdateOrderModal.js │ │ │ │ └── OrderMenu.js │ │ │ ├── dashboardAdmin │ │ │ │ ├── DashboardContext.js │ │ │ │ ├── index.js │ │ │ │ ├── FetchApi.js │ │ │ │ ├── Action.js │ │ │ │ ├── TodaySell.js │ │ │ │ └── DashboardCard.js │ │ │ ├── categories │ │ │ │ ├── index.js │ │ │ │ ├── CategoryContext.js │ │ │ │ ├── CategoryMenu.js │ │ │ │ ├── FetchApi.js │ │ │ │ └── EditCategoryModal.js │ │ │ └── products │ │ │ │ ├── index.js │ │ │ │ ├── ProductMenu.js │ │ │ │ ├── ProductContext.js │ │ │ │ └── FetchApi.js │ │ └── index.js │ ├── index.js │ ├── App.js │ └── serviceWorker.js ├── .env ├── debug.log ├── .gitignore ├── public │ └── index.html ├── package.json └── README.md ├── .gitignore └── README.md /server/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | public -------------------------------------------------------------------------------- /client/src/components/shop/wishlist/Mixins.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /client/.env: -------------------------------------------------------------------------------- 1 | REACT_APP_API_URL=http://localhost:8000 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | uploads 3 | images 4 | package-lock.json 5 | img -------------------------------------------------------------------------------- /server/config/keys.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | JWT_SECRET: "SecretKey", 3 | }; 4 | -------------------------------------------------------------------------------- /client/src/components/shop/partials/index.js: -------------------------------------------------------------------------------- 1 | import Navber from "./Navber"; 2 | import Footer from "./Footer"; 3 | import CartModal from "./CartModal"; 4 | 5 | export { Navber, Footer, CartModal }; 6 | -------------------------------------------------------------------------------- /server/.env: -------------------------------------------------------------------------------- 1 | DATABASE=mongodb://localhost/ecommerce 2 | PORT=8000 3 | BRAINTREE_MERCHANT_ID=n74dc2kw9g3ws389 4 | BRAINTREE_PUBLIC_KEY=bgytmgzhz5f6t2tg 5 | BRAINTREE_PRIVATE_KEY=e6f226166da99d874f00008f0bba14fe -------------------------------------------------------------------------------- /client/src/components/shop/dashboardUser/index.js: -------------------------------------------------------------------------------- 1 | import UserProfile from "./UserProfile"; 2 | import UserOrders from "./UserOrders"; 3 | import SettingUser from "./SettingUser"; 4 | 5 | export { UserProfile, UserOrders, SettingUser }; 6 | -------------------------------------------------------------------------------- /client/src/components/shop/partials/Action.js: -------------------------------------------------------------------------------- 1 | export const logout = () => { 2 | localStorage.removeItem("jwt"); 3 | localStorage.removeItem("cart"); 4 | localStorage.removeItem("wishList"); 5 | window.location.href = "/"; 6 | }; 7 | -------------------------------------------------------------------------------- /client/src/components/shop/partials/style.css: -------------------------------------------------------------------------------- 1 | .userDropdown { 2 | display: none; 3 | } 4 | 5 | .userDropdownBtn:hover .userDropdown { 6 | display: block; 7 | display: flex; 8 | flex-direction: column; 9 | transition: all 1s; 10 | } 11 | -------------------------------------------------------------------------------- /client/src/components/admin/index.js: -------------------------------------------------------------------------------- 1 | import DashboardAdmin from "./dashboardAdmin"; 2 | import Categories from "./categories"; 3 | import Products from "./products"; 4 | import Orders from "./orders"; 5 | 6 | export { DashboardAdmin, Categories, Products, Orders }; 7 | -------------------------------------------------------------------------------- /client/src/components/shop/productDetails/Details.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import ProductDetailsSection from "./ProductDetailsSection"; 3 | 4 | const Details = (props) => { 5 | return ( 6 | 7 | 8 | 9 | ); 10 | }; 11 | 12 | export default Details; 13 | -------------------------------------------------------------------------------- /client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./App"; 4 | import * as serviceWorker from "./serviceWorker"; 5 | 6 | ReactDOM.render( 7 | 8 | 9 | , 10 | document.getElementById("root") 11 | ); 12 | 13 | serviceWorker.unregister(); 14 | -------------------------------------------------------------------------------- /server/routes/braintree.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const brainTreeController = require("../controller/braintree"); 4 | 5 | router.post("/braintree/get-token", brainTreeController.ganerateToken); 6 | router.post("/braintree/payment", brainTreeController.paymentProcess); 7 | 8 | module.exports = router; 9 | -------------------------------------------------------------------------------- /client/debug.log: -------------------------------------------------------------------------------- 1 | [1102/070315.777:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) 2 | [1102/210721.012:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) 3 | [1106/143808.324:ERROR:directory_reader_win.cc(43)] FindFirstFile: The system cannot find the path specified. (0x3) 4 | -------------------------------------------------------------------------------- /server/config/db.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | try { 3 | mongoose.connect("mongodb://localhost:27017/Ecommerce", { 4 | useNewUrlParser: true, 5 | useUnifiedTopology: true, 6 | useCreateIndex: true, 7 | }); 8 | console.log("Database Connected Successfully"); 9 | } catch (err) { 10 | console.log("Database Not Connected"); 11 | } 12 | -------------------------------------------------------------------------------- /client/src/components/shop/wishlist/index.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import Layout from "../layout"; 3 | import SingleWishProduct from "./SingleWishProduct"; 4 | 5 | const WishList = () => { 6 | return ( 7 | 8 | } /> 9 | 10 | ); 11 | }; 12 | 13 | export default WishList; 14 | -------------------------------------------------------------------------------- /client/src/components/shop/order/CheckoutPage.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import Layout from "../layout"; 3 | import { CheckoutComponent } from "./CheckoutProducts"; 4 | 5 | const CheckoutPage = (props) => { 6 | return ( 7 | 8 | } /> 9 | 10 | ); 11 | }; 12 | 13 | export default CheckoutPage; 14 | -------------------------------------------------------------------------------- /server/models/customize.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | 3 | const customizeSchema = new mongoose.Schema( 4 | { 5 | slideImage: { 6 | type: String, 7 | }, 8 | firstShow: { 9 | type: Number, 10 | default: 0, 11 | }, 12 | }, 13 | { timestamps: true } 14 | ); 15 | 16 | const customizeModel = mongoose.model("customizes", customizeSchema); 17 | module.exports = customizeModel; 18 | -------------------------------------------------------------------------------- /client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | debug.log 25 | -------------------------------------------------------------------------------- /client/src/components/shop/wishlist/FetchApi.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | const apiURL = process.env.REACT_APP_API_URL; 3 | 4 | export const wishListProducts = async () => { 5 | let productArray = JSON.parse(localStorage.getItem("wishList")); 6 | try { 7 | let res = await axios.post(`${apiURL}/api/product/wish-product`, { 8 | productArray, 9 | }); 10 | return res.data; 11 | } catch (error) { 12 | console.log(error); 13 | } 14 | }; 15 | -------------------------------------------------------------------------------- /server/routes/auth.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const authController = require("../controller/auth"); 4 | const { loginCheck, isAuth, isAdmin } = require("../middleware/auth"); 5 | 6 | router.post("/isadmin", authController.isAdmin); 7 | router.post("/signup", authController.postSignup); 8 | router.post("/signin", authController.postSignin); 9 | router.post("/user", loginCheck, isAuth, isAdmin, authController.allUser); 10 | 11 | module.exports = router; 12 | -------------------------------------------------------------------------------- /client/src/App.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment, useReducer } from "react"; 2 | import Routes from "./components"; 3 | import { LayoutContext, layoutState, layoutReducer } from "./components/shop"; 4 | 5 | function App() { 6 | const [data, dispatch] = useReducer(layoutReducer, layoutState); 7 | return ( 8 | 9 | 10 | 11 | 12 | 13 | ); 14 | } 15 | 16 | export default App; 17 | -------------------------------------------------------------------------------- /client/src/components/shop/partials/Footer.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import moment from "moment"; 3 | 4 | const Footer = (props) => { 5 | return ( 6 | 7 | 13 | 14 | ); 15 | }; 16 | 17 | export default Footer; 18 | -------------------------------------------------------------------------------- /client/src/components/admin/partials/AdminFooter.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment } from "react"; 2 | import moment from "moment"; 3 | 4 | const AdminFooter = (props) => { 5 | return ( 6 | 7 | 13 | 14 | ); 15 | }; 16 | 17 | export default AdminFooter; 18 | -------------------------------------------------------------------------------- /server/routes/orders.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const ordersController = require("../controller/orders"); 4 | 5 | router.get("/get-all-orders", ordersController.getAllOrders); 6 | router.post("/order-by-user", ordersController.getOrderByUser); 7 | 8 | router.post("/create-order", ordersController.postCreateOrder); 9 | router.post("/update-order", ordersController.postUpdateOrder); 10 | router.post("/delete-order", ordersController.postDeleteOrder); 11 | 12 | module.exports = router; 13 | -------------------------------------------------------------------------------- /server/routes/users.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | const usersController = require("../controller/users"); 4 | 5 | router.get("/all-user", usersController.getAllUser); 6 | router.post("/signle-user", usersController.getSingleUser); 7 | 8 | router.post("/add-user", usersController.postAddUser); 9 | router.post("/edit-user", usersController.postEditUser); 10 | router.post("/delete-user", usersController.getDeleteUser); 11 | 12 | router.post("/change-password", usersController.changePassword); 13 | 14 | module.exports = router; 15 | -------------------------------------------------------------------------------- /server/models/categories.js: -------------------------------------------------------------------------------- 1 | const mongoose = require("mongoose"); 2 | 3 | const categorySchema = new mongoose.Schema( 4 | { 5 | cName: { 6 | type: String, 7 | required: true, 8 | }, 9 | cDescription: { 10 | type: String, 11 | required: true, 12 | }, 13 | cImage: { 14 | type: String, 15 | }, 16 | cStatus: { 17 | type: String, 18 | required: true, 19 | }, 20 | }, 21 | { timestamps: true } 22 | ); 23 | 24 | const categoryModel = mongoose.model("categories", categorySchema); 25 | module.exports = categoryModel; 26 | -------------------------------------------------------------------------------- /client/src/components/shop/partials/FetchApi.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | const apiURL = process.env.REACT_APP_API_URL; 3 | 4 | export const cartListProduct = async () => { 5 | let carts = JSON.parse(localStorage.getItem("cart")); 6 | let productArray = []; 7 | if (carts) { 8 | for (const cart of carts) { 9 | productArray.push(cart.id); 10 | } 11 | } 12 | try { 13 | let res = await axios.post(`${apiURL}/api/product/cart-product`, { 14 | productArray, 15 | }); 16 | return res.data; 17 | } catch (error) { 18 | console.log(error); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /client/src/components/shop/home/style.css: -------------------------------------------------------------------------------- 1 | .slider { 2 | -webkit-appearance: none; 3 | height: 12px; 4 | border-radius: 5px; 5 | background: #d3d3d3; 6 | outline: none; 7 | -webkit-transition: 0.2s; 8 | transition: opacity 0.2s; 9 | } 10 | 11 | .slider::-webkit-slider-thumb { 12 | -webkit-appearance: none; 13 | appearance: none; 14 | width: 18px; 15 | height: 18px; 16 | border-radius: 75%; 17 | background: #b7791f; 18 | cursor: pointer; 19 | } 20 | 21 | .slider::-moz-range-thumb { 22 | width: 18px; 23 | height: 18px; 24 | border-radius: 75%; 25 | background: #b7791f; 26 | cursor: pointer; 27 | } 28 | -------------------------------------------------------------------------------- /client/src/components/shop/layout/index.js: -------------------------------------------------------------------------------- 1 | import React, { Fragment, createContext } from "react"; 2 | import { Navber, Footer, CartModal } from "../partials"; 3 | import LoginSignup from "../auth/LoginSignup"; 4 | 5 | export const LayoutContext = createContext(); 6 | 7 | const Layout = ({ children }) => { 8 | return ( 9 | 10 |
11 | 12 | 13 | 14 | {/* All Children pass from here */} 15 | {children} 16 |
17 |