Skip to main content
Retail & E-Commerce

Best Seller Sync: Building a Shopify App That Re-Ranks Collections by Real Sales

Built, reviewed & published · Live on the App StoreBestRank
LiveOn the Shopify App Store

Built internally as BestRank, launched on the Shopify App Store as Best Seller Sync - Auto Update.

The Challenge

Shopify gives merchants exactly two ways to order a collection: sort it by hand, or use the built-in "Best selling" sort, an all-time, black-box ranking that never forgets. A product that sold well two years ago can sit in position one forever while this month’s actual best-sellers are buried on page three. Sold-out items keep their prime slots. There is no way to rank by a recent window, no way to pin a launch to the top for a week, no way to exclude gift cards and clearance, and no best-seller badges without paying a developer to hard-code them into the theme. Merchants either accept stale collections or burn hours every week dragging products around the admin. We built BestRank as our own product to close that gap, which meant building to the standard the Shopify App Store review actually enforces: a properly embedded admin app with session-token auth, HMAC-verified webhooks, the mandatory GDPR endpoints, and a UI indistinguishable from Shopify’s own.

Our Approach

BestRank runs as an embedded admin app on React Router 7 with the official @shopify/shopify-app-react-router integration, and every screen is built in Polaris so it reads as native Shopify rather than a bolted-on dashboard. The data layer is Prisma over PostgreSQL (shop configuration, per-collection rules, and a full snapshot of every sync), with Redis in front for caching and API rate-limit smoothing. On each scheduled sync the app pulls the store’s order history over a merchant-configurable look-back window, scores every product in the managed collection by the chosen metric (units sold, order count, revenue, or GA4 page engagement on the Pro tier), and writes the new order back through the Shopify Admin GraphQL API. The algorithm is the default, never the dictator: merchants can pin up to five products to the top (with scheduled start and end dates, so a launch pins itself and unpins automatically), exclude products entirely, auto-demote sold-out items, and have the app auto-add top sellers from order history that were never added to the collection. Ranked products get a best-seller badge and bsync:rank tags that any theme can read, putting badges on the storefront with zero theme code. Because every sync is snapshotted, the Trends view shows per-product rank history with movement sparklines, a collection stability score, ABC performance grading, and CSV export. Inside the embedded iframe, every request rides App Bridge session tokens (the useFetcher-based pattern Shopify’s review expects), and webhooks are HMAC-verified before a byte is processed. The whole stack (app, PostgreSQL, and Redis) deploys on Railway.

What Shipped

  • Live on the Shopify App Store in the Collections category, having passed Shopify’s app review
  • Three-tier pricing (Free / $6 / $14) with plan-gated sync frequency and look-back windows
  • Automated re-ranking on a configurable recent-sales window, plus manual run
  • Sales badges, GA4 event integration, and safety rails: product exclusions and pinned-product protection

Technologies Used

ShopifyReact Router 7TypeScriptPrismaPostgreSQLRedisPolarisGraphQLRailway

Want Similar Results?

Book a free 30-minute call. We'll explain exactly what we can achieve for your business.