Hello and Welcome to my coding course to build a multi-vendor ecommerce website by MERN stack. In this course you will learn the essential tools and skills to design, develop and deploy a fully-function marketplace website using React and Redux in frontend and Node and MongoDB in backend..
This is a practical coding course and we are gonna learn and build lots of stuff in this multi-vendor ecommerce website like:
- create functional component by react
- use react hooks to handle form inputs
- manage application state by redux using custom hooks
- create backend web api by node and express js
- design database model by mongodb
- perform CRUP operations on orders, products and users by mongoose ORM
- handle authentication and authorization using JsonWebToken
- create seller and admin roles to manage products, orders and users
- handle shopping cart for customer to place orders
This course is for non-coders or juniors who want to be a professional web developer to get a job in 22 million job opportunities around the world. Basic knowledge of web developments like html, css and basic javascript is necessary for this course.
- What we will build
- HomeScreen
- Create react app
- Use bootstrap and react-bootstrap
- Product Screen
- Url routing in react
- handle events in react
- Cart Screen
- Save and retrieve data in local storage
- Working javascript array functions
- Update summary based on cart changes
- Sign-in and Register Screen
- Create dynamic form
- Input validation in frontend and backend
- Create web server using node.js
- Connect to Mongodb database
- Add registered user to the database
- Authenticate user based on email and password
- Using Jsonwebtoken to authorize users
- Shipping and Payment Screen
- Create wizard form to get user data in multiple steps
- Save user info in the local storage
- Place Order Screen
- Validate and create order in the database
- Order Screen
- Payment with paypal
- Show order state based on user and admin activities
- Profile Screen
- Create authenticated routes
- enable user to update their informations
- enable user to logout and clear local storage
- show list of orders to user and link it to details
- Seller Menu
- add products, upload files
- manage orders
- Admin Menu
- manage users
- HomeScreen
- Create React Bootstrap App
- create mern-marketplace folder
- npx create-react-app frontend
- npm start
- npm install react-bootstrap
- link bootstrap.css CDN to index.html
- create <>
- header
- create Navbar, LinkContainer, Navbar.Brand
- create Navbar.Toggle, Navbar.Collapse,
- Nav, Nav.Link Cart and Nav.Link Sign In
- main
- create Container and sample content
- footer
- create Container, Row, Col, copyright
- Update style.css to se min-height for main
- List Products
- create an array of products in products.js
- copy some images (680x830) in images folder in public folder
- create Product.js component
- show product name from props
- Use Product component in App.js by creating map() over products
- complete Product component to show the products
- Create Rating Component
- create components/Rating.js
- link to fontawesome.css in index.html
- create div.rating
- define Rating object with render()
- if !props.value return empty div
- else use fa fa-star, fa-star-half-o and fa-star-o
- last span for props.text || ''
- style div.rating, span and last span
- Edit Product component
- Use Rating component
- Product Details Screen
- Install react-router-dom react-router-bootstrap
- Use BrowserRouter and Route for Home Screen
- Create HomeScreen.js
- Add product list code there
- Create ProductScreen.js
- Add new Route from product details to App.js
- Create 3 columns for product image, info and action
- Create Node.JS Server
- run npm init in root folder
- npm install express
- create server.js
- add start command as node backend/server.js
- require express
- create route for / return backend is ready.
- move products.js from frontend to backend
- create route for /api/products
- return products
- run npm start
- Load Products From Backend
- edit HomeScreen.js
- define products, loading and error.
- create useEffect
- define async fetchData and call it
- install axios
- get data from /api/products
- show them in the list
- Install Babel And Nodemon
- npm install -D babel core, cli, node, preset-env
- Create .babelrc and set presets to @babel/preset-env
- npm install -D nodemon
- set start: nodemon --watch backend --exec babel-node backend/server.js
- convert require to import in server.js
- npm start
- Install ESlint For Code Linting
- npm install -D eslint
- install VSCode eslint extension
- Set VSCode setting for eslint
- Install prettier extension
- npm install -D eslint-config-prettier
- Add extends: "prettier"
- Add Redux to Home Screen
- npm install redux react-redux
- Create store.js
- initState= {products:[]}
- reducer = (state, action) => switch LOAD_PRODUCTS: {products: action.payload}
- export default createStore(reducer, initState)
- Edit HomeScreen.js
- shopName = useSelector(state=>state.products)
- const dispatch = useDispatch()
- useEffect(()=>dispatch({type: LOAD_PRODUCTS, payload: data})
- Add store to index.js
- Show Loading and Message Box
- Create Loading Component
- Create Message Box Component
- Use them in HomeScreen
- Add Redux to Product Screen
- create product details constants, actions and reducers
- add reducer to store.js
- use action in ProductScreen.js
- add /api/product/:id to backend api
- Handle Add To Cart Button
- Handle Add To Cart in ProductScreen.js
- create CartScreen.js
- Implement Add to Cart Action
- create addToCart constants, actions and reducers
- add reducer to store.js
- use action in CartScreen.js
- render cartItems.length
- Design Cart Screen 2. create 2 columns for cart items and cart action 3. cartItems.length === 0 ? cart is empty 4. show item image, name, qty and price 5. cart action 6. Subtotal 7. Proceed to Checkout button
- Implement Remove From Cart Action
- create removeFromCart constants, actions and reducers
- add reducer to store.js
- use action in CartScreen.js
- Switch From Babel To Native Node
- Update node
- Update package.json
- Add .js to imports
- Insert Sample Data in MongoDB
- npm install mongoose
- connect to mongodb
- create config.js
- npm install dotenv
- export MONGODB_URL
- create models/userModel.js
- create userSchema and userModel
- create models/productModel.js
- create productSchema and productModel
- create userRoute
- Seed sample data
- Create Sign-in Backend
- create API for /api/users/signin
- create isAuth middleware
- Design SignIn Screen
- create SigninScreen
- render email and password fields
- create signin constants, actions and reducers
- Update Header based on user login
- Implement SignIn Action
- create signin constants, actions and reducers
- add reducer to store.js
- use action in SigninScreen.js
- Create Register Backend and Design UI
- create API for /api/users/register
- insert new user to database
- return user info and token
- create RegisterScreen
- Add fields
- Style fields
- Add screen to App.js
- Implement Register Action
- create register constants, actions and reducers
- add reducer to store.js
- use action in RegisterScreen.js
- Create Profile Backend and Screen
- create profile update api in backend
- create isAuth in utils.js and use in update profile
- create ProfileScreen.js
- add form elements
- Implement Profile Action
- create user details constants, actions and reducers
- add reducer to store.js
- use action in ProfileScreen.js
- create update profile constants, actions and reducers
- add reducer to store.js
- use action in ProfileScreen.js
- Design Checkout Wizard Screen
- create CheckoutSteps.js
- create div elements for step 1 to 4
- handle redirect in signin and register
- create shipping screen
- Implement Checkout Wizard Action
- saveShippingAddress constant, reducer and actions
- copy shipping screen and as payment screen
- define getPayment and setPayment
- redirect user to PlaceOrder.js
- Create Place Order API
- createOrder api
- create orderModel
- create orderRouter
- create post order route
- Design PlaceOrder Screen
- create CartScreen.js
- Add checkout wizard
- Add shipping, payment and items preview
- Add Place Order button
- Implement PlaceOrder Action
- handle place order button click
- create place order constants, action and reducer
- Create Order Screen
- build order api for /api/orders/:id
- create OrderScreen.js
- dispatch order details action in useEffect
- load data with useSelector
- show data like place order screen
- create order details constant, action and reducer
- Add PayPal Button
- get client id from paypal
- set it in .env file
- create route form /api/paypal/clientId
- create getPaypalClientID in api.js
- add paypal checkout script in OrderScreen.js
- show paypal button
- Implement Order Payment
- update order after payment
- create payOrder in api.js
- create route for /:id/pay in orderRouter.js
- rerender after pay order
- Display Orders History
- create customer orders api
- create api for getMyOrders
- show orders in profile screen
- style orders
- List Users
- build api for list users
- Create UserList Screen
- create order details constant, action and reducer
- Delete Users
- build api for delete users
- create order details constant, action and reducer
- Use action in UserListScreen
- Edit User API and Screen
- build api for details and update users
- create edit screen UI
- Edit User Action
- define user details constant, action and reducer
- show user info in edit screen
- define user update constant, action and reducer
- update user info in edit screen
- Admin Products UI
- create ProductListScreen.js
- show products with edit and delete button
- show create product button
- Create Product
- create product model
- implement create product route
- create product function in api.js
- call create product function in ProductListScreen
- redirect to edit product
- Edit Product UI
- create ProductEditScreen.js
- load product data from backend
- handle form submit
- save product in backend
- Edit Product Backend
- handle form submit
- create updateProduct
- save product in backend
- Upload Product Image
- npm install multer
- create routes/uploadRoute.js
- import express and multer
- create disk storage with Date.now().jpg as filename
- set upload as multer({ storage })
- router.post('/', upload.single('image'))
- return req.file.path
- app.use('/api/uploads',uploadRoute) in server.js
- create uploads folder and put empty file.txt there.
- ProductEditScreen.js
- create file input and set id to image-file
- after_render() handle image-file change
- create form data
- call uploadProductImage()
- create uploadProductImage in api.js
- update server.js
- Build Project
- create build script for frontend
- create build script for backend
- update sever.js to serve frontend build folder and uploads folder
- stop running frontend
- npm run build
- check localhost:5000 for running website and showing images
- Delete Product
- update ProductListScreen.js
- handle delete button
- rerender after deletion
- Admin Orders
- create Admin Order menu in header
- create AdminOrder.js
- load orders from backend
- list them in the screen
- show delete and edit button
- redirect to order details on edit action
- Deliver Order
- if order is payed show deliver button for admin
- handle click on deliver button
- set state to delivered
- Show Summary Report in Dashboard
- create summary section
- style summary
- create summary backend
- create getSummary in api.js
- load data in dashboard screen
- show 3 boxes for Users, Orders and Sales
- Show Chart in Dashboard
- import chartist
- add chartist css to index.html
- create linear chart for daily sales
- create pie chart for product categories
- Publish heroku
- Create git repository
- Create heroku account
- install Heroku CLI
- heroku login
- heroku apps:create jsamazona
- Edit package.json for heroku-prebuild
- Edit package.json for heroku-postbuild
- Edit package.json for node engines
- Create Procfile
- Edit server.js for PORT
- Create mongodb atlas database
- create MongoDB Account
- open cloud.mongodb.com
- add new user and save username and password
- set Network Access to accept all requests
- Create new database
- create connection string based on db name and user and password
- Set Cloud MongoDB connection in heroku env variables
- Commit and push
- Product Search Bar
- create search bar in Header.js
- add style
- handle submit form
- edit parse url to get query string
- update product list api for search keyword
- Show Categories In Sidebar Menu
- create aside-open-button in Header.js
- add event to open aside
- create Aside.js component
- Add style aside
- after render close it on click on close button
- Use it in index.html
- Update index.js to render aside 9.
- call getCategories
- create getCategories in api.js