πΏ EcoScan - Sustainable Fashion Scanner
HackNYU Fall 2025 Project - Sustainability Track
A mobile app that scans clothing tags and provides instant eco-impact scores using AI, helping consumers make sustainable fashion choices.
π― The Problem
The fashion industry is the second-largest polluter globally, responsible for 10% of global carbon emissions. Yet when shopping, consumers have no way to assess the environmental impact of their clothing. Tags show fabric and origin, but not sustainability data. We need transparency at the point of purchase.
π‘ Our Solution
EcoScan - Like Yuka for clothes. Scan any clothing tag with your phone camera and instantly get:
- Eco-Score (0-100, A-F grade) - Clear sustainability rating
- Material analysis - Carbon footprint, water usage, microplastics
- Origin impact - Labor conditions, transportation emissions
- AI-powered explanation - Gemini explains why this score
- 5 sustainable alternatives - Real products from real retailers with better scores
- Personalized picks - AI recommends products based on your scan history
- Progress tracking - Monitor your sustainability improvement over time
π Quick Start
1. Backend Setup (Python API Server)
cd analyze
pip install -r requirements.txt
# Configure API keys
cp .env.example .env
# Edit .env and add your API keys (GEMINI_API_KEY, LYKDAT_API_KEY)
# Start server
python api_server.py
Server runs on: http://localhost:8000 β’ API docs: http://localhost:8000/docs
π Detailed backend setup: See analyze/README.md
2. Frontend Setup (React Native Mobile App)
cd frontend
npm install
# Update API URL in src/services/api.ts if testing on physical device
# (Replace localhost with your computer's IP address)
npm start
Then press a for Android, i for iOS, or scan QR with Expo Go app!
π Detailed frontend setup: See frontend/README.md
ποΈ System Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MOBILE APP (React Native) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β π± Scanner β π Results β π History β β Picks β
β Two-stage β Eco-score β Scan stats β Personalized β
β camera β Alternatives β Progress β recommends β
ββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTPS POST (multipart/form-data)
β /api/scan: tag_image + clothing_image
β /api/picks: scan_history + reference_image
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β BACKEND API (Python FastAPI) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββ SCAN PIPELINE ββββββββββββββββββββ β
β β β β
β β CLOTHING IMAGE TAG IMAGE β β
β β β β β β
β β βΌ βΌ β β
β β βββββββββββ ββββββββββββ β β
β β β Lykdat β β Google β β β
β β β Deep β β Cloud β β β
β β β Tag API β β Vision β β β
β β β β β OCR β β β
β β ββββββ¬βββββ ββββββ¬ββββββ β β
β β β β β β
β β β (If Lykdat fails) β β β
β β β ββββββββββββββββ β β β
β β ββββ Fallback: β β β β
β β β Vision OCR + β β β β
β β β Gemini Parse β β β β
β β ββββββββ¬ββββββββ β β β
β β β β β β
β β βββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββββ β β
β β β Combined Deep Tag β β β
β β β Metadata β β β
β β β (Clothing + Tag OCR) β β β
β β ββββββββββββ¬ββββββββββββ β β
β β β β β
β β ββββββββββ΄βββββββββ β β
β β βΌ βΌ β β
β β βββββββββββββ βββββββββββββββββββ β β
β β β Eco-Score β β Lykdat Global β β β
β β βCalculator β β Search (Reverse β β β
β β β (0-100) β β Image Lookup) β β β
β β βββββββββββββ ββββββββββ¬βββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββ β β
β β β ~40 Similar β β β
β β β Products β β β
β β ββββββββ¬ββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββ β β
β β β Deep Tag Each β β β
β β β Product (~40x) β β β
β β ββββββββββ¬ββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββ β β
β β β Calculate Eco-Scoreβ β β
β β β For Each (~40x) β β β
β β ββββββββββ¬ββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββ β β
β β β Return Alternativesβ β β
β β β with Eco-Scores β β β
β β ββββββββββββββββββββββ β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β βββββββββββββββββββββββββ PICKS PIPELINE βββββββββββββββββββ β
β β β β
β β SCAN HISTORY (JSON) REFERENCE IMAGE β β
β β β β β β
β β βΌ β β β
β β βββββββββββββββ β β β
β β β Gemini β β β β
β β β Analysis β β β β
β β β - Common β β β β
β β β materialsβ β β β
β β β - Avg scoreβ β β β
β β β - Style β β β β
β β ββββββββ¬βββββββ β β β
β β β β β β
β β βΌ βΌ β β
β β ββββββββββββββββββββββββββββββββββ β β
β β β Select Best Representative β β β
β β β Scan from History β β β
β β ββββββββββββββ¬ββββββββββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββββ β β
β β β Lykdat Global Search β β β
β β β (Reference Image) β β β
β β ββββββββββββ¬ββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββββ β β
β β β Filter by User β β β
β β β Preferences: β β β
β β β - Material match β β β
β β β - Score >= avgΓ0.9 β β β
β β ββββββββββββ¬ββββββββββββ β β
β β β β β
β β βΌ β β
β β ββββββββββββββββββββββββ β β
β β β Return Top 10 Picks β β β
β β ββββββββββββββββββββββββ β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββΌβββββββ
β Supabase β
β PostgreSQL β
β Cloud Sync β
βββββββββββββββ
Algorithm Deep Dive
Scan Algorithm (POST /api/scan)
Inputs:
clothing_image- Photo of full clothing itemtag_image- Photo of clothing tag
Process:
Clothing Image β Lykdat Deep Tag API
- Primary: Lykdat analyzes clothing image
- Extracts: item type, colors, patterns, visible brands
- Returns: Structured JSON with visual metadata
- Fallback (if Lykdat fails):
- Google Cloud Vision OCR on clothing image
- Gemini 2.5-flash parses visual elements
- Generates equivalent structured metadata
Tag Image β Google Cloud Vision OCR
- Extracts text from clothing tag
- Captures: material composition, origin country, care instructions, brand
Combine Metadata
- Merge clothing deep tag (or fallback) + tag OCR
- Result: Complete product profile
json { "item_type": "t-shirt", "colors": ["blue", "white"], "material": "80% organic cotton, 20% recycled polyester", "origin": "Portugal", "brand": "Patagonia", "certifications": ["GOTS"] }
Generate Eco-Score
- Input: Combined deep tag metadata
- Calculate material impact (1-5 scale):
- Natural fibers (cotton, linen, hemp): 1-2
- Synthetics (polyester, nylon): 4-5
- Calculate origin impact (labor + transport)
- Apply certification bonuses
- Output: 0-100 score with A-F grade
Reverse Image Search
- Use combined metadata for Lykdat Global Search
- Query returns ~40 similar products from retailers
- Each product includes: title, brand, price, URL
Deep Tag Alternatives (~40x)
- For each of ~40 products:
- Fetch product page HTML
- Parse with Gemini for material/origin
- Calculate eco-score
- For each of ~40 products:
Return Alternatives
- Return all alternatives with eco-scores
- Frontend displays with direct product links
Output:
{
"ecoScore": 75,
"grade": "B",
"material": "80% organic cotton, 20% recycled polyester",
"origin": "Portugal",
"similarProducts": [
{
"title": "Similar Organic Tee",
"ecoScore": 85,
"url": "https://...",
"price": "32.00",
"currency": "USD"
},
// ... ~40 alternatives with eco-scores
]
}
Picks Algorithm (POST /api/picks)
Inputs:
scan_history- JSON array of user's past scansreference_image- Optional reference image from best scan
Process:
Gemini History Analysis
- Send full scan history to Gemini 2.5-flash
- Extract patterns:
json { "common_materials": ["organic cotton", "linen"], "average_eco_score": 72.5, "style_summary": "User prefers natural materials...", "preferred_countries": ["Portugal", "USA"] }
Select Best Representative Scan
- Score each scan from history:
- Material match with user's common materials: +30 points
- Above-average eco-score: +20 points
- Recency (recent scans): +10 points
- Pick highest-scoring scan as reference
- Score each scan from history:
Lykdat Global Search
- Use reference scan's image for similarity search
- Returns products matching visual style
- Processes ~15 candidates
Filter by User Preferences
- Keep products where:
- Material matches common_materials β +10 points
- Eco-score >= user's average Γ 0.9
- Not already in user's history
- Keep products where:
Rank & Return
- Sort by match score
- Return top 10 personalized picks
- Each with direct product URL
Output:
{
"picks": [
{
"title": "Hemp Blend T-Shirt",
"ecoScore": 88,
"material": "55% hemp, 45% organic cotton",
"url": "https://...",
"matchReason": "Matches your preference for natural fibers"
}
],
"analysis": {
"common_materials": ["organic cotton", "linen"],
"average_eco_score": 72.5
}
}
Tech Stack Details
Frontend
- React Native + Expo (iOS/Android from one codebase)
- TypeScript (type safety)
- React Navigation (tab + stack navigation)
- Axios (HTTP client)
- AsyncStorage β Supabase (local-first, cloud-synced storage)
- expo-camera + expo-image-picker (image capture)
Backend
- Python 3.10+ + FastAPI (async REST API)
- Uvicorn (ASGI server)
- Google Gemini 2.5-flash (AI parsing & analysis)
- Google Cloud Vision (OCR)
- Lykdat Fashion AI (image tagging & product search)
- Supabase (PostgreSQL cloud database)
ποΈ Project Structure
HackNYU/
βββ analyze/ # Backend API server
β βββ api_server.py # FastAPI app with endpoints
β βββ tagging.py # Lykdat + Google Vision integration
β βββ ecoscore.py # Eco-score calculation algorithm
β βββ similar_search.py # Product search & alternatives
β βββ base.py # Data models (ProductMetadata, EcoScore)
β βββ helper.py # Utility functions
β βββ requirements.txt # Python dependencies
β βββ README.md # Backend documentation
βββ frontend/ # React Native mobile app
β βββ src/
β β βββ screens/
β β β βββ HomeScreen.tsx # Landing page
β β β βββ ScannerScreen.tsx # Two-stage camera capture
β β β βββ ResultsScreen.tsx # Eco-score & alternatives
β β β βββ RecommendationsScreen.tsx # Personalized picks (AI-driven)
β β β βββ RecommendationDetailScreen.tsx # Pick details & alternatives
β β β βββ HistoryScreen.tsx # Scan history with stats
β β β βββ SearchScreen.tsx # Search scanned items
β β β βββ DatabaseScreen.tsx # Browse material database
β β β βββ AccountScreen.tsx # User profile
β β βββ services/
β β β βββ api.ts # Backend HTTP client
β β β βββ storage.ts # AsyncStorage + Supabase wrapper
β β β βββ supabase.ts # Supabase client config
β β βββ components/
β β β βββ SwipeableTab.tsx # Swipeable tab navigation
β β βββ navigation/
β β β βββ AppNavigator.tsx # Tab + Stack navigation setup
β β βββ types/
β β βββ index.ts # TypeScript interfaces
β βββ package.json # Node.js dependencies
β βββ README.md # Frontend documentation
βββ README.md # This file
β¨ Key Features
1. Two-Stage Scanning
- Capture clothing tag (for material/origin data)
- Capture full clothing item (for visual analysis)
- Real-time processing with loading states
2. AI-Powered Analysis
- Lykdat Deep Tagging: Identifies clothing type, colors, brands, labels
- Google Vision OCR: Extracts text from clothing tags
- Gemini Parsing: Structures data into JSON (material, origin, certifications)
- Eco-Score Algorithm: Calculates 0-100 score based on:
- Material impact (microplastics, biodegradability, carbon)
- Origin impact (labor conditions, transportation)
- Certifications (GOTS, Fair Trade, B-Corp)
3. Sustainable Alternatives
- For each scan, find 5 real sustainable products
- Ranked by eco-score and material matching
- Direct links to purchase from real retailers
- Clickable product cards with "View Product" buttons
4. Personalized Picks
- AI analyzes your entire scan history with Gemini
- Identifies your common materials and average eco-score
- Uses smart rotation through your best scans as reference images
- Recommends products matching your style but with better sustainability
- Only refreshes on new scans (not on navigation)
5. Progress Tracking
- Scan history with local + cloud storage
- Statistics: Total scans, average score, improvement trend
- Compare recent vs. older scans to see if you're getting more sustainable
- Offline access to all past scans
π How It Works - Deep Dive
Scanning Flow
1. πΈ Tag Capture β User photographs clothing tag
2. πΈ Clothing Capture β User photographs full item
3. β¬οΈ Upload β Both images sent via multipart/form-data to POST /api/scan
4. π Lykdat Deep Tagging β Analyzes clothing image
- Detects item type (shirt, pants, dress)
- Extracts colors, patterns, style
- Identifies visible brand labels
5. π Google Vision OCR β Extracts text from tag
- Material composition (e.g., "80% cotton, 20% polyester")
- Country of origin (e.g., "Made in Bangladesh")
- Care instructions, brand name
6. π€ Gemini Parsing β Structures raw data into JSON
{
"material": "80% organic cotton, 20% recycled polyester",
"origin": "Portugal",
"certifications": ["GOTS", "Fair Trade"],
"brand": "Patagonia"
}
7. π Eco-Score Calculation
- Material impact: 1-5 scale (lower = better)
* Natural fibers (cotton, linen, hemp): 1-2
* Synthetics (polyester, nylon): 4-5
- Origin impact: Labor conditions + transport distance
- Certifications: Boost score (GOTS, Fair Trade, B-Corp)
- Final score: 0-100 with A-F grade
8. π Similar Product Search β Lykdat finds alternatives
- Global search across fashion retailers
- Filters by material type and style
- Returns ~15 candidates
9. βοΈ Filter & Rank Alternatives
- Calculate eco-score for each product
- Prioritize: eco-score >= user's avg Γ 0.9
- Material matching gets bonus points
- Return top 5 with product links
10. πΎ Storage β Save to AsyncStorage + Supabase
- Local-first (works offline)
- Cloud sync for cross-device access
11. π± Display Results
- Show eco-score with color-coded badge
- AI-generated explanation
- Improvement tips
- 5 clickable sustainable alternatives
Personalized Picks Flow
1. π Check Scan Count β Need 3+ scans minimum
2. π Load History β Get last 20 scans from Supabase/local
3. π€ Gemini Analysis β Analyze full history
- Extract common materials user buys
- Calculate average eco-score
- Identify style preferences
4. π― Smart Reference Selection
- Filter high-scoring scans (β₯60)
- Use rotation algorithm: scanCount % highScoringCount
- Different reference image on each new scan = variety
5. π Lykdat Search β Find similar items to reference
6. βοΈ Filter by Preferences
- Must match common materials (+30 points)
- Must be >= user's avg score Γ 0.9
- Prioritize recent scans
7. π± Display Picks
- Show 10 personalized recommendations
- Each with "View Product" link
- Only refresh on new scans (tracked via persistent storage)
β Current Status - Fully Functional
Core Features: β All working with production AI APIs
Implemented & Working
- β Two-stage camera capture (tag + clothing)
- β Real-time AI processing (15-30 seconds per scan)
- β Lykdat fashion AI deep tagging
- β Google Cloud Vision OCR extraction
- β Gemini 2.5-flash AI parsing & analysis
- β Eco-score calculation (0-100, A-F grade)
- β Material & origin impact analysis
- β 5 sustainable alternatives per scan with real product links
- β Personalized picks based on scan history
- β Smart rotation algorithm for variety in recommendations
- β Scan history with cloud sync (Supabase)
- β Statistics dashboard (total scans, avg score, improvement trend)
- β Offline-first with AsyncStorage + cloud sync
- β Only refreshes picks on new scans (not on navigation)
- β Direct product links to retailers
Known Limitations
- β οΈ Lykdat API has rate limits (deep tagging quota)
- β οΈ Backend runs locally (not deployed to production)
- β οΈ Search screen uses mock data (Supabase catalog not fully populated)
Future Enhancements
- π Deploy backend to Railway/Render/AWS
- π Build global product catalog in Supabase
- π Add user authentication
- π Social features (share scans, compare with friends)
- π Carbon footprint calculator for wardrobe
- π Brand sustainability ratings database
π§ͺ Testing
- Start backend:
cd analyze && python api_server.py - Start frontend:
cd frontend && npm start - Open Scanner tab β capture tag image β capture clothing image
- Wait 15-30 seconds for processing
- View results with eco-score and alternatives
- Check History tab to see saved scans
Expected: Backend logs "β Scan complete! Score: XX/100", frontend displays results
π Required API Keys
Create analyze/.env:
GEMINI_API_KEY=your_key_from_makersuite
LYKDAT_API_KEY=your_key_from_lykdat
GOOGLE_APPLICATION_CREDENTIALS=path/to/service-account.json
Get keys:
- Gemini: https://makersuite.google.com/app/apikey
- Lykdat: Contact Lykdat for fashion API access
- Google Cloud: Create service account at https://console.cloud.google.com
β οΈ Security: Never commit .env or *.json credential files to git!
π Documentation
- Backend details:
analyze/README.md- API server, algorithms, configuration - Frontend details:
frontend/README.md- App architecture, screens, services
π€ Contributing
Built for HackNYU Fall 2025
π License
MIT
Built With
- expo.io
- fastapi
- gemini
- lykdat
- python
- react-native
- supabase
Log in or sign up for Devpost to join the conversation.