Skip to content

Huzaifa4412/hackaton-Next_js

Repository files navigation

Shop.co Marketplace

Introduction

NextShop Marketplace is a fully functional and responsive e-commerce website designed to provide a seamless online shopping experience. This project was developed during a 7-day hackathon and serves as a complete marketplace solution, featuring advanced functionalities like search, product management, and a dynamic checkout system. Built with Next.js and Sanity, the project showcases optimized performance and scalability.

This hackathon was my first experience working under a tight deadline to solve real-world problems. It taught me how to overcome technical challenges, debug complex issues, and implement efficient solutions.

Hackathon Giphy


Core Features

  • Responsive Design: Fully optimized for mobile, tablet, and desktop devices.
  • Data Fetching: Uses Sanity CMS to fetch and manage products, categories, and user data.
  • Page Transitions: I also add a seamless page transition effect to enhance the user experience.
  • Search Bar: Dynamic search bar with suggestions for faster navigation.
  • Search Functionality: I also add keyboard navigation support to the search bar which is good for user experience.
  • Product Management: Users can add, edit, and delete products with ease.
  • Product Details Page: Comprehensive details for each product, including images and descriptions.
  • All Products Page: Displays the complete product catalog with sorting and filtering options.
  • New Arrivals Section: Highlights the latest additions to the store.
  • Add-to-Cart Functionality: Users can add, update, and remove items from their cart.
  • Checkout Page: Collects user data and securely sends it to Sanity CMS.
  • Optimized Code: Efficient and clean codebase designed for scalability.
  • Storing Cart Data: Storing cart data on local Storage in a great user experience.
  • Customer and Order Data: When the user finishes the checkout process the customer data and order data came to Sanity CMS.

ScreenShots

Homepage

Homepage Screenshot

Product Details Page

Product Details Screenshot

Checkout Page

Checkout Screenshot


Website Performance

Lighthouse Metrics

  • Performance: 99/100
  • Accessibility: 96/100
  • SEO: 100/100
  • Best Practices: 100/100

Key Optimizations

  • Implemented lazy loading for images and components.
  • Optimized API requests to reduce response times.
  • Used static generation and server-side rendering (SSR) for better performance.

Performance

Lighthouse Performance

Practices

Lighthouse Practices

SEO

Lighthouse Seo

Accessibility

Lighthouse Accessibility

Performance Giphy

For Pdf Download

PDF Preview

Download the Full PDF Report


Sanity CMS Integration

Sanity Features

  • Product Management: Easy addition, deletion, and modification of products.
  • Dynamic Content: Fetch real-time updates directly from Sanity.

Sanity ScreenShots

Dashboard

Sanity Dashboard Screenshot

Vision

Sanity Data Screenshot

Sanity Giphy


Project Architecture

  • Pages Directory: Contains the main routes and components of the application.
  • Components Directory: Contains reusable components used throughout the application.
  • Utils Directory: Contains utility functions and helpers.
  • Styles Directory: Contains global styles and custom Tailwind CSS classes.
  • Context Directory: Manages global application state using Redux.
  • Sanity Directory: Contains Sanity API client and GROQ queries.
  • bun.config.js: Configuration file for Bun.

Structure Screenshot


Challenges Overcome

  • Sanity Data Fetching: Initially faced issues fetching data from Sanity and rendering it dynamically. Solved it by implementing efficient GROQ queries and leveraging Next.js dynamic routes.
  • Debugging Frontend Issues: Resolved issues related to state updates on the Product Details page.
  • Performance Optimization: Improved load times by optimizing API requests and implementing lazy loading for images.

Technologies Used

  • Next.js: Framework for building the frontend.
  • Sanity: Headless CMS for backend data management.
  • Redux: State management for global application state.
  • Tailwind CSS: Utility-first CSS framework for styling.
  • Bun: Fast JavaScript runtime and package manager.

Technology Giphy


User Flows

  1. Searching for Products: Users can search for products by typing keywords in the search bar.
  2. Adding to Cart: Products can be added to the cart with dynamic quantity adjustment.
  3. Checkout: Users fill out a form and submit data, which is securely stored in Sanity.

Future Enhancements

  • Adding smooth page transitions and animations.
  • Integrating a secure payment gateway (e.g., Stripe or PayPal).
  • Advanced product filters (e.g., by category, price range, ratings).
  • Live notifications for cart updates and new arrivals.

How to Run This Project Locally

  1. Clone the Repository:

    git clone <your-repository-url>
  2. Navigate to the Project Directory:

    cd <your-project-folder>
  3. Install Dependencies:

    bun install
  4. Run the Development Server:

    bun dev
  5. Configure Sanity CMS:

    • Initialize a Sanity project:
      sanity init
    • Update the Sanity API keys and dataset settings in the .env file.
  6. Open the application in your browser at:

    http://localhost:3000

API Documentation

  • GET /api/products: Fetch all products from Sanity.
  • POST /api/checkout: Submit checkout data to Sanity.

Lessons Learned

Participating in this hackathon was an incredible learning experience. I discovered how to:

  • Handle real-world problems under tight deadlines.
  • Debug complex issues and implement optimized solutions.
  • Build scalable and maintainable codebases.

Credits


Badges

GitHub Repo Stars License Next.js Sanity


Contributor Guidelines

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes with clear messages.
  4. Create a pull request and describe your changes.

Known Issues

  • No payment gateway integration yet.
  • Limited product filtering options.

License

This project is licensed under the MIT License.

Created And Maintained By

The project is created by Huzaifa Mukhtar and github it is Huzaifa4412 GIAIC roll number is : 499351

About

This is the Hackaton of governor it initiative where i create a responsive e-commerce website

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors