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

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
- 1Shopify to Contract gatewaySigned webhook
- 2Microsoft Graph to Contract gatewayNotifications, token lifecycle
- 3ERP to Contract gatewayScheduled export
- 4Contract gateway to Event busValidated event, contract v4
- 5Event bus to TracingSpan per hop · async
- 6Event bus to Delivery workersAt-least-once delivery
- 7Delivery workers to Internal appsTyped SDK call
- 8Delivery workers to Courier APIWrite with idempotency key
- 9Delivery workers to Finance systemWrite with idempotency key
- 10Delivery workers to Dead-letter storeAfter the last attempt
- 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.
- 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.
- 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.
- 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.
- External
order.receivedShopify webhook accepted, idempotency key recorded.
- System
contract.validatedPayload matches contract v4.
- System
erp.writtenOrder written to the ERP once.
- System
shipment.createdCourier API returns 503. Attempt 1 of 3.
- System
shipment.retry503 again after back-off. Attempt 3 of 3.
- System
event.dead_letteredHeld with payload, trace and last response.
- External
order.receivedShopify redelivers the same order. Key seen, skipped.
- Person
event.replayedOperator replays after courier recovery. Shipment created once.
05Integration complexity
What each connection has to survive.
| System | Interface | What makes it hard |
|---|---|---|
| Shopify | HMAC-signed webhooks | Redelivery and reordering are normal; handlers must be idempotent by design. |
| Microsoft Graph | OAuth 2.0, change notifications | Tokens expire mid-flow and subscriptions lapse silently unless renewed. |
| ERP | REST endpoints and scheduled exports | Batch exports overlap; records must be matched rather than appended. |
| Courier and finance APIs | REST writes | Partial outages and ambiguous timeouts, where a write may or may not have happened. |
06Challenges solved
Problems we had to design around.
- 01
Contracts drifted between teams without anyone noticing.
One schema source that validates traffic, generates SDK types and runs in CI.
- 02
Retries created duplicate records downstream.
Idempotency keys on every write, so a repeated delivery has no effect.
- 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.
Relevant services
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
- 01A conversation with the engineers who would build it.
- 02A short written view of the problem and how we would approach it.
- 03A scoped proposal, if working together makes sense.