The Better Diamonds · Custom catalog architecture for 250k unique products
A diamond retailer needed to sell their supplier's full inventory online. Each diamond is unique: its own cut, clarity, carat weight, and price. The supplier's catalog had around 250,000 items, constantly changing as stones sold and new ones came in.
The initial approach was to load them as Shopify products. It didn't scale. The API throttle kicked in, the sync was slow, and the catalog in Shopify was always slightly behind the source of truth. More fundamentally, Shopify's product model isn't designed for 250,000 unique items where each one has a distinct price and exactly one unit of stock.
I redesigned the architecture entirely. A middleware API built with NestJS connects directly to the supplier's ERP, caches the full catalog, and serves filtered results to the storefront with 50-100ms response times. The storefront queries the middleware, not Shopify. Shopify holds a single carrier product per category. When a customer selects a specific diamond and proceeds to checkout, the middleware creates a draft order via the Shopify API with the correct price and product details, then redirects to Shopify's native checkout via the invoice URL.
The client wasn't on Shopify Plus, so Shopify Functions weren't available to intercept and modify checkout pricing. The draft order approach solved the same problem without the plan upgrade.
Pricing logic lives entirely in the middleware: base price from the ERP, configurable per-carat markup brackets, and optional price rounding to the nearest step. The storefront always shows the correct final price without any Shopify-side customization.
When a purchase completes, a Shopify webhook triggers the middleware to verify availability with the ERP in real time and place the order on the supplier's side. If the purchase fails, a Telegram notification fires immediately. Failed orders can be retried from the dashboard.
The checkout session flow tracks the full purchase lifecycle: from draft order creation through payment confirmation. The frontend polls a session status endpoint to detect completion and clear the cart, handling page refreshes and edge cases without losing state.
The system includes a custom admin dashboard for the client's team: inventory browsing, pricing configuration, order history with retry capability, sync logs, webhook logs, activity audit trail, and user management with per-tab permissions. The operations team can manage the entire integration without touching code.













- Stack: Node.js, NestJS, TypeScript, Shopify Admin API (GraphQL), Cloudflare Workers, AWS, PostgreSQL