diff --git a/README.md b/README.md index ef52529..7b52d9a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Flipkart-MERN +# Flipkart - MERN Full-Stack Flipkart with Admin Dashboard & Paytm Payment Gateway. [Visit Now](https://flipkartwebs.herokuapp.com/) đ @@ -32,26 +32,48 @@ Full-Stack Flipkart with Admin Dashboard & Paytm Payment Gateway. **Mail Service:** [Sendgrid](https://sendgrid.com/) ## đ Features -- Login/Signup User Account -- Update Profile/Password User Account -- Reset Password Mail using Sendgrid -- Cart Add/Remove Items | Update Quantities -- Save For Later Add/Remove Items -- Wishlist Add/Remove Items -- Products Pagination (Default 12 Products Per Page) -- Product Search -- Product Filters Based on Category/Ratings | Price Range -- Shipping Info in Session Storage -- My Orders (With All Filters) -- Order Details of All Ordered Item -- Users will receive mail when order placed with all details -- Review Products User Account -- Admin: Dashboard access to only admin roles -- Admin: Update Order Status | Delete Order -- Admin: Add/Update Products -- Admin: Update User Data | Delete User -- Admin: List Review of Product | Delete Review -- Stock Management: Decrease stock of product when shipped + +**User Account Management** +- Login/Signup: đĒ Users can create an account or log in to an existing one. +- Update Profile/Password: đ Users can update their profile information and change their passwords. + +**Password Management** +- Reset Password Mail: đ§ Utilizing Sendgrid, users can reset their passwords via email. + +**Shopping Cart** +- Add/Remove Items: đ Users can add items to their shopping cart or remove them as needed. +- Update Quantities: đĸ Quantities of items in the cart can be adjusted. + +**Saved Items** +- Save For Later: đž Users can move items from the cart to a "Saved For Later" list or remove them from it. + +**Wishlist** +- Add/Remove Items: â¤ī¸ Users can add items to their wishlist or remove them from it. + +**Product Browsing** +- Pagination: đ Products are paginated, with 12 products displayed per page by default. +- Search: đ Users can search for products. +- Filters: đī¸ Products can be filtered based on categories, ratings, and price range. + +**Checkout Process** +- Shipping Info: đ Shipping information is stored in session storage for ease of checkout. +- Payment Options: đŗ Users can pay through Paytm payment gateway for checkout. + +**Order Management** +- My Orders: đĻ Users can view their order history with various filters. +- Order Details: âšī¸ Details of all ordered items are accessible. +- Order Confirmation: âī¸ Users receive email notifications with comprehensive order details upon placing an order. + +**Product Interaction** +- Review Products: đ Users can review products. + +**Admin Features** +- Dashboard: đĨī¸ Admins have access to a dedicated dashboard. +- Order Management: đ Admins can update order statuses and delete orders. +- Product Management: đ Admins can add/update products. +- User Management: đĨ Admins can update user data and delete users. +- Review Management: đ Admins can view and delete product reviews. +- Stock Management: đ Product stock is automatically decreased upon shipment. ## Sneak Peek of Admin Dashboard đ : ![Capture](https://user-images.githubusercontent.com/64949957/153995268-0cb769b9-e0ee-48ea-83c1-09b881df4101.PNG) @@ -71,9 +93,4 @@ Full-Stack Flipkart with Admin Dashboard & Paytm Payment Gateway. If you want to contact me, you can reach me through below handles. -[![linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jigar-sable) - -Š 2022 Jigar Sable - - -[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) +[![linkedin](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jigar-sablee) \ No newline at end of file diff --git a/backend/app.js b/backend/app.js index 6805a96..4e2820f 100644 --- a/backend/app.js +++ b/backend/app.js @@ -1,5 +1,4 @@ const express = require('express'); -const path = require('path'); const bodyParser = require('body-parser'); const cookieParser = require('cookie-parser'); const fileUpload = require('express-fileupload'); @@ -27,20 +26,6 @@ app.use('/api/v1', product); app.use('/api/v1', order); app.use('/api/v1', payment); -// deployment -__dirname = path.resolve(); -if (process.env.NODE_ENV === 'production') { - app.use(express.static(path.join(__dirname, '/frontend/build'))) - - app.get('*', (req, res) => { - res.sendFile(path.resolve(__dirname, 'frontend', 'build', 'index.html')) - }); -} else { - app.get('/', (req, res) => { - res.send('Server is Running! đ'); - }); -} - // error middleware app.use(errorMiddleware); diff --git a/frontend/.gitignore b/frontend/.gitignore index 4d29575..58b21fe 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -9,7 +9,7 @@ /coverage # production -/build +# /build # misc .DS_Store diff --git a/frontend/build/asset-manifest.json b/frontend/build/asset-manifest.json new file mode 100644 index 0000000..eab721e --- /dev/null +++ b/frontend/build/asset-manifest.json @@ -0,0 +1,35 @@ +{ + "files": { + "main.css": "/static/css/main.3c4514cf.css", + "main.js": "/static/js/main.137212d1.js", + "static/media/payment-methods.svg": "/static/media/payment-methods.69e7ec34d1302e6b58b2cb1abe6b2f9c.svg", + "static/media/404-not-found.svg": "/static/media/404-not-found.f58b723c5e420e43683574327be5529a.svg", + "static/media/furniture.png": "/static/media/furniture.c167da994e4cf873c7f5.png", + "static/media/kitchen-sale.jpg": "/static/media/kitchen-sale.058c7dbd12f5f0a0be9e.jpg", + "static/media/fashionsale.jpg": "/static/media/fashionsale.3071fadf18ef75cdee1c.jpg", + "static/media/success.png": "/static/media/success.a6e71fb67ec0538ff2ee.png", + "static/media/failed.png": "/static/media/failed.25f9a5080785b1e6642c.png", + "static/media/gadget-sale.jpg": "/static/media/gadget-sale.ec893927252d46afc4d9.jpg", + "static/media/appliances.png": "/static/media/appliances.968e046c13701f2e1260.png", + "static/media/fashion.png": "/static/media/fashion.280fd2c8f7637aca622b.png", + "static/media/poco-m4-pro.webp": "/static/media/poco-m4-pro.48599deb73643813688f.webp", + "static/media/grocery.png": "/static/media/grocery.b684d799acd0d0375626.png", + "static/media/home.png": "/static/media/home.eb7132924aab6919441b.png", + "static/media/beauty.png": "/static/media/beauty.7d66ddbcf545e947bd6b.png", + "static/media/logo.png": "/static/media/logo.3b0baaaf50ed860dcc7a.png", + "static/media/electronics.png": "/static/media/electronics.c3245fc5e6c095785d94.png", + "static/media/realme-9-pro.webp": "/static/media/realme-9-pro.5a99ab97f9f4b611aadc.webp", + "static/media/oppo-reno7.webp": "/static/media/oppo-reno7.dedadaebb21cf2bb2137.webp", + "static/media/phone.png": "/static/media/phone.6039d584e2ddf5e9355e.png", + "static/media/travel.png": "/static/media/travel.19839bf1002d4c52057f.png", + "static/media/slick.svg": "/static/media/slick.2630a3e3eab21c607e21.svg", + "static/media/slick.eot": "/static/media/slick.a4e97f5a2a64f0ab1323.eot", + "static/media/slick.ttf": "/static/media/slick.c94f7671dcc99dce43e2.ttf", + "static/media/slick.woff": "/static/media/slick.295183786cd8a1389865.woff", + "index.html": "/index.html" + }, + "entrypoints": [ + "static/css/main.3c4514cf.css", + "static/js/main.137212d1.js" + ] +} \ No newline at end of file diff --git a/frontend/build/favicon.ico b/frontend/build/favicon.ico new file mode 100644 index 0000000..3578b65 Binary files /dev/null and b/frontend/build/favicon.ico differ diff --git a/frontend/build/index.html b/frontend/build/index.html new file mode 100644 index 0000000..737eb05 --- /dev/null +++ b/frontend/build/index.html @@ -0,0 +1 @@ +
=n,children:(0,Ke.jsx)(pg,{icon:t>=n?a:l,children:t>=n?(0,Ke.jsxs)("div",{className:"flex flex-col",children:[(0,Ke.jsx)("span",{className:"text-primary-green font-medium",children:e.status}),"Invalid Date"!==e.dt&&(0,Ke.jsx)("span",{className:"text-primary-green font-medium",children:e.dt})]}):(0,Ke.jsx)("span",{className:"text-gray-400 font-medium",children:e.status})})},n)}))})},mg=function(){var t=Nt(),n=Sr().enqueueSnackbar,r=Me(),o=At((function(e){return e.orderDetails})),i=o.order,a=o.error,l=o.loading;return(0,e.useEffect)((function(){a&&(n(a,{variant:"error"}),t(pv())),t(dv(r.id))}),[t,a,r.id,n]),(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(ec,{title:"Order Details | Flipkart"}),(0,Ke.jsx)(Yd,{}),(0,Ke.jsx)("main",{className:"w-full mt-14 sm:mt-4",children:l?(0,Ke.jsx)(Kd,{}):(0,Ke.jsx)(Ke.Fragment,{children:i&&i.user&&i.shippingInfo&&(0,Ke.jsxs)("div",{className:"flex flex-col gap-4 max-w-6xl mx-auto",children:[(0,Ke.jsx)("div",{className:"flex bg-white shadow rounded-sm min-w-full",children:(0,Ke.jsx)("div",{className:"sm:w-1/2 border-r",children:(0,Ke.jsxs)("div",{className:"flex flex-col gap-3 my-8 mx-10",children:[(0,Ke.jsx)("h3",{className:"font-medium text-lg",children:"Delivery Address"}),(0,Ke.jsx)("h4",{className:"font-medium",children:i.user.name}),(0,Ke.jsx)("p",{className:"text-sm",children:"".concat(i.shippingInfo.address,", ").concat(i.shippingInfo.city,", ").concat(i.shippingInfo.state," - ").concat(i.shippingInfo.pincode)}),(0,Ke.jsxs)("div",{className:"flex gap-2 text-sm",children:[(0,Ke.jsx)("p",{className:"font-medium",children:"Email"}),(0,Ke.jsx)("p",{children:i.user.email})]}),(0,Ke.jsxs)("div",{className:"flex gap-2 text-sm",children:[(0,Ke.jsx)("p",{className:"font-medium",children:"Phone Number"}),(0,Ke.jsx)("p",{children:i.shippingInfo.phoneNo})]})]})})}),i.orderItems&&i.orderItems.map((function(e){var t=e._id,n=e.image,r=e.name,o=e.price,a=e.quantity;return(0,Ke.jsxs)("div",{className:"flex flex-col sm:flex-row min-w-full shadow rounded-sm bg-white px-2 py-5",children:[(0,Ke.jsxs)("div",{className:"flex flex-col sm:flex-row sm:w-1/2 gap-2",children:[(0,Ke.jsx)("div",{className:"w-full sm:w-32 h-20",children:(0,Ke.jsx)("img",{draggable:"false",className:"h-full w-full object-contain",src:n,alt:r})}),(0,Ke.jsxs)("div",{className:"flex flex-col gap-1 overflow-hidden",children:[(0,Ke.jsx)("p",{className:"text-sm",children:r.length>60?"".concat(r.substring(0,60),"..."):r}),(0,Ke.jsxs)("p",{className:"text-xs text-gray-600 mt-2",children:["Quantity: ",a]}),(0,Ke.jsxs)("p",{className:"text-xs text-gray-600",children:["Price: \u20b9",o.toLocaleString()]}),(0,Ke.jsxs)("span",{className:"font-medium",children:["Total: \u20b9",(a*o).toLocaleString()]})]})]}),(0,Ke.jsxs)("div",{className:"flex flex-col w-full sm:w-1/2",children:[(0,Ke.jsx)("h3",{className:"font-medium sm:text-center",children:"Order Status"}),(0,Ke.jsx)(hg,{orderOn:i.createdAt,shippedAt:i.shippedAt,deliveredAt:i.deliveredAt,activeStep:"Delivered"===i.orderStatus?2:"Shipped"===i.orderStatus?1:0})]})]},t)}))]})})})]})},vg=n(2314),gg=n(6300),bg=n(4882),yg=n(8063),xg=n(6984),wg=n(2854),kg=n(4303),Sg=n(1198),Cg=[{icon:(0,Ke.jsx)(vg.Z,{}),label:"Dashboard",ref:"/admin/dashboard"},{icon:(0,Ke.jsx)(it.Z,{}),label:"Orders",ref:"/admin/orders"},{icon:(0,Ke.jsx)(gg.Z,{}),label:"Products",ref:"/admin/products"},{icon:(0,Ke.jsx)(xg.Z,{}),label:"Add Product",ref:"/admin/new_product"},{icon:(0,Ke.jsx)(bg.Z,{}),label:"Users",ref:"/admin/users"},{icon:(0,Ke.jsx)(yg.Z,{}),label:"Reviews",ref:"/admin/reviews"},{icon:(0,Ke.jsx)(kg.Z,{}),label:"My Profile",ref:"/account"},{icon:(0,Ke.jsx)(wg.Z,{}),label:"Logout"}],Zg=function(e){var t=e.activeTab,n=e.setToggleSidebar,r=Nt(),o=Pe(),i=Sr().enqueueSnackbar,a=At((function(e){return e.user})).user,l=function(){r(bo()),i("Logout Successfully",{variant:"success"}),o("/login")};return(0,Ke.jsxs)("aside",{className:"sidebar z-10 sm:z-0 block min-h-screen fixed left-0 pb-14 max-h-screen w-3/4 sm:w-1/5 bg-gray-800 text-white overflow-x-hidden border-r",children:[(0,Ke.jsxs)("div",{className:"flex items-center gap-3 bg-gray-700 p-2 rounded-lg shadow-lg my-4 mx-3.5",children:[(0,Ke.jsx)(cc,{alt:"Avatar",src:a.avatar.url}),(0,Ke.jsxs)("div",{className:"flex flex-col gap-0",children:[(0,Ke.jsx)("span",{className:"font-medium text-lg",children:a.name}),(0,Ke.jsx)("span",{className:"text-gray-300 text-sm",children:a.email})]}),(0,Ke.jsx)("button",{onClick:function(){return n(!1)},className:"sm:hidden bg-gray-800 ml-auto rounded-full w-10 h-10 flex items-center justify-center",children:(0,Ke.jsx)(Sg.Z,{})})]}),(0,Ke.jsx)("div",{className:"flex flex-col w-full gap-0 my-8",children:Cg.map((function(e,n){var r=e.icon,o=e.label,i=e.ref;return(0,Ke.jsx)(Ke.Fragment,{children:"Logout"===o?(0,Ke.jsxs)("button",{onClick:l,className:"hover:bg-gray-700 flex gap-3 items-center py-3 px-4 font-medium",children:[(0,Ke.jsx)("span",{children:r}),(0,Ke.jsx)("span",{children:o})]}):(0,Ke.jsxs)(yt,{to:i,className:"".concat(t===n?"bg-gray-700":"hover:bg-gray-700"," flex gap-3 items-center py-3 px-4 font-medium"),children:[(0,Ke.jsx)("span",{children:r}),(0,Ke.jsx)("span",{children:o})]})})}))}),(0,Ke.jsxs)("div",{className:"flex flex-col gap-1 bg-gray-700 p-3 rounded-lg shadow-lg mb-6 mt-28 mx-3.5 overflow-hidden",children:[(0,Ke.jsx)("h5",{children:"Developed with \u2764\ufe0f by:"}),(0,Ke.jsxs)("div",{className:"flex flex-col gap-0",children:[(0,Ke.jsx)("a",{href:"https://www.linkedin.com/in/jigar-sable",target:"_blank",rel:"noreferrer",className:"font-medium text-lg hover:text-blue-500",children:"Jigar Sable"}),(0,Ke.jsx)("a",{href:"mailto:jigarsable21@gmail.com",className:"text-gray-300 text-sm hover:text-blue-500",children:"jigarsable21@gmail.com"})]})]})]})},Eg=n(1317),jg=function(t){var n=t.activeTab,r=t.children,o=(0,e.useState)(!1),a=(0,i.Z)(o,2),l=a[0],s=a[1],u=(0,e.useState)(!1),c=(0,i.Z)(u,2),d=c[0],f=c[1];return(0,e.useEffect)((function(){window.innerWidth<600&&s(!0)}),[]),(0,Ke.jsx)(Ke.Fragment,{children:(0,Ke.jsxs)("main",{className:"flex min-h-screen mt-14 sm:min-w-full",children:[!l&&(0,Ke.jsx)(Zg,{activeTab:n}),d&&(0,Ke.jsx)(Zg,{activeTab:n,setToggleSidebar:f}),(0,Ke.jsx)("div",{className:"w-full sm:w-4/5 sm:ml-72 min-h-screen",children:(0,Ke.jsxs)("div",{className:"flex flex-col gap-6 sm:m-8 p-2 pb-6 overflow-hidden",children:[(0,Ke.jsx)("button",{onClick:function(){return f(!0)},className:"sm:hidden bg-gray-700 w-10 h-10 rounded-full shadow text-white flex items-center justify-center",children:(0,Ke.jsx)(Eg.Z,{})}),r]})})]})})};function Rg(){return Rg="undefined"!==typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=b(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Rg.apply(this,arguments)}function Pg(){}var Mg=function(){var e=0;return function(){return e++}}();function _g(e){return null===e||"undefined"===typeof e}function Og(e){if(Array.isArray&&Array.isArray(e))return!0;var t=Object.prototype.toString.call(e);return"[object"===t.slice(0,7)&&"Array]"===t.slice(-6)}function Tg(e){return null!==e&&"[object Object]"===Object.prototype.toString.call(e)}var Ng=function(e){return("number"===typeof e||e instanceof Number)&&isFinite(+e)};function Ig(e,t){return Ng(e)?e:t}function Lg(e,t){return"undefined"===typeof e?t:e}var Dg=function(e,t){return"string"===typeof e&&e.endsWith("%")?parseFloat(e)/100*t:+e};function Ag(e,t,n){if(e&&"function"===typeof e.call)return e.apply(n,t)}function Fg(e,t,n,r){var o,i,a;if(Og(e))if(i=e.length,r)for(o=i-1;o>=0;o--)t.call(n,e[o],o);else for(o=0;os&&u 0&&e.stroke()}}function Iy(e,t,n){return n=n||.5,!t||e&&e.x>t.left-n&&e.x0){var s=l[0].datasetIndex,u=e.getDatasetMeta(s).data;l=[];for(var c=0;c=eb||xb(o,l,s),h=kb(i,u+f,c+f);return p&&h}},{key:"getCenterPoint",value:function(e){var t=this.getProps(["x","y","startAngle","endAngle","innerRadius","outerRadius","circumference"],e),n=t.x,r=t.y,o=t.startAngle,i=t.endAngle,a=t.innerRadius,l=t.outerRadius,s=this.options,u=s.offset,c=(o+i)/2,d=(a+l+s.spacing+u)/2;return{x:n+Math.cos(c)*d,y:r+Math.sin(c)*d}}},{key:"tooltipPosition",value:function(e){return this.getCenterPoint(e)}},{key:"draw",value:function(e){var t=this.options,n=this.circumference,r=(t.offset||0)/2,o=(t.spacing||0)/2,i=t.circular;if(this.pixelMargin="inner"===t.borderAlign?.33:0,this.fullCircles=n>eb?Math.floor(n/eb):0,!(0===n||this.innerRadius<0||this.outerRadius<0)){e.save();var a=0;if(r){a=r/2;var l=(this.startAngle+this.endAngle)/2;e.translate(Math.cos(l)*a,Math.sin(l)*a),this.circumference>=Jg&&(a=r)}e.fillStyle=t.backgroundColor,e.strokeStyle=t.borderColor;var s=function(e,t,n,r,o){var i=t.fullCircles,a=t.startAngle,l=t.circumference,s=t.endAngle;if(i){cS(e,t,n,r,a+eb,o);for(var u=0;u2&&void 0!==arguments[2]?arguments[2]:t;e.lineCap=Lg(n.borderCapStyle,t.borderCapStyle),e.setLineDash(Lg(n.borderDash,t.borderDash)),e.lineDashOffset=Lg(n.borderDashOffset,t.borderDashOffset),e.lineJoin=Lg(n.borderJoinStyle,t.borderJoinStyle),e.lineWidth=Lg(n.borderWidth,t.borderWidth),e.strokeStyle=Lg(n.borderColor,t.borderColor)}function hS(e,t,n){e.lineTo(n.x,n.y)}function mS(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=e.length,o=n.start,i=void 0===o?0:o,a=n.end,l=void 0===a?r-1:a,s=t.start,u=t.end,c=Math.max(i,s),d=Math.min(l,u),f=iu&&l>u;return{count:r,start:c,loop:t.loop,ilen:dt.r&&(l=(r.end-t.r)/i,e.r=Math.max(e.r,t.r+l)),o.start