1. Github Repo: https://github.com/basir/next-tailwind-amazona
  2. npx create-next-app next-tailwind-amazona
// syntax: npx create-next-app my-app
npm run dev
  1. i) https://tailwindcss.com/docs/guides/nextjs ii)
   npm install -D tailwindcss postcss autoprefixer
   npx tailwindcss init -p (it creates postcss.config.js, tailwind.config.js)

iii) add below lines in tailwind.config.js inside content

content: [
    "./pages/**/*.{js,ts,jsx,tsx}",
    "./components/**/*.{js,ts,jsx,tsx}",
  ],

v) add below lines in globals.css (at the top)

@tailwind base;
@tailwind components;
@tailwind utilities;
  1. Delete Home.module.css and remove the import for that from index.js
  2. remove main section from index.js file
  3. create components folder and create Layout.js file
  4. in eslintrc.json, make string to array and add the eslint:recommended
{
  "extends": ["eslint:recommended", "next/core-web-vitals"]
}
  1. List Products i) create utils folder and add data.js ii) add images iii) add ProductItem.js file in components folder

  2. Create a new folder under pages folder called product and create a new file called [slug].js

  3. npm i -D @types/react

  4. Create a new file Store.js under utils folder.

  5. Create a new file cart.js under pages folder

  6. npm i @heroicons/react

  7. npm i js-cookie (see in Store.js for usage of this)

  8. Create a new file under pages folder (login.js)

  9. npm i react-hook-form

  10. Create a new file under utils folder (db.js)

  11. npm i mongoose

  12. npm i bcryptjs

  13. Create a new file called seed.js under pages--->api folder

  14. Create a new folder called models on root folder and create a new file under that folder called User.js

  15. run your local and check this below URL endpoint in the browser after handler function is implemented in seed.js

http://localhost:3000/api/seed
  1. npm i next-auth (you can read the next.js auth documentation regarding this)

  2. create a new folder called auth and create a new file called [...nextauth].js

  3. Create a new file called error.js under utils folder

  4. npm i react-toastify

  5. npm i @headlessui/react

  6. Create a new file DropdownLink.js inside the components folder

  7. Create a new file under pages folder called shipping.js

  8. Create a new file under components folder called CheckoutWizard.js

  9. Create a new file under pages folder called unauthorized.js

  10. Create a new file under pages folder called payment.js

  11. Create a new file under models folder called Product.js

  12. Loading products from MongoDB instead of data.products in index.js file (Home Component)

  13. After writing the getServerSideProps logic we have to convertDocToObj for products id (this is handled in db.js)

  14. npm i axios

  15. Create a new folder inside pages --> api folder and name it as products

  16. Create a new file called [id].js inside the products folder which is created as per 38th point