Case Study
Built a fault-tolerant, distributed workflow platform on Temporal.io that synchronizes 100K+ automotive parts from Pinnacle inventory systems to Shopify and WooCommerce storefronts, paired with an edge-deployed Shopify dashboard app on Cloudflare Workers for configuration, monitoring, and client onboarding.
Australian automotive parts recyclers manage massive inventories of salvaged parts - often tens of thousands of items per yard - tracked in Pinnacle, a legacy inventory management system used across the industry. These businesses needed their inventory visible on e-commerce platforms like Shopify and WooCommerce to reach online buyers, but there was no reliable bridge between the two worlds.
The Pinnacle API returns enormous datasets (900MB+ per client) that change constantly as parts are added, sold, priced, and scrapped. A naive sync approach - pulling everything and pushing everything - was far too slow, too error-prone, and would hammer destination platform rate limits. The system needed to be intelligent about what changed, resilient to crashes and API failures, and configurable per client without requiring code changes.
Beyond the sync engine itself, clients needed a way to configure their own sync settings - field mappings, pricing rules, image preferences, and filtering logic - without touching code or calling me directly. The onboarding experience had to be self-service, and the monitoring had to be real-time.
System Architecture
I designed and built a two-part production system: a Temporal.io-powered workflow engine that handles the heavy lifting of inventory synchronization, and a Shopify Remix dashboard app deployed on Cloudflare Workers that serves as the control plane for configuration, monitoring, and client onboarding. The architecture prioritizes durability, fault tolerance, and operational simplicity - syncs survive crashes, deploys, and infrastructure failures without losing a single item.
I chose Temporal.io as the orchestration layer because the core problem is inherently long-running, failure-prone, and stateful. A single sync cycle can take hours when processing 900MB of inventory data against platform rate limits, and the system needs to pick up exactly where it left off after any failure - whether it's a network timeout, a worker crash, or a deployment rolling out.
The system uses a hierarchical workflow design. At the top sits the fullSyncOrchestrator, which coordinates the entire sync lifecycle for a client. It spawns a mainSync child workflow to fetch and analyze data from Pinnacle, then sequentially executes delete, update, and create child workflows to apply changes to the destination platform. This sequential ordering is deliberate - deletes run first to free up product slots, updates modify existing listings, and creates add new inventory last.
Temporal workflows accumulate event history as they execute, and workflows that exceed the history limit get terminated. I implemented a continueAsNew strategy at 40,000 history events. When a child workflow approaches this threshold during batch processing (creating or updating thousands of products), it checkpoints its progress, signals its state to the orchestrator, and continues as a fresh workflow execution. This allows single sync operations to process tens of thousands of products without hitting Temporal's history limits.
Temporal's gRPC transport has a hard 4MB payload limit, and a single client's inventory data can exceed 900MB. I solved this by implementing a file-based data exchange pattern: activities write large datasets to shared filesystem paths, and downstream activities read from those paths. The workflow passes only the file path reference (a few bytes) through Temporal's gRPC layer. A stale file cleanup mechanism runs at the end of each sync to prevent disk space accumulation.
All client workflows share a single Temporal task queue, which simplifies operations and allows horizontal scaling by adding more workers. Client isolation is maintained at the data level - each workflow carries its client configuration and operates on its own dataset. Temporal schedules trigger syncs every 4 hours per client, staggered to avoid thundering herd effects.
I designed the sync engine around an interface-based adapter pattern that abstracts away the destination platform entirely. The core workflow logic - fetch data, detect changes, apply mutations - doesn't know or care whether it's talking to Shopify or WooCommerce. Each destination is just an implementation of the adapter interface.
The adapter interface defines a clean contract: methods for fetching existing products, creating new ones, updating existing ones, archiving (soft-deleting) products, and querying product counts. The Shopify adapter implements these using GraphQL bulk mutations and the Admin API. The WooCommerce adapter uses the REST API with batch endpoints. Adding a new platform - say BigCommerce or Magento - means implementing this interface and nothing else. The orchestrator, change detection, and all business logic remain untouched.
Each client has a unique configuration that controls every aspect of how their inventory appears on the storefront. This includes tiered pricing rules (e.g., "$10-50 add 30%, $50+ add 25%"), product filtering by category or condition, tag generation from Pinnacle metadata, image selection logic (Part images vs Vehicle images), freight data enrichment for shipping dimensions, and SEO template generation. All of these rules are loaded from the dashboard app's configuration API at sync time, meaning clients can change their rules between syncs without any code deployment.
The most critical optimization in the system is the SHA256-based change detection pipeline. Rather than comparing every field of every product on every sync (which would be absurdly slow at 900MB+ datasets), I compute a hash of each product's relevant fields and compare it to the previously stored hash.
During the analysis phase, the mainSync workflow streams the full Pinnacle dataset through a JSONStream parser (avoiding loading the entire 900MB into memory) and computes a SHA256 hash for each part. These hashes are compared against the previously stored hash map from the last successful sync. The result is four categorized lists: parts to add (new hashes not seen before), parts to update (existing parts whose hash changed), parts to delete (previously synced parts no longer in the Pinnacle feed), and parts to skip (hash unchanged, no action needed).
I maintain two hashing modes for backward compatibility with clients who were onboarded before a schema change. The legacy mode hashes a subset of fields; the current mode hashes the full product payload. The hashing mode is stored per-client in their configuration, and the system transparently supports both without any code branching in the core sync logic.
In practice, this means that on a typical 4-hour sync cycle, only 2-5% of products have actually changed. Instead of pushing 15,000 API calls to Shopify, the system might only need 300-500. This dramatically reduces sync time, avoids rate limit pressure, and makes the system viable for the frequency of syncs clients need.
Temporal Workflow Execution Pipeline
I built the control plane as a Shopify Remix embedded app, deployed on Cloudflare Workers at the edge. The dashboard serves two audiences: clients who use it to configure their sync settings and monitor sync health, and the Temporal workers which call its internal APIs to fetch configuration and report sync status.
The app runs on Cloudflare Workers for edge-deployed performance with zero cold starts. Cloudflare D1 (SQLite at the edge) stores client configurations, sync history, error logs, and idempotency keys. I used Cloudflare Durable Objects to implement a serialized state machine for the setup wizard - ensuring that concurrent requests during the onboarding flow don't create race conditions or partial configurations. Drizzle ORM provides type-safe database access with migration support.
I designed a guided onboarding flow that takes a new client from zero to their first sync in about 5 minutes. Step 1 collects their Pinnacle API credentials and validates the connection. Step 2 presents the visual field mapping builder and tiered pricing configuration. Step 3 shows a review summary and launches the first sync. The Durable Object backing the wizard ensures atomic state transitions - you can't skip steps or submit a half-configured setup.
The field mapping builder lets clients drag and map Pinnacle fields to their Shopify product fields, with template support for generating titles, descriptions, and URL handles from multiple source fields. The tiered pricing interface allows rules like "$0-10 add 50%", "$10-50 add 30%", "$50-200 add 25%", "$200+ add 20%" - each client sets their own margin strategy. Configurations are versioned, and new versions are activated atomically so a sync never runs against a half-updated config.
The dashboard home shows hero stats (total synced products, last sync time, error count), a 7-run stacked bar chart showing adds/updates/deletes per sync, a chronological error log with stack traces, and a recent activity feed. Internal APIs allow the Temporal workers to push sync status updates in real-time, so the dashboard reflects the current state of any running sync.
When you're managing a client's entire product catalogue programmatically, safety isn't optional. A bug that accidentally deletes 10,000 products from a Shopify store would be catastrophic for the business. I built multiple layers of protection into the system.
If the change detection analysis determines that more than 50% of a client's products should be deleted, the sync aborts and raises an alert. This catches scenarios like a Pinnacle API returning an empty or partial dataset - which would otherwise look like "every product was removed" and trigger mass deletion. The threshold is configurable per client.
Before any sync begins, the orchestrator runs a health check activity against the Pinnacle API. If the API is down or returning errors, the sync is skipped rather than running with stale or empty data. This prevents the deletion threshold scenario from even being reached in most failure cases.
Every Temporal activity (API calls to Pinnacle, Shopify, WooCommerce) is configured with retry policies using exponential backoff. Transient failures - rate limits, network timeouts, 502 errors - are retried automatically without human intervention. The retry policy is tuned per activity type: read operations retry aggressively, write operations retry conservatively.
The dashboard maintains an idempotency keys table that prevents duplicate Temporal activity runs. If a worker crashes mid-activity and retries, the idempotency key ensures the operation isn't executed twice. This is especially critical for create and delete operations where duplicates would corrupt the product catalogue.
Products are never hard-deleted from destination platforms. Instead, the delete workflow archives them (draft/hidden status), preserving the product data and allowing recovery. This gives clients a safety net - if a part was incorrectly flagged for deletion, it can be restored without re-creating all its metadata, images, and URL history.
Synchronized over 100,000 automotive parts across multiple Shopify and WooCommerce storefronts, keeping inventory accurate and up to date.
Six active automotive recycler clients running in production, each with unique configurations, pricing rules, and destination platforms.
Temporal's durable execution guarantees mean zero products lost to crashes, deploys, or infrastructure failures. Every sync completes or resumes exactly where it left off.
New clients go from zero to their first sync in about 5 minutes through the guided setup wizard - no code changes or manual configuration required.
Fully automated sync cycles every 4 hours via Temporal schedules. Clients wake up to fresh inventory on their storefronts without lifting a finger.
System survives worker crashes, network outages, and rolling deployments. Temporal's event sourcing means workflows pick up exactly where they stopped.
I design and build fault-tolerant data synchronization platforms using Temporal workflows and modern edge infrastructure.
Let's Talk