Skip to content

adv23/ecozon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Ecozon 🌍🌱

Transform Amazon shopping into climate action. Ecozon is a Chrome extension that instantly finds sustainable alternatives to the products you're viewing, showing you the environmental impact and making eco-friendly choices effortless.


🎯 Features

  • ✨ Smart Product Detection β€” Automatically identifies products on Amazon pages
  • 🎯 Eco-Scoring Algorithm β€” 20+ keyword analysis + brand recognition for accurate sustainability ratings (0-100)
  • πŸ“š Curated Alternatives β€” 36 verified eco-friendly products (soap, shampoo, detergent, conditioner, body wash, toothpaste)
  • πŸ”„ Carousel Navigation β€” Browse 3 top recommendations with seamless navigation
  • 🌐 Live Search β€” Backend searches for real eco-friendly product alternatives
  • ⏱️ Smart Fallback β€” If backend times out (5s), automatically uses curated dataset
  • ♻️ Carbon Reduction Estimates β€” See environmental impact per product (typically 20-60% reduction)
  • 🎨 Premium UI β€” Minimalist design using EB Garamond serif font, warm color palette

πŸš€ Quick Start (3 steps)

Step 1: Clone & Navigate

git clone https://github.com/adv23/ecozon.git
cd ecozon

Step 2: Load Extension into Chrome

  1. Open Chrome and go to chrome://extensions/
  2. Toggle "Developer mode" ON (top-right corner)
  3. Click "Load unpacked"
  4. Select the eco-swap-extension folder from your cloned repo
  5. You should see the Ecozon icon in your toolbar βœ…

Step 3: Test It

  1. Visit any Amazon product page:
    • Search "soap" and click a product
    • Or try: amazon.com/s?k=shampoo
  2. Click the Ecozon icon (🌍) in your toolbar
  3. πŸŽ‰ See 3 eco-friendly alternatives with scores and reasoning

That's it! Works immediately with the curated dataset.


πŸ—οΈ Architecture

Ecozon uses a hybrid search system:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        User clicks Ecozon on Amazon product page            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                    β”Œβ”€β”€β”€β”€v─────┐
                    β”‚ Extension β”‚
                    β”‚ tries β†’   β”‚
                    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
                         β”‚
         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
         β”‚               β”‚               β”‚
    β”Œβ”€β”€β”€β”€v────┐    β”Œβ”€β”€β”€β”€v────┐    β”Œβ”€β”€β”€β”€v────────┐
    β”‚ Backend  β”‚    β”‚ Timeout β”‚    β”‚   Fallback  β”‚
    β”‚ Search   β”‚    β”‚ (5 sec) β”‚    β”‚   Dataset   β”‚
    β”‚ (Live)   β”‚    β”‚         β”‚    β”‚  (Curated)  β”‚
    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                              β”‚
         β”‚         Success!             β”‚
         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚
             β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€v──────────┐
             β”‚ Show 3 alternatives β”‚
             β”‚ with eco-scores     β”‚
             β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Backend Features:

  • Node.js/Express server on localhost:3000
  • JSDOM-powered product search & parsing
  • Category-specific search queries
  • 5-second timeout for responsiveness
  • Returns top 3 products with author, price, link

Frontend Features:

  • Manifest V3 Chrome extension
  • 400+ lines of vanilla JavaScript
  • Zero external dependencies
  • Works 100% offline with curated data

πŸ“‹ Project Structure

ecozon/
β”œβ”€β”€ README.md (this file)
β”œβ”€β”€ LICENSE
β”‚
β”œβ”€β”€ eco-swap-extension/          # Chrome Extension
β”‚   β”œβ”€β”€ manifest.json            # Extension config
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ popup/
β”‚   β”‚   β”‚   β”œβ”€β”€ index.html       # Popup UI (320Γ—450px)
β”‚   β”‚   β”‚   β”œβ”€β”€ main.js          # All logic (scoring, rendering)
β”‚   β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”‚   └── index.js         # Detects Amazon products
β”‚   └── public/
β”‚       └── data/
β”‚           └── products.json    # 36 curated eco products
β”‚
└── backend/                     # Node.js Backend
    β”œβ”€β”€ README.md               # Backend setup guide
    β”œβ”€β”€ package.json
    β”œβ”€β”€ server.js               # Express server + /search endpoint
    └── node_modules/           # (created after npm install)

πŸ”§ Full Setup (with Backend for Live Search)

Option A: Minimal Setup (Backend not required)

Just follow "Quick Start" above. The extension works fully with the 36-product curated dataset.

Option B: Full Setup (Backend enabled)

Terminal 1: Start Backend Server

cd backend
npm install
npm start

Expected output:

🌍 Ecozon Backend running on http://localhost:3000
πŸ“ Try: http://localhost:3000/search?q=organic%20soap

Terminal 2: Load Extension (same as Quick Start)

# Extension auto-detects backend at localhost:3000
# No additional configuration needed!

Terminal 3 (Optional): Test Backend Manually

curl "http://localhost:3000/search?q=plastic+free+soap"

πŸ“– How to Use

On Amazon:

  1. Browse any product page (soap, shampoo, detergent, etc.)
  2. Click the Ecozon icon 🌍 in your toolbar
  3. Wait 1-2 seconds for recommendations
  4. See:
    • Current product info
    • Score badge (0-100)
    • Carbon reduction % (↓)
    • "Why It's Better" reasons
    • Price & source (πŸ”΄ Live / πŸ“š Curated)

Navigation:

  • "View on Amazon" β€” Opens the product on Amazon
  • "Next" β€” Browse to the next alternative
  • Hover effects β€” Smooth, premium interactions

🎯 Eco-Scoring Algorithm

Products are scored based on:

Positive Factors (+7 each, up to +42):

  • Keywords: plastic-free, biodegradable, organic, vegan, bar soap, zero waste, sustainable, natural, handmade, plant-based, etc. (20+ total)

Bonus (+15):

  • Recognized eco-brands: Dr. Bronner's, Burt's Bees, Seventh Generation, EarthHero, Hello, Attitude, etc.

Penalties (βˆ’8 each):

  • Keywords: disposable, single-use, plastic bottle, synthetic, microplastic, harmful

Base Score: 50 β†’ Floor: 0, Ceiling: 100


πŸ› οΈ Backend API (Optional)

GET /search?q=QUERY

curl "http://localhost:3000/search?q=organic+soap"

Response:

[
  {
    "title": "Dr. Bronner's Castile Bar Soap, Unscented Baby, 5 oz",
    "author": "Dr. Bronner's",
    "price": "$4.49",
    "link": "https://www.amazon.com/...",
    "image": "https://m.media-amazon.com/..."
  },
  ...
]

Features:

  • Category-aware search (detects soap β†’ searches "organic bar soap plastic-free")
  • Real-time product search (via JSDOM HTML parsing)
  • Timeout: 5 seconds (returns empty array if slower)
  • Top 3 results only

πŸ” Data Sources & Deployment

⚠️ For Production Deployment:

The backend's search capability is optimized for rapid prototyping and hackathon demonstration. For production applications, we recommend:

  • βœ… Amazon Product Advertising API (official, approved)
  • βœ… Affiliate APIs (CamelCamelCamel, Keepa, etc.)
  • βœ… Sustainable product databases (Built With, EarthHero API, etc.)

Good news: The extension works completely independently with the curated dataset (36 verified eco-friendly products) and requires no external data sources.


πŸ§ͺ Testing

Test the Curated Dataset

# No setup needed, just open Amazon and click the extension

Test Backend Search

# Terminal 1
cd backend && npm start

# Terminal 2
curl "http://localhost:3000/search?q=organic+shampoo"

# Should return 3 products or empty array if Amazon blocks

πŸ› Troubleshooting

Issue Solution
Extension icon not visible Reload Chrome or visit amazon.com in a new tab
"Finding eco-friendly..." never completes Backend not running (OK! Fallback will work)
Backend returns empty results Backend unavailable or timeout (5s) β€” fallback to curated data automatically
"No product found on this page" Not on an Amazon product page. Try: amazon.com/s?k=soap
Extension blocks on hover Hard refresh (Ctrl+Shift+R) and reload extension
"View on Amazon" returns 404 or broken link You're using the fallback dataset (backend not running). Start the backend for live, working links

πŸ“Š Example Results

Input: Amazon "Grisi Royal Jelly Soap" (generic plastic bottle) Output:

Current Product: Grisi Royal Jelly Soap β€” $8
                        ↓
Alternative: Crate 61 Organics Bar Soap (Vegan, Plastic-Free)
Score: 92/100 ✨
Carbon Reduction: 22% ↓
Why: βœ… Plastic-free packaging
     βœ… Vegan formulation  
     βœ… Concentrated bar = less waste
     βœ… Certified organic

πŸ† Technical Highlights

  • 0 External Dependencies (vanilla JS, no React/Vue)
  • Manifest V3 Compliant (Chrome's latest standard)
  • 400+ Lines of standalone JavaScript
  • Hybrid Architecture (live + fallback)
  • Premium UI (EB Garamond font, 12px rounded corners)
  • Accessibility (proper ARIA labels, keyboard navigation)
  • Performance (loads in <1s, 5s fallback timeout)

πŸ‘₯ Support

For issues:

  1. Check Troubleshooting above
  2. Check browser console (F12 β†’ Console) for errors
  3. Ensure backend is running (if testing live search)
  4. Try reloading the extension (Manage Extensions β†’ Reload)

πŸ“„ License

MIT License β€” See LICENSE file


πŸŽ‰ Credits

Built for the Hackathon with ❀️ and 🌱

Stack: Chrome Extension (Manifest V3) + Node.js + JSDOM + JSON


Happy shopping sustainably! πŸŒβ™»οΈ

Made with ♻️ for a more sustainable internet

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors