Life Cycle Assessment (LCA) web application for Amazon products. Analyzes environmental impact from cradle to grave using AI-powered material extraction and scientific emission factors.
- Backend: FastAPI (Python 3.11) — LLM-powered product parsing, LCA calculations, Redis caching, Supabase persistence
- Frontend: Next.js 15 (TypeScript/Tailwind) — Interactive Sankey diagram with What-If disposal scenarios
- LLM: Claude API (Anthropic) for structured material extraction
- Cache: Upstash Redis (cache-aside pattern, 24h TTL)
- Database: Supabase (PostgreSQL) for persistent analysis storage
- Python 3.11+ and Node.js 22+ (for local dev), or Docker
- API keys for: Anthropic, Upstash Redis, Supabase
- Create a project at supabase.com
- Run this SQL in the SQL Editor to create the
analysestable:
CREATE TABLE analyses (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
asin TEXT NOT NULL,
description TEXT,
result JSONB NOT NULL,
created_at TIMESTAMPTZ DEFAULT now()
);
CREATE INDEX idx_analyses_asin ON analyses (asin);- Copy your Project URL and anon key from Settings > API
- Create a database at upstash.com
- Copy the REST URL and REST Token from the database details
- Get an API key from console.anthropic.com
Copy the example env file and fill in your credentials:
cp backend/.env.example backend/.envEdit backend/.env:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-anon-key
UPSTASH_REDIS_URL=https://your-db.upstash.io
UPSTASH_REDIS_TOKEN=your-token
ANTHROPIC_API_KEY=sk-ant-...
RAINFOREST_API_KEY=your-anon-key
docker-compose up --build- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API docs: http://localhost:8000/docs
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run devAnalyzes a product and returns Sankey diagram data.
Parameters:
asin(path) — Amazon product identifierdescription(query, required) — Product description texteol_scenario(query, optional) —baseline,best_case, orworst_case
Response: JSON with nodes, links, summary, per_material_weights, material_details
Returns {"status": "ok"}.
Five lifecycle phases are assessed:
| Phase | Formula |
|---|---|
| Raw Material Extraction | sum(material_weight * emission_factor) |
| Manufacturing | total_weight * category_factor |
| Transportation | total_weight * 0.1 * 5 (5000km default) |
| Use Phase | total_weight * use_factor * 5 (5yr lifetime) |
| End of Life | sum(material_weight * blended_disposal_factor) |
Emission factors sourced from ecoinvent, EPA WARM, and peer-reviewed literature. 50 materials covered across plastics, metals, natural/organic, minerals, and paper categories.