Skip to content

Different systems. One contract they can all rely on.

Enterprise Integration Systems

Contract-validated APIs, typed SDKs and idempotent event processing connecting business applications that were never designed to talk.

Category
Systems integration
Industry
Retail & e-commerce
Work type
Integrations
Stack
TypeScript SDKs, OAuth 2.0, Zod contracts, GitHub Actions, OpenTelemetry
An integration health dashboard on a monitor in a quiet evening office, showing connected systems and recent syncs.

01Context

A business running commerce, ERP, Microsoft 365 and courier services side by side, with point-to-point scripts moving data between them and no shared view of what had been delivered.

The business problem

An integration can compile and still fail at runtime: contracts drift, OAuth tokens expire, events arrive twice or out of order, and nobody notices until the data is wrong.

What we built

Executable API contracts and typed TypeScript SDKs, token lifecycle handling, idempotent event processing with bounded retries and dead-letter replay, and integration suites that run in CI.

02System architecture

Systems, flows and the boundaries between them.

  • Service
  • System of record
  • External system
  • Gate
  • Asynchronous
  1. 1Shopify to Contract gatewaySigned webhook
  2. 2Microsoft Graph to Contract gatewayNotifications, token lifecycle
  3. 3ERP to Contract gatewayScheduled export
  4. 4Contract gateway to Event busValidated event, contract v4
  5. 5Event bus to TracingSpan per hop · async
  6. 6Event bus to Delivery workersAt-least-once delivery
  7. 7Delivery workers to Internal appsTyped SDK call
  8. 8Delivery workers to Courier APIWrite with idempotency key
  9. 9Delivery workers to Finance systemWrite with idempotency key
  10. 10Delivery workers to Dead-letter storeAfter the last attempt
  11. 11Dead-letter store to Event busOperator replay

Components: Shopify (External system, webhooks); Microsoft Graph (External system, OAuth 2.0 · refresh); ERP (External system, REST · scheduled export); Contract gateway (Approval or permission gate, Zod · in and out); Tracing (Service, OpenTelemetry spans); Event bus (System of record, keyed · versioned); Delivery workers (Service, bounded retries); Dead-letter store (System of record, payload + context); Internal apps (Service, typed TypeScript SDK); Courier API (External system, idempotent writes); Finance system (External system, idempotent writes).

Major capabilities

Executable contracts
Zod schemas define every request, response and event, and generate the SDK types.
Typed SDKs
TypeScript clients for internal applications, versioned with the contracts.
Token lifecycle
OAuth refresh, expiry and revocation handled centrally rather than in each script.
Idempotent delivery
Every write carries an idempotency key; retries are bounded with back-off.
Dead-letter and replay
Exhausted events kept with payload and context, replayable once the cause is fixed.

03Engineering approach

The decisions that shaped the system.

We put a contract at every boundary and made it executable: the same schema validates traffic in production, generates SDK types and runs in CI. Delivery assumes failure, so every event is keyed, retried within limits and recoverable.

  1. 01

    Validate at the boundary, in both directions.

    Inbound payloads and outbound responses are checked against the contract, so drift is caught at the edge instead of deep in a database.

  2. 02

    Idempotency keys on every write.

    At-least-once delivery is the only honest guarantee. Keys make a repeated event harmless; bounded retries make failure visible.

  3. 03

    Contract tests run in CI on every change.

    A change that breaks a consumer fails the build, before it reaches a system that cannot be rolled back.

04Workflow

A courier outage, end to end

One shipment event through three failed attempts, a duplicate delivery and a replay. Written once.

  1. Externalorder.received

    Shopify webhook accepted, idempotency key recorded.

  2. Systemcontract.validated

    Payload matches contract v4.

  3. Systemerp.written

    Order written to the ERP once.

  4. Systemshipment.created

    Courier API returns 503. Attempt 1 of 3.

  5. Systemshipment.retry

    503 again after back-off. Attempt 3 of 3.

  6. Systemevent.dead_lettered

    Held with payload, trace and last response.

  7. Externalorder.received

    Shopify redelivers the same order. Key seen, skipped.

  8. Personevent.replayed

    Operator replays after courier recovery. Shipment created once.

05Integration complexity

What each connection has to survive.

Integrations and their failure modes
SystemInterfaceWhat makes it hard
ShopifyHMAC-signed webhooksRedelivery and reordering are normal; handlers must be idempotent by design.
Microsoft GraphOAuth 2.0, change notificationsTokens expire mid-flow and subscriptions lapse silently unless renewed.
ERPREST endpoints and scheduled exportsBatch exports overlap; records must be matched rather than appended.
Courier and finance APIsREST writesPartial outages and ambiguous timeouts, where a write may or may not have happened.

06Challenges solved

Problems we had to design around.

  1. 01

    Contracts drifted between teams without anyone noticing.

    One schema source that validates traffic, generates SDK types and runs in CI.

  2. 02

    Retries created duplicate records downstream.

    Idempotency keys on every write, so a repeated delivery has no effect.

  3. 03

    Failures disappeared into logs.

    Dead-letter storage with payload, trace and last response, and a replay path.

07Outcomes

Failures surface as diagnosable events with context and a replay path, not as silent data drift discovered weeks later.

Outcomes are described at capability level. Client figures stay with the client.

  • A breaking contract change fails the build instead of a production integration.
  • Repeated and out-of-order events no longer produce duplicate records.
  • Failed deliveries are visible, explained and replayable without hand-written fixes.
Start a project

Bring us the process everyone works around.

The spreadsheet that runs the business, the inbox nobody can leave, the integration that breaks quietly. Tell us where operations slow down and we will show you how we would engineer it.

What happens next

  1. 01A conversation with the engineers who would build it.
  2. 02A short written view of the problem and how we would approach it.
  3. 03A scoped proposal, if working together makes sense.