-
Notifications
You must be signed in to change notification settings - Fork 140
feat: Add FabLens - Eco-Friendly & Skin-Safe Fabric Checker #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c27a751
feat: Add FabLens kit - Eco-Friendly & Skin-Safe Fabric Checker
yashasvij-19 864cd78
docs: Add detailed README for FabLens kit
yashasvij-19 c4de60f
update lamatic.config.ts
yashasvij-19 6720bfa
update folder structure
yashasvij-19 66519eb
Fix: change name of the folder to match the id
yashasvij-19 cf89be1
change name of the kit
yashasvij-19 ec7839e
FIX: update lamatic.config.ts
yashasvij-19 296b220
update agent.md
yashasvij-19 5c0abd4
update lamatic.config.ts
yashasvij-19 451e6b8
update lamatic.config.ts
yashasvij-19 ab25e60
update folder structure
yashasvij-19 d321d06
update app s folder
yashasvij-19 ac675a0
feat: improve material analysis pipeline with safer parsing, normaliz…
yashasvij-19 0da5041
fix: resolve CodeRabbit review issues across project
yashasvij-19 4deaa1c
fix: update page.tsx
yashasvij-19 0d2f8b0
update llinks.deploy
yashasvij-19 88c9adc
docs: Add JSDoc docstrings for CodeRabbit coverage
yashasvij-19 00eef4a
fix: harden AI parsing, sanitize fallback inputs, and improve accessi…
yashasvij-19 f3dbdc5
fix: remove file artifacts from agent.md, guard parsed.note type, dis…
yashasvij-19 4aa91f4
fix: align env vars, postcss config, and credential input across fabl…
yashasvij-19 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .lamatic/ | ||
| node_modules/ | ||
| .env | ||
| .env.local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | | ||
|
|
||
|
coderabbitai[bot] marked this conversation as resolved.
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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .vercel |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.