/ecommerce-shop

Ecommerce shop built with Next.js and Sanity.io

Primary LanguageJavaScript

23 October 2022

E-commerce shop

By Josh Hortt

version: 23/10/2022

Description

This application is about an E-commerce Hardware store for small businesses
It was built for a local business client
It uses the portuguese language
It is Developed in React.js
This E-commerce application includes modern design and animations,the
ability to add and edit products on the go using a Sanity CMS, all advanced cart,
and checkout functionalities, and most importantly, the complete integration
with Stripe so that the user can cover real payments. It can be used for any kind of E-commerce store (Fashion, Jewellry, etc..).

E-commerce shop 🎧 πŸ”Š | Live Link

Technologies Used

  • JavaScript
  • React.js
  • Next.js
  • CSS-3
  • Sanity CMS

Learning Context:

No Context learn by doing this project...
1 Dynamic Routing
2 File Base Routing
3 Folder Structure
4 Layout Architecture
5 Global Vanilla CSS
6 Stripe for Payment Gateway
7 Data fetching from BackEnd
8 Connect Sanity BackEnd with Next-Js
9 Context API for globally data sharing...
10 Project data flow functional Architecture...
11 react-hot-toast for displaying notification
12 canvas-confetti firework animation for success sms
13 getStripe function call, in SingleTon Pattern style
14 Image change at hover state by the help of onMouseEnter attribute
15 getStaticPaths() ==> SSG ( statically pre-render all the paths )
16 getStaticProps() ==> SSG ( pre-render fetching data at build time )
17 getServerSideProps() ==> SSR ( fetching data at each user request )

npm --legacy-peer-deps 

run this short command for installing updated packages...
that listed inside dependencies { object } based on package.json file.

NPM | Dependencies...

No Package Installs Use for...
1 npm i @babel/core slider
2 npm i @sanity/cli managing Sanity installations, schemas & DB
3 npm i @sanity/client Client for read, create & update data from Sanity.io
4 npm i @sanity/image-url Tools to generate image urls from Sanity content
5 npm i @stripe/stripe-js Stripe.js loading utility
6 npm i stripe payment gateway
7 npm i react-icons icons at UI
8 npm i react-hot-toast short notification
9 npm i canvas-confetti performant confetti animation in the browser
10 npm i next-sanity-image Utility for using responsive image host in Sanity.io

File Structure...

🟨
    ecommerce-shop
    |
    β”œβ”€β”€ components
    |   β”œβ”€β”€ Cart.jsx
    |   β”œβ”€β”€ Footer.jsx
    |   β”œβ”€β”€ FooterBanner.jsx
    |   β”œβ”€β”€ HeroBanner.jsx
    |   β”œβ”€β”€ index.js
    |   β”œβ”€β”€ Layout.jsx
    |   β”œβ”€β”€ Navbar.jsx
    |   └── Product.jsx
    |
    β”œβ”€β”€ context
    |   └── StateContext.js     |🌐| Global Data Sharing |🌐|
    |
    β”œβ”€β”€ lib
    |   β”œβ”€β”€ client.js           |🟠| Sanity Connection Configuration  |🟠|
    |   β”œβ”€β”€ getStripe.js        |🟠| getStrip key- SingleTon Pattern  |🟠|
    |   └── utils.js            |🟠| Success animation after purchase |🟠|
    |
    β”œβ”€β”€ pages
    |   β”œβ”€β”€ api                 |🟨| BackEnd |🟨|
    |   |   └── stripe.js       |🟨| BackEnd |🟨|
    |   |
    |   β”œβ”€β”€product
    |   |  └── [slug].js
    |   |
    |   β”œβ”€β”€ _app.js
    |   β”œβ”€β”€ index.js
    |   └── success.jsx
    |
    β”œβ”€β”€ sanity_ecommerce        |πŸ”Ά| Headless CMS |πŸ”Ά|
    |   └── schemas             |πŸ”Ά| Headless CMS |πŸ”Ά|
    |       β”œβ”€β”€ banner.js       |πŸ”Ά| Headless CMS |πŸ”Ά|
    |       β”œβ”€β”€ product.js      |πŸ”Ά| Headless CMS |πŸ”Ά|
    |       └── schema.js       |πŸ”Ά| Headless CMS |πŸ”Ά|
    |
    └── styles
        └── globals.css
🟨

User Specifications

  • User searches for products which the user wants to purchase.
  • by clicking on the image the user is able to see the choosen product details.
  • User adds (adicionar) one or more products to the shopping cart.
  • User checks the shopping cart (carrinho de compras) to confirm if all products are showing up.
  • User can add (+) or remove (-) the quantity of choosen products.
  • User can see and confirm the total price of purchase inside the shopping cart.
  • User can pay with Stripe by clicking the Pay with stripe (Finalizar compra).

Setup/Installation Requirements

Clone repository in a shell using the command:
git clone https://github.com/Joshhortt/ecommerce-shop

Known Bugs

Due to time constraints the site may not scale perfectly on every device.

Support and contact details

If you have any questions or find any issues with this web-application, get in touch.
My email is: joshhortt@yahoo.com

License

MIT License Copyright (c) 2022 Josh Hortt

Project Demo