Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions kits/fablens/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.lamatic/
node_modules/
.env
.env.local
76 changes: 76 additions & 0 deletions kits/fablens/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# FabLens — Fabric Impact Analyzer

FabLens lets you paste a clothing product URL and instantly understand what it's made of—and how those materials impact your skin and the environment.

It combines a structured material database with AI analysis to give clear, explainable insights.

---

## What It Does

- Extracts materials from product pages using Lamatic workflows
- Normalizes and deduplicates material data
- Scores materials across:
- 🌱 Environmental impact (biodegradability, water usage, chemical processing)
- 🧴 Skin safety (breathability, irritation risk)
- Uses a **hybrid scoring system**:
- Known materials → local database
- Unknown materials → AI analysis fallback
- Displays transparent positives and negatives

---

## Tech Stack

- **Lamatic** — workflow orchestration + LLM execution (GraphQL API)
- **Firecrawl** — webpage content extraction
- **Next.js (App Router)** — frontend + API routes
- **Tailwind CSS** — styling
- **Groq (llama-4-scout)** — AI inference

---

## Setup

```bash
cd kits/fablens/apps
cp .env.example .env.local
npm install
npm run dev
```

---

## Environment Variables

| Variable | Description |
|----------|-------------|
| `LAMATIC_API_KEY` | Your Lamatic API key from studio.lamatic.ai |
| `FABLENS_WORKFLOW_ID` | Workflow ID used by the FabLens Lamatic step |
| `LAMATIC_PROJECT_ID` | Your Lamatic project ID |
| `LAMATIC_WORKFLOW_ID` | Workflow ID used for material extraction |
| `LAMATIC_SCORING_WORKFLOW_ID` | Workflow ID used for unknown-material scoring fallback |
| `LAMATIC_HOST` | Your Lamatic GraphQL endpoint (e.g. https://<org>.lamatic.dev/graphql) |
Comment thread
coderabbitai[bot] marked this conversation as resolved.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
## Supported Sites

Works best with product pages that clearly list materials:

- BIBA
- Patagonia
- Independent/D2C brands

## Future Plans

- Percentage-weighted scoring
- Improved compound material handling
- Expanded material database
- Support for furniture & cosmetics
- Image-based material detection

## Limitations

- Sites with bot protection (e.g. H&M, Amazon) may fail
- Missing material data → no analysis
- Compound materials (e.g. polycotton) may not always resolve accurately
- No percentage-weighted scoring
62 changes: 62 additions & 0 deletions kits/fablens/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# FabLens

## Overview

FabLens is an intelligent consumer tool that helps users make informed clothing purchases by analyzing textile materials from product URLs. It provides a factual, transparent breakdown of environmental impact and skin safety so users can better understand what a garment is made of and what that means in practical terms.

## Purpose

FabLens exists to make fabric information easier to understand. Many fashion product pages mention materials without explaining their real-world implications, so FabLens translates those materials into clear insights about biodegradability, chemical processing, breathability, and irritation risk.

## Flows

### Material Analysis Flow

- **Trigger:** The user pastes a clothing product URL into the FabLens interface.
- **Process:** FabLens scrapes the product page, extracts listed material information, checks known fabrics against a local material database, and uses AI fallback analysis for unknown materials.
- **Response:** The system returns a structured explanation of each material's environmental characteristics and skin-safety considerations, including both positives and negatives.
- **Dependencies:** This flow depends on Lamatic orchestration, Firecrawl scraping, and the configured AI model.

## Guardrails

- FabLens should present factual information, not moral judgments or guilt-based messaging.
- FabLens should not assign simplistic scores when the product goal is transparent explanation.
- FabLens should clearly distinguish between known material database results and AI fallback analysis.
- FabLens should avoid making unsupported claims when the source page does not provide enough material detail.

## Integration Reference

FabLens uses Lamatic AI for flow orchestration and analysis, Firecrawl for webpage scraping, Next.js for the frontend application, Tailwind CSS for styling, and Groq with `llama-4-scout` as the language model layer.

## Environment Setup

The application requires Lamatic configuration for operation, including a host endpoint, project ID, and workflow IDs for material extraction and AI scoring fallback.

### Required Environment Variables

| Variable | Description |
|---|---|
| `LAMATIC_HOST` | Your Lamatic GraphQL endpoint (e.g. https://<org>.lamatic.dev/graphql). |
| `LAMATIC_PROJECT_ID` | Your Lamatic project ID from Lamatic Studio. |
| `LAMATIC_WORKFLOW_ID` | The workflow ID used for material extraction. |
| `LAMATIC_SCORING_WORKFLOW_ID` | The workflow ID used for AI-based material scoring fallback. |

## Quickstart

1. Navigate to `kits/fablens/apps`.
2. Copy `.env.example` to `.env.local`.
3. Fill in all required environment variables listed above.
4. Install dependencies with `npm install`.
5. Start the development server with `npm run dev`.

## Common Failure Modes

| Symptom | Likely Cause | Fix |
|---|---|---|
| No material analysis returned | The target site does not list material information clearly. | Try a product page that includes fabric details in plain text. |
| No scrape results | The target site has scraper protection. | Test with supported or simpler sites such as independent brands. |
| Flow does not run correctly | Missing or incorrect environment configuration. | Verify all four environment variables are set correctly in .env.local. |

## Scope

FabLens is currently designed for clothing product pages and works best on sites that expose material details in readable text. Support for furniture, cosmetics, image-based material detection, percentage-weighted scoring, and a larger material database are planned for future versions.
5 changes: 5 additions & 0 deletions kits/fablens/apps/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LAMATIC_API_KEY=your_lamatic_api_key_here
LAMATIC_HOST=https://your-org.lamatic.dev/graphql
LAMATIC_PROJECT_ID=your_project_id
LAMATIC_WORKFLOW_ID=your_extraction_workflow_id
LAMATIC_SCORING_WORKFLOW_ID=your_scoring_workflow_id
1 change: 1 addition & 0 deletions kits/fablens/apps/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vercel
Loading
Loading