Skip to content
TrustCode System
← All work
ArchitectureLogistics / BackendBackendCloud

Multi-Carrier Shipping Integration

Extensible TypeScript shipping-rate service designed to integrate UPS, FedEx, DHL, and future carriers without coupling third-party APIs to core business logic.

github · source
Architecture

/ the problem

Shipping rate APIs differ wildly by carrier. Embedding UPS-specific payloads in business logic makes every new carrier a rewrite, and OAuth token handling becomes fragile under load.

/ approach

The engineering team implemented an extensible carrier-adapter architecture with OAuth handling and testable domain boundaries.

/ what we built

  • Strategy-pattern ICarrier interface isolating ShippingService from carrier quirks
  • Mapper buffer zone so domain models stay free of carrier field names
  • UPS adapter with OAuth 2.0 client-credentials, token caching, proactive refresh, and 401 retry
  • Zod environment validation, Axios client, Jest + Nock integration tests, structured errors

/ the outcome

A carrier-agnostic shipping-rate module with a working UPS path and a clear extension point for future FedEx and DHL adapters, without implying those adapters are already complete.