Wednesday, May 27, 2026Tech HubAboutContactAdvertiseNewsletter
Back to Home
We just launched on the Shopify App Store - here's the architecture behind what we built

We just launched on the Shopify App Store - here's the architecture behind what we built

Hey dev.to - we just launched Nventory on the Shopify App Store and I wanted to share the technical decisions behind what we built and why. Not a feature list. The actual architectural thinking. The problem we kept seeing Every multichannel seller we talked to had the same story. Running Shopify...

B
Blizine Admin
·5 min read·0 views
Hey dev.to - we just launched Nventory on the Shopify App Store and I wanted to share the technical decisions behind what we built and why. Not a feature list. The actual architectural thinking. The problem we kept seeing Every multichannel seller we talked to had the same story. Running Shopify alongside Amazon, Flipkart, or eBay. Inventory going out of sync during high-traffic periods. Oversells during flash sales. Marketplace accounts flagged for cancellations that came from nowhere. All traceable back to one architectural decision most inventory tools make — polling. javascript// What most inventory tools are doing under the hood setInterval(async () => { const stock = await getSourceOfTruth(); await syncToAllChannels(stock); }, 15 * 60 * 1000); // The problem const windowsPerDay = (24 * 60) / 15; // 96 // 96 times per day where channels disagree about stock // At flash sale velocity: catastrophic 96 windows per day where channels show different stock. At normal velocity — manageable. At flash sale velocity — every window is an oversell waiting to happen. The architectural decision we made We built Nventory on event-driven propagation from day one. javascript// Every stock mutation fires an immediate event orderEventBus.on('order.confirmed', async ({ sku, qty, channel, orderId }) => { // Idempotency — retries don't corrupt counts if (await idempotencyStore.exists(orderId)) return; // Optimistic locking — concurrent orders resolve safely const result = await inventory.decrementWithLock(sku, qty); if (!result.success) { // Stock unavailable — pause listings across every channel immediately await pauseListingsAcrossChannels(sku); throw new InsufficientStockError(sku); } // Propagate immediately — milliseconds not minutes await Promise.all( connectedChannels .filter(ch => ch.id !== channel) .map(ch => ch.updateInventory(sku, result.newQty)) ); await Promise.all([ idempotencyStore.mark(orderId), auditLog.record({ sku, qty, channel, orderId, result, timestamp: Date.now() }) ]); }); Three decisions worth explaining: Idempotency keys — at volume, retries are inevitable. Without idempotency, retries create duplicate decrements that corrupt stock counts silently. Every mutation gets a key. Every retry checks it first. Optimistic locking — concurrent orders from different channels hitting the same SKU simultaneously need to resolve against the same stock count. Without locking, race conditions produce oversells even with event-driven sync. Dead letter queue — failed propagations that get silently dropped create invisible discrepancies. Every failure goes to DLQ with exponential backoff retry. Nothing gets lost. The Shopify integration layer Connecting to Shopify correctly required a few specific decisions: javascript// Shopify webhook handler — every relevant event app.post('/webhooks/shopify', async (req, res) => { const hmac = req.headers['x-shopify-hmac-sha256']; // Verify webhook authenticity if (!verifyShopifyHmac(req.body, hmac)) { return res.status(401).send('Unauthorized'); } const { topic, shop } = parseWebhookHeaders(req.headers); switch(topic) { case 'orders/create': await orderEventBus.emit('order.confirmed', parseOrder(req.body)); break; case 'inventory_levels/update': await inventoryEventBus.emit('inventory.updated', parseInventoryLevel(req.body)); break; case 'products/update': await productEventBus.emit('product.updated', parseProduct(req.body)); break; } res.status(200).send('OK'); }); // GraphQL inventory update — using Shopify's preferred API async function updateShopifyInventory(inventoryItemId, locationId, qty) { const mutation = mutation inventorySetQuantities($input: InventorySetQuantitiesInput!) { inventorySetQuantities(input: $input) { inventoryAdjustmentGroup { reason changes { name delta } } userErrors { field message } } } ; return shopifyGraphQL(mutation, { input: { reason: "correction", setQuantities: [{ inventoryItemId, locationId, quantity: qty }] } }); } Webhook reliability — Shopify webhooks occasionally fail or arrive out of order. We built a reconciliation layer that periodically verifies channel state matches our source of truth and corrects any drift. GraphQL over REST — Shopify's GraphQL API is significantly more efficient for bulk inventory operations. Fewer API calls, better rate limit management, cleaner error handling. Multi-location support — Shopify's inventory model is location-aware. Every inventory operation needs to specify location explicitly. Our routing engine determines the correct location per operation based on the seller's fulfilment rules. What we built on top The sync architecture is the foundation. On top of it: AI automation — sellers describe workflows in plain English, the system builds trigger-condition-action logic automatically using an LLM that understands our event model. javascript// Plain English → workflow const workflow = await automationBuilder.fromDescription( "When stock drops below 10 units on any SKU, send a Slack notification to the warehouse team" ); // Generates: // trigger: inventory.level.changed // condition: newQty < 10 // action: slack.send({ channel: '#warehouse', message: Low stock: ${sku} }) Smart order routing every order evaluated against proximity, cost, speed, and stock availability across FBA, 3PLs, and owned locations simultaneously. Multi-carrier shipping - real-time rate comparison across 100+ carriers per order. Optimal carrier selected automatically based on seller's routing rules. Honest reflections after launch The hardest part wasn't the sync architecture it was the edge cases. Shopify making automatic inventory adjustments for returns that need to reconcile with our source of truth. Channel APIs going down mid-propagation. Sellers with inconsistent SKU mapping across platforms. Variant-level inventory that doesn't map cleanly to marketplace catalog structures. The DLQ and reconciliation layer ended up being as important as the core sync engine. The happy path is straightforward. The unhappy paths are where reliability is actually built. Worth exploring If you're building for multichannel sellers or working on Shopify integrations would love technical feedback on the architecture.

📰Originally published at dev.to

Comments