A full-stack AI-powered platform that analyzes fashion brands for ethical practices, identifies greenwashing claims, and empowers consumers to make informed fashion choices.
Live brand analysis in seconds. AI-powered. No greenwashing.
BeWear provides instant ethical analysis of fashion brands using three methods:
- Text Search - Search by brand name (Nike, Zara, H&M, etc.)
- Image Upload - Upload a product photo and we'll identify the brand and analyze it
- Camera Capture - Snap a photo in-app of any fashion item
- Greenwashing Detection - Investigate if a brand is making false ethical claims
Input: "Nike"
Output:
{
"brand_name": "Nike",
"overall_score": 75.5,
"rating": "Good",
"labor_score": 70.0,
"environmental_score": 80.0,
"transparency_score": 76.0,
"supply_chain_score": 75.0,
"certifications": ["Fair Trade", "GOTS"],
"analysis": "Nike shows commitment to labor standards with documented policies for fair wages and worker safety. Their environmental efforts focus on sustainable materials and water reduction. However, transparency could be improved in supply chain disclosure..."
}- ⚡ Instant Analysis - Get ethical scores within 2-3 seconds
- 📸 Image Recognition - Identify brands from product photos using Google Lens
- 🤖 AI-Powered Insights - Claude AI explains ethical practices in natural language
- 🔍 Greenwashing Detection - Investigates false environmental claims with web search
- 📊 Comprehensive Scoring - Labor, environmental, transparency, and supply chain metrics
- 🎯 Autocomplete - Real-time brand search suggestions
- 📱 Mobile Responsive - Works on phones, tablets, and desktops
- 🚀 Real-time Updates - Live status streaming for long-running investigations
- Framework: FastAPI + Uvicorn (Python 3.11)
- Database: Elasticsearch 8.11.1+ (local or cloud)
- AI: Claude API (Anthropic) - Sonnet 3.5 for analysis, Haiku for quick tasks
- Search: Tavily API (greenwashing investigation)
- Vision: Google Lens via SerpAPI (image identification)
- Streaming: SSE (Server-Sent Events) for real-time updates
- Framework: Vanilla JavaScript (no build step)
- Styling: Tailwind CSS
- Icons: Font Awesome 6.5.1
- Features: Tab-based UI, drag-and-drop upload, camera streaming
- Containerization: Docker & Docker Compose
- Package Management: uv (Python)
- Environment: Python venv
- Docker and Docker Compose
- Python 3.11+
- API Keys:
ANTHROPIC_API_KEY- Get from Anthropic ConsoleTAVILY_API_KEY- Get from Tavily (for greenwashing detection)SERP_API_KEY(optional) - Get from SerpAPI for image analysisIMGBB_API_KEY(optional) - Get from ImgBB API for image hosting
# Clone the repository
git clone https://github.com/haribary/ethical-source.git
cd ethical-source
# Start Elasticsearch
docker-compose up -d
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
cd backend_fastAPI
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Ingest sample data
python ingest_data.py
# Start backend server
python main.py
# Server runs on http://localhost:8000Open frontend/index.html in your browser, or serve it:
cd frontend
python -m http.server 8080
# Open http://localhost:8080 in your browserPOST /analyze/text
Content-Type: application/json
{"brand_name": "nike"}Returns: Brand ethical analysis with scores, certifications, and AI insights
POST /analyze/image
Content-Type: multipart/form-data
file: <image file>Returns: Brand analysis + Google Lens identified products
GET /autocomplete?q=nik&limit=10Returns: Brand suggestions with ratings
POST /analyze/greenwashing
Content-Type: application/json
{"brand_name": "nike"}Streams real-time status updates, then returns:
- Greenwashing risk flag (LOW/MEDIUM/HIGH)
- Summary of findings
- Top articles with citations
- Relevance scores
GET /healthUser Input (Brand Name)
↓
Elasticsearch (Fuzzy Search)
↓
Brand Data Retrieved
↓
Claude AI (Analysis Generation)
↓
Formatted Response
↓
Frontend Display
User Upload (Image)
↓
Image Validation & Upload to ImgBB
↓
Google Lens (Product Identification)
↓
Claude Extracts Brand Name
↓
Elasticsearch Search
↓
Claude Analysis
↓
Response with Google Lens Results
Brand Name
↓
Stream Status: "Looking up brand..."
↓
Elasticsearch Lookup
↓
Stream Status: "Initializing AI agent..."
↓
LangGraph Agent Creates 3 Search Queries
↓
Stream Status: "Searching news sources..."
↓
Tavily Web Search (Top 10 Results)
↓
Stream Status: "Analyzing articles..."
↓
Claude Analyzes Each Article
↓
Stream Status: "Evaluating greenwashing risk..."
↓
Rank by Relevance + Flag (LOW/MEDIUM/HIGH)
↓
Stream Final Result
{
"name": "Nike",
"official_name": "Nike, Inc.",
"overall_score": 75.5,
"labor_rights_score": 70.0,
"environmental_impact_score": 80.0,
"transparency_score": 76.0,
"supply_chain_ethics_score": 75.0,
"rating_tier": "Good",
"certifications": ["Fair Trade", "GOTS"],
"metrics": [
{
"metric_id": "labor-001",
"metric_name": "Fair Wages",
"category": "labor_rights",
"score": 70.5,
"weight": 2.0,
"description": "Assessment of fair wages practices"
}
]
}ethical_src/
├── backend_fastAPI/
│ ├── main.py # FastAPI application (818 lines)
│ ├── greenwashing_agent.py # LangGraph-based agent (407 lines)
│ ├── ingest_data.py # Sample data ingestion
│ ├── requirements.txt # Python dependencies
│ ├── .env # Configuration (create from .env.example)
│ ├── start.sh # Quick start script
│ ├── README.md # Backend documentation
│ └── QUICK_START.md # Quick reference
│
├── frontend/
│ ├── index.html # Main UI
│ ├── app.js # JavaScript logic
│ └── package.json # Frontend metadata
│
├── docker-compose.yml # Elasticsearch setup
└── LICENSE # MIT License
cd backend_fastAPI
source venv/bin/activate
# Run with auto-reload
python main.py
# Run tests
python test_startup.py
# Example usage
python example_usage.pyNo build step needed. Just edit files and refresh browser:
index.html- UI structure and stylingapp.js- JavaScript logic and API calls
Edit backend_fastAPI/ingest_data.py and add brands to the sample data:
brands = [
{
"_id": "mybrand-001",
"name": "MyBrand",
"official_name": "MyBrand Inc.",
"overall_score": 85.0,
# ... other fields
}
]Then re-ingest:
python ingest_data.pyCreate .env in backend_fastAPI/:
# Required
ANTHROPIC_API_KEY=sk-ant-your-key
TAVILY_API_KEY=your-tavily-key
# Elasticsearch
ELASTICSEARCH_HOST=http://localhost:9200
ELASTICSEARCH_USER=elastic
ELASTICSEARCH_PASSWORD=password
# Optional (for image analysis)
SERP_API_KEY=your-serp-key
IMGBB_API_KEY=your-imgbb-keyUpdate CORS allowed origins in backend_fastAPI/main.py:
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000", "https://yourdomain.com"],
)- Text Analysis: ~2-3 seconds
- Image Analysis: ~8-10 seconds
- Greenwashing Investigation: ~15-20 seconds
- Cache popular brands with Redis
- Use Claude streaming for faster perceived latency
- Parallel process Google Lens + ImgBB uploads
- Preload top 100 brands in memory
- Restrict CORS to specific domains
- Implement rate limiting
- Add file size validation (e.g., 5MB max)
- Set up HTTPS
- Enable database authentication
- Add request logging/monitoring
- Configure error tracking (Sentry)
- Implement API key rotation
# Build
docker build -t bewear-backend backend_fastAPI/
# Run
docker run -p 8000:8000 \
-e ANTHROPIC_API_KEY=your-key \
-e ELASTICSEARCH_HOST=elasticsearch:9200 \
bewear-backend# Check Elasticsearch is running
curl http://localhost:9200
# Verify data is ingested
python backend_fastAPI/ingest_data.py
# Check index exists
curl http://localhost:9200/ethical_brands/_countImage analysis requires ImgBB:
- Get free key at https://api.imgbb.com/
- Add to
.env:IMGBB_API_KEY=your-key
- Verify
SERP_API_KEYin.env - Check SerpAPI account has credits
- Ensure image is in public format
cd backend_fastAPI
source venv/bin/activate
pip install -r requirements.txt{
"brand_name": "Nike",
"detection_method": "text_input",
"google_lens_titles": null,
"analysis": "Nike scores 75.5/100 on our ethical scale. Strengths: They have documented labor standards and are transitioning to sustainable materials. Weaknesses: Supply chain transparency needs improvement, and worker wages remain below living wage in some regions.",
"overall_score": 75.5,
"rating": "Good",
"labor_score": 70.0,
"environmental_score": 80.0,
"transparency_score": 76.0,
"supply_chain_score": 75.0,
"certifications": ["Fair Trade", "GOTS"],
"analyzed_at": "2025-01-15T10:30:00Z"
}{
"flagged": true,
"flag_level": "MEDIUM",
"summary": "Found evidence of selective environmental claims without full context on labor practices",
"total_articles_found": 23,
"articles": [
{
"title": "Brand's 'Eco-Friendly' Claims Draw Scrutiny",
"url": "https://example.com/article",
"published_date": "2024-12-15",
"greenwashing_type": "selective_transparency",
"evidence": "Claims 100% renewable materials but doesn't disclose water usage",
"why_matters": "Consumers misled about full environmental impact",
"relevance_score": 0.95
}
]
}Contributions welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Fixed JSON parsing in greenwashing agent
- Improved top 10 results consistency
- Added real-time status updates via Server-Sent Events
- Enhanced UI with live progress indicators
- Single Elasticsearch index for simplified architecture
See CHANGES_SUMMARY.md for details.
- Brand comparison endpoint
- Redis caching for popular brands
- Analytics dashboard
- User accounts and saved searches
- User reviews and ratings
- Alternative brand recommendations
- ML-based similar brand detection
- Sustainability predictions
- Real-time brand score updates
- Quick Start: See backend_fastAPI/QUICK_START.md
- Architecture: See backend_fastAPI/ARCHITECTURE.md
- Backend Docs: See backend_fastAPI/README.md
- Issues: Report bugs via GitHub Issues
- API Tests: See backend_fastAPI/example_usage.py
MIT License - see LICENSE file for details
Ethical ratings based on data from:
- Good On You: Independent ethical fashion ratings
- Tavily: Web search for greenwashing investigations
- Google Lens: Product identification
- Claude AI: Analysis and recommendations
Created by
Make ethical fashion choices. One brand at a time.
For questions, feedback, or partnership opportunities, open an issue or contact the maintainer.