Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 15, 2025

Replaces mock product data with live e-commerce data from Apify's E-Commerce Scraping Tool. Users can now search for products by keyword and view real-time scraped results from Amazon.

Implementation

API Integration

  • Server-side route (/api/scrape) calls Apify Actor with apify-client
  • Transforms Actor output to match existing Product type
  • Returns run metadata for debugging via Apify Console
// app/api/scrape/route.ts
const run = await client.actor("apify/e-commerce-scraping-tool").call({
  keyword: query,
  marketplaces: ["www.amazon.com"],
  maxProductResults: 20,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();

UI Updates

  • Client component (app/page.tsx) manages search state and API calls
  • Loading/error/success states with user feedback
  • Stats cards dynamically calculate average price and indicate data source ("Mock" vs "Apify")
  • Image allowlist configured for Amazon/Walmart CDN domains

Configuration

  • .env.example template for APIFY_TOKEN
  • README with setup instructions and architecture overview
  • Updated .gitignore to include documentation files

Screenshots

Before (Mock Data)
Mock data showing 10 products

After (Live Amazon Data)
Real scraped data showing 20 laptop products

Search results show 20 real products with Amazon images, accurate pricing ($427.58 avg), and working product URLs. Data source indicator updates to "Apify 🚀" with link to run details.

Original prompt

Integrate Apify E-Commerce Scraper to replace the mock product data with real e-commerce data.

When a user enters a search query in the SearchBar and clicks Submit, use that query to call the Apify E-Commerce Scraping Tool (apify/e-commerce-scraping-tool). Display the scraped results in the Statistics Cards, Product Table, and Product Cards instead of mock data.

Custom agent used: apify-integration-expert
Expert agent for integrating Apify Actors into codebases. Handles Actor selection, workflow design, implementation across JavaScript/TypeScript and Python, testing, and production-ready deployment.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 15, 2025 14:32
Co-authored-by: lukas-bekr <224167845+lukas-bekr@users.noreply.github.com>
Co-authored-by: lukas-bekr <224167845+lukas-bekr@users.noreply.github.com>
Copilot AI changed the title [WIP] Integrate Apify E-Commerce Scraper for real data Integrate Apify E-Commerce Scraper for real-time product data Nov 15, 2025
Copilot AI requested a review from lukas-bekr November 15, 2025 14:43
Copilot finished work on behalf of lukas-bekr November 15, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants