Integrate Apify E-Commerce Scraper for real-time product data #19
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.

✅ Integration Complete: Apify E-Commerce Scraper
Task: Replace mock product data with real e-commerce data from Apify
/api/scrape)🐛 Bug Fix: Amazon Image Configuration
Issue: Runtime error when Actor returns Amazon product images:
Solution: Added Amazon image hostnames to Next.js
remotePatterns:m.media-amazon.com- Primary Amazon image CDNimages-na.ssl-images-amazon.com- Alternate Amazon image CDNvia.placeholder.com- Fallback placeholder images📸 Screenshots
Application Working (Before Fix Applied)
Initial State (Mock Data)
Loading State (Scraping in Progress)
🎯 What Was Integrated
Core Integration
apify-clientnpm package (v2.x) for Actor integration/api/scrapeNext.js API route that:apify/e-commerce-scraping-toolActor with keyword search on AmazonUI Enhancements
page.tsxto client component with React state managementonSearchcallback propCode Quality
Documentation
.env.exampletemplate for easy setup🔧 How It Works
/api/scrapewith the search queryapify/e-commerce-scraping-toolwith:keyword: User's search termmarketplaces:['www.amazon.com']scrapeMode:'AUTO'(automatically chooses best method)📋 Setup Requirements
Environment Variable
Set
APIFY_TOKENin.env.local:Get your token from: https://console.apify.com/account#/integrations
Installation
cd ecomm-demo npm install npm run dev🧪 Testing Performed
📦 Files Changed
New Files
ecomm-demo/app/api/scrape/route.ts- API endpoint for Apify integrationecomm-demo/README.md- Comprehensive documentationecomm-demo/.env.example- Environment variable templateModified Files
ecomm-demo/app/page.tsx- Client component with state managementecomm-demo/components/SearchBar.tsx- Added onSearch callbackecomm-demo/components/StatsCards.tsx- Calculate average price, show data sourceecomm-demo/components/ProductCards.tsx- Removed unused codeecomm-demo/package.json- Added apify-client dependencyecomm-demo/.gitignore- Allow README.md and .env.exampleecomm-demo/next.config.ts- Added Amazon image hostnames to remotePatterns🚀 Ready for Production
The integration is complete and production-ready. Users can now:
Note: First-time Actor runs may take 30-60 seconds as Apify initializes the scraper and searches Amazon.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.