Use caseE-Commerce & Retail

Order Synchronization

Shop orders flow into ERP and warehouse in real time, even on peak days. With idempotency, retries and a full audit trail of every order.
Systems involved:ShopERPWarehouseDatabase

The problem

Online orders need to land in the ERP for invoicing and in the warehouse for fulfillment. On a normal day this is fine. On a campaign day, it is thousands of orders per minute, and any of them can fail because the ERP is slow, the warehouse API is down, or the connection drops.

Losing an order means losing money and losing trust. Processing the same order twice is just as bad. And once volume picks up, the simple "send and pray" integration that worked last year starts dropping things silently.

How dataflows solves it

dataflows handles every order as a durable workflow. The order is first saved in your own database, so it is never lost. Then it is pushed to the ERP and the warehouse, with retries if either system is busy.

Every order is processed exactly once, even if the shop sends the webhook twice. If the ERP is down, the workflow waits and retries instead of failing. If something is permanently broken, it shows up in the dashboard so the team can fix it without losing the order.

What it looks like in code

// Order sync workflow
export const orderSync = defineWorkflow({
  id: 'order-sync',
  trigger: shop.onOrderCreated(),

  async run({ event, step }) {
    const order = event.payload

    const isNew = await step.run('persist', () =>
      db.orders.insertIfMissing(order)
    )
    if (!isNew) return { status: 'skipped' }

    await step.run('sync-erp', {
      retries: 5,
      backoff: 'exponential'
    }, () =>
      erp.createSalesOrder(order)
    )

    await step.run('sync-warehouse', () =>
      warehouse.reserveStock(order)
    )

    await step.run('mark-synced', () =>
      db.orders.update(order.id, { status: 'synced' })
    )

    return { status: 'synced' }
  }
})

What the business gets

Never lose an order
Every order is saved in your own database first. Even if every external system fails.
Exactly once
Built in idempotency. Duplicate webhooks from the shop do not create duplicate orders.
Survives peak load
Smart retries and backoff. Black Friday volume does not break the pipeline.

Ready for automation that just works?

Tell us about your process. We will tell you if and how dataflows can help.