🌿 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 item
  • tag_image - Photo of clothing tag

Process:

  1. 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
  2. Tag Image β†’ Google Cloud Vision OCR

    • Extracts text from clothing tag
    • Captures: material composition, origin country, care instructions, brand
  3. 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"] }
  4. 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
  5. Reverse Image Search

    • Use combined metadata for Lykdat Global Search
    • Query returns ~40 similar products from retailers
    • Each product includes: title, brand, price, URL
  6. Deep Tag Alternatives (~40x)

    • For each of ~40 products:
      • Fetch product page HTML
      • Parse with Gemini for material/origin
      • Calculate eco-score
  7. 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 scans
  • reference_image - Optional reference image from best scan

Process:

  1. 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"] }
  2. 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
  3. Lykdat Global Search

    • Use reference scan's image for similarity search
    • Returns products matching visual style
    • Processes ~15 candidates
  4. 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
  5. 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

  1. Start backend: cd analyze && python api_server.py
  2. Start frontend: cd frontend && npm start
  3. Open Scanner tab β†’ capture tag image β†’ capture clothing image
  4. Wait 15-30 seconds for processing
  5. View results with eco-score and alternatives
  6. 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:

⚠️ Security: Never commit .env or *.json credential files to git!

πŸ“– Documentation

🀝 Contributing

Built for HackNYU Fall 2025

πŸ“„ License

MIT

Built With

Share this project:

Updates