<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Byserva - Developers]]></title><description><![CDATA[Welcome to the Byserva engineering blog. We're on a mission to make headless commerce accessible, fast, and completely frictionless. Here, you'll find tutorials, API deep-dives, frontend performance tips, and architectural blueprints to help you build custom storefronts without the bloat. Whether you're a seasoned Next.js developer or just stepping into the world of headless commerce, you're in the right place.]]></description><link>https://byserva.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 13:56:05 GMT</lastBuildDate><atom:link href="https://byserva.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Headless Commerce Doesn't Have to Be Hard: A Deep Dive into Byserva's Products API]]></title><description><![CDATA[Building a custom storefront used to mean wrestling with bloated CMS platforms, endless plugin updates, and API rate limits that make you want to pull your hair out. If you're building a unique fronte]]></description><link>https://byserva.hashnode.dev/headless-commerce-doesn-t-have-to-be-hard-a-deep-dive-into-byserva-s-products-api</link><guid isPermaLink="true">https://byserva.hashnode.dev/headless-commerce-doesn-t-have-to-be-hard-a-deep-dive-into-byserva-s-products-api</guid><category><![CDATA[headless cms]]></category><category><![CDATA[Headless Commerce]]></category><category><![CDATA[by all means byserva]]></category><category><![CDATA[shopify alternative]]></category><category><![CDATA[APIDocumentation]]></category><dc:creator><![CDATA[RODNEY]]></dc:creator><pubDate>Tue, 17 Mar 2026 12:28:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/675b7a4e273858dd6a6531a6/68f2f0ed-8281-4c91-840e-6de94e1aee65.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<hr />
<p>Building a custom storefront used to mean wrestling with bloated CMS platforms, endless plugin updates, and API rate limits that make you want to pull your hair out. If you're building a unique frontend—whether it's a sleek mobile app, a heavily animated landing page, or a Next.js masterpiece—you just want your product data fast, clean, and out of your way.</p>
<p>Enter <a href="https://byserva.com">Byserva</a>—a lightweight, developer-first headless commerce platform and Shopify alternative built on Cloudflare Workers. It's designed to do exactly what you need: serve your commerce data globally with zero friction.</p>
<p>Today, we're going to dive into the core of any storefront: <strong>The Products API</strong>.</p>
<h2>The Anatomy of the Byserva API</h2>
<p>Before we fetch our products, let's understand the ground rules. The Byserva Public API is entirely RESTful and completely CORS-friendly, meaning you can call it directly from your browser without needing a middleman server.</p>
<p>Every request roots back to <code>https://api.byserva.com</code> and requires your unique <code>Store ID</code>. For this tutorial, we'll use the demo Store ID from the <a href="https://developer.byserva.com">official Byserva Developer Docs</a>: <code>1457FPTZD</code>.</p>
<h2>Fetching Your Catalog</h2>
<p>Getting your products is as simple as a GET request. No authentication headers, no complex GraphQL schemas—just pure JSON.</p>
<h3>1. Retrieve All Products</h3>
<p>To get your entire catalog, hit the <code>/{storeId}/products</code> endpoint.</p>
<pre><code class="language-javascript">// Fetching all products from your Byserva store
const storeId = '1457FPTZD';

fetch(`https://api.byserva.com/${storeId}/products`)
  .then(res =&gt; res.json())
  .then(data =&gt; console.log('My Products:', data))
  .catch(err =&gt; console.error('Error fetching catalog:', err));
</code></pre>
<p>The response is a beautifully clean array of product objects containing IDs, names, prices, quantities, and image arrays.</p>
<h3>2. Retrieve a Single Product</h3>
<p>Building a product detail page? Just append the Product ID to the URL.</p>
<pre><code class="language-javascript">const productId = '-OnE63diwuHJByfM7svB'; // Example ID for "Pompom"

fetch(`https://api.byserva.com/\({storeId}/products/\){productId}`)
  .then(res =&gt; res.json())
  .then(product =&gt; {
      console.log(`Viewing ${product.name} - Just $${product.price}!`);
  });
</code></pre>
<h2>Powering Up: Filters &amp; Pagination</h2>
<p>If your store has hundreds of items, you don't want to load them all at once. The Byserva API gives you three powerful, stackable query parameters to control your data: <code>sort</code>, <code>pg</code> (pagination), and <code>limit</code>.</p>
<h3>Sorting (<code>sort</code>)</h3>
<p>Want to show the cheapest items first? Pass <code>sort=price_asc</code>. For premium items first, use <code>sort=price_desc</code>.</p>
<h3>Pagination (<code>pg</code>)</h3>
<p>Byserva handles pagination using a simple <code>start-end</code> format. It's 1-indexed, making it incredibly intuitive. Want items 11 through 20? Pass <code>pg=11-20</code>.</p>
<h3>Limiting (<code>limit</code>)</h3>
<p>Just need the top 4 items for a "Featured" section? Slap on a <code>limit=4</code>.</p>
<h3>Putting It All Together (Demo Code)</h3>
<p>Let's build a practical example. Imagine you want to create a "Trending Deals" section on your homepage. You want the <strong>first 5 cheapest items</strong> from your catalog.</p>
<p>Here is the exact code you'd use:</p>
<pre><code class="language-javascript">async function getTrendingDeals() {
  const storeId = '1457FPTZD';
  // Stack our queries: Sort lowest to highest, limit to 5
  const endpoint = `https://api.byserva.com/${storeId}/products?sort=price_asc&amp;limit=5`;

  try {
    const response = await fetch(endpoint);
    
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    
    const deals = await response.json();
    
    console.log("🔥 Top 5 Deals:");
    deals.forEach((item, index) =&gt; {
      // Format the price (assuming the API returns a string integer like "1000")
      const formattedPrice = (parseInt(item.price) / 100).toFixed(2);
      console.log(`\({index + 1}. \){item.name} - $${formattedPrice}`);
    });

    return deals;

  } catch (error) {
    console.error("Failed to fetch trending deals:", error);
  }
}

getTrendingDeals();
</code></pre>
<h2>Wrapping Up</h2>
<p>That's really all there is to it. No massive SDKs to install, no convoluted auth flows for public data. Just clean, fast, reliable JSON delivered to whatever frontend framework you love.</p>
<p>Ready to build something incredible? Grab your Store ID from the <a href="https://byserva.com">Byserva Dashboard</a> and head over to the <a href="https://developer.byserva.com">Byserva Developer Documentation</a> to explore the Collections, Validation, and Notify APIs.</p>
<p><em>Happy building!</em> 🚀</p>
]]></content:encoded></item></channel></rss>