Skip to content

esadakman/nextjs-amazon-clone

Repository files navigation

NextJS - Amazon Clone

Objective

  • Project aims to create a Airbnb clone with using NextJS.
  • This is a Next.js project bootstrapped with create-next-app.

Description

  • I prepared a small-scale project in order to understand the NextJS that I have learned recently.
  • I use next-auth for authentication, Fake Store API for product informations, stripe for payment process, firebase and firebase-admin for collecting order informations and TailwindCSS for styling.
  • I found the project from Youtube(Sonny Sangha). You can see the related video from here

Project Link

You can reach my project from here πŸ‘ˆ

Project Skeleton

nextjs-amazon-clone (folder)
|----readme.md
SOLUTION
β”œβ”€β”€ components
β”‚    β”œβ”€β”€ Banner.jsx
β”‚    β”œβ”€β”€ CheckoutProduct.jsx
β”‚    β”œβ”€β”€ Header.jsx
β”‚    β”œβ”€β”€ Order.jsx
β”‚    β”œβ”€β”€ Product.jsx
β”‚    └── ProductFeed.js
β”œβ”€β”€ pages
β”‚    β”œβ”€β”€ api
β”‚    β”‚    β”œβ”€β”€β”€ auth
β”‚    β”‚    β”‚      └── [...nextauth].js
β”‚    β”‚    β”œβ”€β”€β”€ create-checkout-session.js
β”‚    β”‚    └─── webhook.js
β”‚    β”œβ”€β”€ _app.js
β”‚    β”œβ”€β”€ _document.js
β”‚    β”œβ”€β”€ checkout.js
β”‚    β”œβ”€β”€ index.js
β”‚    β”œβ”€β”€ orders.js
β”‚    └── success.js
β”œβ”€β”€ public
β”‚    β”œβ”€β”€ amazon_logo.png
β”‚    β”œβ”€β”€ favicon.ico
β”‚    β”œβ”€β”€ logo.svg
β”‚    └── prime_banner.jpg
β”œβ”€β”€ slices
β”‚    └── basketSlice.js
β”œβ”€β”€ styles
β”‚    └── global.css
β”œβ”€β”€ .gitignore
β”œβ”€β”€ .env.local
β”œβ”€β”€ firebase.js
β”œβ”€β”€ next.config.js
β”œβ”€β”€ package.json
β”œβ”€β”€ postcss.config.js
β”œβ”€β”€ store.js
β”œβ”€β”€ stripe.exe
β”œβ”€β”€ tailwind.config.js
└── yarn.lock

At the end of the project, following topics are to be covered;

  • HTML
  • CSS
  • JavaScript
  • ReactJS
  • NextJS
  • TailwindCSS
  • redux-toolkit
  • next-auth
  • firebase
  • firebase-admin
  • momentjs
  • date-fns
  • responsive-carousel
  • react-currency-formatter
  • heroicons
  • bar-of-progress

To run this project;

  • URL's
    • Specify your NEXTAUTH_URL and HOST url in .env.local
  • Stripe Keys
    • # https://stripe.com/ and create new account.
    • Copy your STRIPE_PUBLIC_KEY and STRIPE_SECRET_KEY.
    • For STRIPE_SIGNING_SECRET from developers page, create webhook and copy your secret key
  • Firebase Keys:
    FIREBASE_API_KEY,
    FIREBASE_AUTH_DOMAIN,
    FIREBASE_DATABASE_URL
    FIREBASE_PROJECT_ID,
    FIREBASE_STORAGE_BUCKET,
    FIREBASE_MESSAGING_SENDER_ID,
    • Go to https://console.cloud.google.com/apis/credentials page and from OAuth 2.0 Client IDs add your projects links to Authorized JavaScript origins and Authorized redirect URIs
  • For Firebase admin
    • Go to your firebase/console and create new firebase database and generate your new private key, rename your file to firebasePermissions and move to your project file
  • And finally for webhook:
    • From https://stripe.com/docs/stripe-cli page download Stripe CLI and move to project folder.
    • Open new terminal for webhook, run stripe listen --forward-to localhost:3000/api/webhook and copy your signing secret from terminal and create your STRIPE_SIGNING_SECRET.

After these you can run the project as usual =>

$ git clone https://github.com/esadakman/nextjs-amazon-clone.git
$ cd ./nextjs-amazon-clone
$ npm install / yarn
$ npm run dev / yarn dev

Open http://localhost:3000 with your browser to see the result.

Preview of the Project

gif