Skip to content

Did you know that online shopping generates over 4 billion tons of CO₂ emissions every year. Imagine shopping on Amazon, but with a built-in sustainability expert guiding your choices. The solution is Sustain-A-Buy

Notifications You must be signed in to change notification settings

faymo/SustainaBuy

Repository files navigation

Sustain-a-Buy Extension

Sustain-a-Buy is a Chrome extension designed for eco-conscious shoppers. It analyzes product pages (specifically Amazon) to provide sustainability insights, including estimated carbon emissions, a sustainability rating, and suggestions for more eco-friendly alternative products.

Devpost Link

Features

  • Product Analysis:
    Scrapes product details from Amazon, including title, material, and mass.

  • Sustainability Scoring:
    Uses the Google Generative AI (Gemini) to calculate a sustainability score (0-10) based on product mass and material, along with estimated CO₂ emissions.

  • Alternative Suggestions:
    Fetches sustainable alternatives for the viewed product with pricing, estimated carbon emissions, and direct product links.

  • User-Friendly UI:
    Displays real-time analysis with a loading animation during data fetching.

How It Works

  1. When visiting an Amazon product page, the extension scrapes the product data and sends it to a background script.
  2. The scraped data is sent to the frontend where:
    • The ProductAnalysis component displays the product name, sustainability rating, and additional insights.
    • The AlternativeSuggestions component shows alternative products with relevant details.
  3. The sustainability score is generated by calling getSustainabilityScore, which leverages a custom prompt via the Gemini API.
  4. Sustainable alternatives are fetched from Gemini using getSustainableAlternatives and then parsed to display valid product links and details.

Usage

  1. Navigate to an Amazon product page.
  2. Click the Sustain-a-Buy extension icon in Chrome.
  3. The extension will automatically scrape the product details and display: Product analysis with sustainability score and estimated CO₂ emissions. A list of sustainable alternatives with price, emissions, and a link to view each product.
  4. A loading animation is displayed while data is being fetched.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/sustaina-buy.git
  2. Open Visual Studio Code and load the project folder.

  3. Install dependencies (if any) using: npm install

  4. Follow the Chrome Extension packaging instructions to load the unpacked extension into Chrome.

  5. Make sure to run the command "node ./server.js" to run the express server for scraping.

About

Did you know that online shopping generates over 4 billion tons of CO₂ emissions every year. Imagine shopping on Amazon, but with a built-in sustainability expert guiding your choices. The solution is Sustain-A-Buy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •