NeuraGreen is a full-stack web application that:
- Lets users input or scrape Amazon product data
- Uses Gemini AI to analyze the product's carbon footprint
- Recommends top 3 lower-carbon alternatives based on the analysis
| Component | Technology | Purpose |
|---|---|---|
| Frontend | React + Vite | Fast UI & SPA structure |
| Backend | Python + FastAPI | API layer for scraping & AI analysis |
| AI Model | Gemini API (Google) | Carbon footprint estimation |
| Scraper | BeautifulSoup/Selenium | Amazon product scraping |
| CSV Logging | Pandas | Save scraped product analysis |
git clone https://github.com/yourusername/NeuraGreen.git
cd NeuraGreencd server
python -m venv venv
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txtcd ../
npm installCreate a .env file in the root directory:
VITE_GEMINI_API_KEY="your_gemini_api_key" #π€ Gemini API Key β Get your key for Google AI (https://makersuite.google.com/app/apikey)
VITE_API_URL=http://localhost:8000
VITE_CLERK_PUBLISHABLE_KEY="your_clerk_api_key" #π Get your Clerk API keys at the [Clerk Dashboard](https://dashboard.clerk.dev)
β Go to your application β API Keys section
You can also configure backend environment variables (if needed) in server/.env.
npm run devcd server
uvicorn main:app --reloadNeuraGreen/
βββ public/
β βββ vite.svg
βββ src/
β βββ api/ # API services
β βββ assets/ # Static images/icons
β βββ components/ # UI Components
β βββ pages/ # Route Pages (Home, Results)
β βββ App.jsx
β βββ main.jsx
β βββ index.css
βββ server/
β βββ routers/
β β βββ analyze.py # API route for analysis
β βββ services/
β β βββ gemini.py # Gemini API integration
β β βββ scraper.py # Amazon scraping logic
β βββ main.py # FastAPI entry point
β βββ requirements.txt
βββ Output/
β βββ scraped_products.csv # CSV file with outputs
βββ .env
βββ index.html
βββ package.json
βββ vite.config.js
βββ README.md
def scrape_product_data(url: str) -> dict:
# Extracts title, price, and product attributes
soup = BeautifulSoup(requests.get(url).text, 'html.parser')
title = soup.find("span", {"id": "productTitle"}).text.strip()
return {"title": title}def analyze_product_footprint(title: str) -> str:
prompt = f"Estimate carbon footprint of {title}"
response = gemini.generate_content(prompt)
return response.textFrontend calls:
// src/api/productApi.js
export const analyzeProduct = async (title) => {
const response = await fetch("/api/analyze", {
method: "POST",
body: JSON.stringify({ title }),
});
return await response.json();
};MIT Β© [Tanishq Shinde]
Crafted with π± by Tanishq using React, FastAPI, and Gemini AI