Skip to content

Ecommerce pet project created with React.js, TypeScript, Sanity.io and GraphQL

License

Notifications You must be signed in to change notification settings

V-Mokhun/ecommerce-frontend

Repository files navigation

TechSphere

MIT License LinkedIn


Logo

TechSphere is a pet project that I created to learn new technologies and improve my skills. Specifically, I wanted to learn how to use Sanity.io as a headless CMS, how to use GraphQL with React, and refresh my knowledge of Redux Toolkit.
View Site · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contributing
  4. License
  5. Contact

About The Project

Home Screenshot

This project is a simple ecommerce website that allows users to browse products, add them to cart, and checkout. It is built with React.js and Sanity.io as a headless CMS. It uses GraphQL to query data from Sanity.io. It also uses Redux Toolkit for state management and Stripe for payments.

There is also a blog, which is built with Sanity.io and GraphQL. It allows users to read blog posts and admins to create, edit, and delete blog posts.

The website is fully responsive and works on all screen sizes.

(back to top)

Built With

  • React.js as a Frontend Framework

  • TypeScript For Type Safety

  • Sanity.io As a Headless CMS

  • Redux-Toolkit For State Management

  • GraphQL For API Queries

  • ReactHookForm For Form Handling

  • Zod For Form Validation

  • TailwindCSS With RadixUI For UI Components

(back to top)

Challenges

  • Sanity.io - I have never used Sanity.io before, so I had to learn how to use it as well as integrating headless CMS with React application. I also had to learn how to use GraphQL with Sanity as it has some specific syntax.
  • GraphQL - I have never used GraphQL before, so I had to learn how to use it with React. It wasn't too difficult as I already knew how API work. In the end, I decided to use Apollo Client and a GraphQL codegen plugin for generating types from GraphQL queries.

(back to top)

Getting Started

To get a local copy up and running follow these simple example steps.

Running the app

  1. Clone the repo
    git clone https://github.com/v-mokhun/ecommerce-frontend.git .
  2. Install NPM packages
    npm install
  3. Run the app (Will not work without environment variables)
    npm run dev

Environment Variables

  1. Create a .env file in the root of the project and copy all contents from .env.example file.
  2. Register an account on Sanity.io and create a new project. You can use the free plan. Then insert api url into VITE_API_URL variable.
  3. Register an account on Stripe.com and create a new project. You can use the free plan. Then insert public key into VITE_STRIPE_PUBLISHABLE_KEY variable.

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Telegram

LinkedIn

Project Link: https://ecommerce-frontend.up.railway.app

(back to top)