All case studies

DEV3 Technologies · own product

DEV3 AI Inventory & Supplier Price Sync: supplier feeds that can't wreck a Shopify catalog

Our own Shopify app: it syncs stock and prices from supplier feeds over SFTP, FTP, URLs or APIs, applies margin formulas and FX, and holds any suspicious run for approval after deterministic guards and an AI review.

Industry
E-commerce (Shopify)

Live project preview

Client systems are private — screenshots shown where permitted.

DEV3 Technologies · own product — screenshots
A supplier sync held for review: nothing has been written to the store, with run summary and the anomaly guard that tripped on a 38% price-drop share.

A supplier sync held for review: nothing has been written to the store, with run summary and the anomaly guard that tripped on a 38% price-drop share.

The challenge

Merchants who resell or drop-ship get stock and cost data from suppliers as CSV, XML or JSON files on FTP servers, SFTP drops, URLs or APIs, each in its own layout, encoding and currency. Keeping Shopify in step by hand is slow, and automating it is risky: one truncated file, a decimal comma read the wrong way or an export from the wrong warehouse can zero out a catalog or cut prices by 80% overnight. We wanted an app that reads any of these feeds, applies the merchant's margin rules, and refuses to write a change set that looks wrong until a person has looked at it.

Our solution

AI Inventory & Supplier Price Sync is an embedded Shopify app on React Router 7 with a Postgres database through Prisma and a BullMQ worker that runs scheduled and manual syncs. Each run goes fetch, parse, map, match, compute, anomaly check and apply. Everything before the anomaly check is read-only: it produces a list of planned before-and-after changes, and only an approved list is written to Shopify.

Key design decisions

  • Real feed sources. HTTP(S) URLs with Basic, Bearer or API-key auth, FTP/FTPS via basic-ftp, SFTP with a password or PEM key via ssh2-sftp-client, and paginated REST APIs. File patterns pick the newest matching file. Credentials are encrypted with AES-256-GCM, and private network addresses are blocked in production.
  • Streaming parsers. CSV is parsed as a stream and gzip is inflated as a stream, so large files never sit in memory as text. XML, ZIP and JSON/JSON Lines are supported, along with delimiter sniffing, encodings and header-row offsets.
  • A safe formula engine. Margin rules such as (cost * 1.4) + 2 run through a tokenizer and parser in a shared core used across DEV3's apps, with no eval. Rules are scoped by supplier, collection, tag, vendor or product type and add .99/.95 rounding, minimum margin, MAP and never-below-cost floors, plus a per-run cap on price decreases.
  • Currency conversion. Supplier amounts are converted with European Central Bank daily reference rates, cached and refreshed every 12 hours. Manual rates set by the merchant take precedence.
  • Ten deterministic guards, then an AI second opinion. Guards check price and cost drops, price increases, zero-outs, row-count changes, unknown and missing SKUs, invalid rows, cost above retail, negative values and empty feeds. The Google Gemini API (gemini-2.5-flash) then reviews aggregated statistics and at most 15 outliers, never the full feed, and returns a verdict and a 0–100 risk score through a JSON schema. Feed text is wrapped as untrusted data.
  • Hold and approve. A tripped guard, or an AI hold at or above the risk threshold, marks the run HELD, writes nothing, emails the merchant and pauses that supplier's schedule. Approval applies exactly the stored plan.
  • Safe writes. Stock goes through inventorySetQuantities with changeFromQuantity and deterministic @idempotent keys, in batches of 250. A stale-quantity error triggers a live re-read and one retry. Prices go through productVariantsBulkUpdate per product with partial updates allowed.

Architecture

The admin UI covers a five-step supplier wizard with a sample preview, price rules with a test calculator, sync history with before-and-after changes and CSV export, and settings for buffers and thresholds. A variant index, refreshed with bulk operations and product webhooks, matches feed rows by SKU or barcode. Shared DEV3 packages provide the Shopify GraphQL client with throttling retries, the AI client, billing and the job queue. Shop data is deleted on shop/redact, and the app stores no customer data.

Results

The app is in final QA before submission to the Shopify App Store; real-store testing is the next step. What has been built and verified so far:

  • Typecheck clean (0 errors) and 104 Vitest tests passing
  • Integration tests against real SFTP, FTP and HTTP feed servers
  • A 200,000-row gzipped CSV streamed in 64 KB chunks without buffering, plus XML, ZIP and JSON parsing tests
  • 10 deterministic guards, each with an adjustable threshold
  • An injected 80% price drop was HELD with an AI risk score of 90, and the alert email was sent. No changes reached the store until approval
  • Inventory writes in batches of 250 with changeFromQuantity and idempotency keys, so a retried job never applies a batch twice

Related case studies