<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: muthuri KE</title>
    <description>The latest articles on DEV Community by muthuri KE (@muthurike).</description>
    <link>https://dev.to/muthurike</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F665162%2F1c588c3d-418c-4b2e-8a7a-a3deebd2a283.jpg</url>
      <title>DEV Community: muthuri KE</title>
      <link>https://dev.to/muthurike</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muthurike"/>
    <language>en</language>
    <item>
      <title>Web Scraper API to Solve Business Problems</title>
      <dc:creator>muthuri KE</dc:creator>
      <pubDate>Sun, 29 Dec 2024 07:36:02 +0000</pubDate>
      <link>https://dev.to/muthurike/web-scraper-api-to-solve-business-problems-30hf</link>
      <guid>https://dev.to/muthurike/web-scraper-api-to-solve-business-problems-30hf</guid>
      <description>&lt;h3&gt;
  
  
  Submission for the &lt;a href="https://dev.to/challenges/brightdata"&gt;Bright Data Web Scraping Challenge&lt;/a&gt;: Build a Web Scraper API to Solve Business Problems
&lt;/h3&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;This project is a &lt;strong&gt;Product Prices Aggregator API&lt;/strong&gt; built using &lt;strong&gt;NestJS&lt;/strong&gt; and &lt;strong&gt;GraphQL&lt;/strong&gt;. It solves the business problem of tracking product prices, monitoring competitors, and fetching product details efficiently. The API leverages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bright Data&lt;/strong&gt;: To fetch product data from multiple domains.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redis&lt;/strong&gt;: For caching results, ensuring faster subsequent queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenSearch&lt;/strong&gt;: For indexing product data, enabling efficient search capabilities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kafka&lt;/strong&gt;: For real-time notifications to users when prices drop below a set threshold.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JWT-based Authentication&lt;/strong&gt;: For secure and role-based access.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The application is ideal for businesses seeking to track market trends, aggregate competitor pricing, and notify users of valuable deals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The application is available as a Docker image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker pull ghcr.io/muthuri-dev/product-price-aggregator-api:0.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the application and query using a GraphQL client. For example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Search Products by Title&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="k"&gt;query&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="n"&gt;searchProductsByTitle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"smart watch"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How I Used Bright Data
&lt;/h2&gt;

&lt;p&gt;Bright Data was the backbone of the data fetching mechanism. The application integrates with the Bright Data API to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Trigger data collection for specific keywords and domains.&lt;/li&gt;
&lt;li&gt;Fetch product data snapshots.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Workflow:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Trigger Bright Data API to collect product data.&lt;/li&gt;
&lt;li&gt;Fetch the snapshot data via the API.&lt;/li&gt;
&lt;li&gt;Cache the fetched data in Redis.&lt;/li&gt;
&lt;li&gt;Index the data in OpenSearch for efficient queries.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  GitHub Repository
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://github.com/muthuri-dev/product-prices-aggregator-api.git
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;Thank you for reviewing my submission for the Bright Data Web Scraping Challenge!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>brightdatachallenge</category>
      <category>api</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
