Build ECommerce Website Like Amazon by Next.js
- Source Code : https://github.com/basir/next-amazona
- Demo Website : https://nextjs-amazona-final.vercel.app
- NextJS basics like setting up project, navigating between pages and data fetching
- NextJS advanced topics like dynamic routing, image optimization, SSG and SSR
- MaterialUI framework to build responsive website using custom theme, animation and carousel
- ReactJS including decomposing components, context API and hooks
- Next Connect package to build backend API
- MongoDB and Mongoose to save and retrieve data like products, orders and users
- PayPal developer api to make online payment
- Deploy web applications on servers like Vercel and Netlify
Learn building this ecommerce website on Udemy with 90% discount: https://www.udemy.com/course/nextjs-ecommerce
$ git clone https://github.com/basir/next-amazona
$ cd next-amazona
$ npm install
$ npm run dev
$ Open http://localhost:3000/api/seed
$ Open http://localhost:3000
- Introduction
- What you will learn
- What you will build
- What Packages you will use
- Install Tools
- VS Code
- Chrome
- Node.js
- MongoDB
- Create Next App
- npx create-next-app
- add layout component
- add header, main and footer
- Add Styles
- add css to header, main and footer
- Fix SSR Issue on MaterialUI
- add _documents.js
- add code to fix styling issue
- List Products
- add data.js
- add images
- render products
- Add header links
- Add cart and login link
- use next/link and mui/link
- add css classes for header links
- Route Product Details Page
- Make Product cards linkable
- Create /product/[slug] route
- find product based on slug
- Create Product Details Page
- Create 3 columns
- show image in first column
- show product info in second column
- show add to cart action on third column
- add styles
- Add MaterialUI Theme
- create theme
- use theme provider
- add h1 and h2 styles
- set theme colors
- Create Application Context
- define context and reducer
- set darkMode flag
- create store provider
- use it on layout
- Connect To MongoDB
- install mongodb
- install mongoose
- define connect and disconnect
- use it in the api
- Create Products API
- create product model
- seed sample data
- create /api/products/index.js
- create product api
- Fetch Products From API
- use getServerSideProps()
- get product from db
- return data as props
- use it in product screen too
- Implement Add to cart
- define cart in context
- dispatch add to cart action
- set click event handler for button
- Create Cart Screen
- create cart.js
- redirect to cart screen
- use context to get cart items
- list items in cart items
- Use Dynamic Import In Cart Screen
- Use next/dynamic
- Wrap cart in dynamic with out ssr
- Update Remove Items In Cart
- Implement onChange for Select
- Show notification by notistack
- implement delete button handler
- Create Login Page
- create form
- add email and password field
- add login button
- style form
- Create Sample Users
- create user model
- add sample user in seed api
- Build Login API 3. use jsonwebtoken to sign token 4. implement login api
- Complete Login Page
- handle form submission
- add userInfo to context
- save userInfo in cookies
- show user name in nav bar using menu
- Create Register Page
- create form
- implement backend api
- redirect user to redirect page
- Login and Register Form Validation
- install react-hook-form
- change input to controller
- use notistack to show errors
- Create Shipping Page 4. create form 5. add address fields 8. save address in context
- Create Payment Page
- create form
- add radio button
- save method in context
- Create Place Order Page
- display order info
- show order summary
- add place order button
- Implement Place Order Action
- create click handler
- send ajax request
- clear cart
- redirect to order screen
- create backend api
- Create Order Details Page
- create api to order info
- create payment, shipping and items
- create order summary
- Pay Order By PayPal
- install paypal button
- use it in order screen
- implement pay order api
- Display Orders History
- create orders api
- show orders in profile screenW