HomeCase studiesPost-Purchase Order and Multi-Carrier Delivery Management Platform...

Case study · Hamburg, Germany

Post-Purchase Order and Multi-Carrier Delivery Management Platform Built with Node.js, React, and PostgreSQL

Post-Purchase Fulfillment & Returns Orchestration

Direct-to-consumer brands shipping across multiple parcel carriers lose operational control the moment an order leaves checkout—split warehouses, cryptic carrier scan codes, and manual return emails overwhelm support desks. We built a post-purchase order and delivery management platform using Node.js, React, and PostgreSQL. Event-driven BullMQ workers normalize carrier webhooks into a strict shipment state machine, automate proactive exception workflows, and power both a React operations console and a self-service returns portal.

Industry
Post-Purchase Fulfillment & Returns Orchestration
Solution
An event-driven post-purchase order orchestration, multi-carrier tracking normalization, and self-service RMA returns platform built with Node.js, React, and PostgreSQL.
Platforms
Web & API
Stack
Node.js · React · PostgreSQL · TypeScript · Redis · BullMQ
Location
Hamburg, Germany · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Hamburg, Germany. Names withheld by agreement.

Project Overview

Checkout conversion gets most of the engineering budget in retail, yet customer loyalty is frequently won or lost in the days between clicking "Pay" and opening the front door. When an order splits across two regional warehouses, stalls at a parcel locker, or requires a size exchange, shoppers often receive broken carrier links and generic status emails—driving endless "Where is my order?" tickets straight to support teams.

Built for a multi-brand commerce logistics operator in Hamburg, we engineered an order and delivery management platform powered by Node.js, React, and PostgreSQL. The system unifies fragmented carrier feeds into a canonical shipment state machine, triggers proactive exception workflows, and equips both support desks and end customers with real-time tracking and automated return portals.

Post-Purchase Visibility Gaps

Growing order volumes across European parcel networks exposed four structural breakdowns in legacy ERP-to-carrier scripts:

  • Carrier dialect fragmentation: DHL, DPD, Hermes, and UPS emit incompatible status codes, timezone formats, and multi-hop hub descriptions that confuse buyers when surfaced raw.
  • Blind spots on split fulfillments: Legacy order tables stored a single tracking field per order, breaking visibility whenever items shipped separately from different distribution centers.
  • Silent transit stalls: Undelivered parcels sitting un-scanned at sorting depots went unnoticed until frustrated customers filed chargebacks or flooded support queues.
  • Manual RMA bottlenecks: Generating return labels, inspecting condition grades, and triggering partial refunds required hopping across disconnected helpdesk, carrier, and payment dashboards.

Architectural Strategy

We modeled post-purchase orchestration around an immutable event log and explicit parcel state machine inside PostgreSQL. Commercial orders, fulfillment allocations, and physical packages live as distinct relational entities connected through line-item quantity ledgers.

Node.js services expose typed GraphQL endpoints to two tailored React experiences—an internal exception-triage console and a customer-facing tracking and returns portal—while BullMQ workers isolate slow external carrier API calls, label PDF generation, and SLA delay sweeps from synchronous user requests.

Core Capabilities

  • Canonical Carrier Normalization: Translates dozens of proprietary carrier scan events into unified consumer milestones (label created, in transit, out for delivery, parcel shop ready, exception, delivered).
  • Split-Shipment & Multi-Parcel Orchestration: Tracks partial dispatches, backordered line items, and independent carrier legs under a single customer order timeline.
  • Proactive Exception & SLA Sweeper: Detects missing first-mile pickup scans, address failures, and customs holds automatically, opening prioritized support queues and notifying shoppers early.
  • Self-Service Returns & Exchanges Portal: Guides customers through eligibility checks, return-reason capture, carrier drop-off QR/PDF label issuance, and instant store-credit or exchange reservations.
  • Warehouse RMA Receiving Bridge: Logs scanned return parcels against open RMAs and emits verified refund triggers to upstream payment gateways only after quantity checks pass.
  • Branded Tracking & Notification Rules: Dispatches localized German and English milestone updates gated by quiet hours and channel preferences.

Technical Architecture

Incoming order-created events from storefronts and scan webhooks from parcel carriers land on stateless Node.js ingestion endpoints, verify HMAC signatures, and enqueue typed jobs in Redis-backed BullMQ queues. Workers normalize payloads through carrier-specific TypeScript adapters, persist idempotent transitions into PostgreSQL, and publish UI updates and outbound customer notifications.

Flow: Storefront Orders & Carrier Webhooks → Node.js Ingestion Gateway → Redis & BullMQ Workers → TypeScript Carrier Adapters → PostgreSQL Parcel State Machine & RMA Ledger → GraphQL API → React Operations Console & Customer Portal

Separating ingestion from processing guarantees that sudden carrier webhook storms—such as thousands of depot scans hitting simultaneously at midnight—buffer safely in Redis without exhausting PostgreSQL connection pools.

Technology Stack

Category Technology detail
Operations & Tracking UI React and TypeScript workspaces for internal CS exception queues and branded customer tracking portals
Core Orchestration API Node.js and TypeScript service exposing GraphQL operations and signed webhook ingestion endpoints
Order & Shipment Ledger PostgreSQL persisting normalized order line items, split-parcel states, RMA requests, and audit trails
Async Job Processing BullMQ worker pools handling carrier polling fallbacks, label generation, and delayed-parcel rules
Queue & Rate Broker Redis backing BullMQ queues, webhook idempotency keys, and carrier API token buckets
Carrier Adapters Pluggable TypeScript connectors normalizing DHL, DPD, Hermes, and UPS webhooks and polling APIs
Notification Engine Event-triggered transactional email and SMS dispatchers tied to verified milestone transitions
Container Runtime Dockerized API and worker services enabling zero-downtime rolling deploys and isolated worker scaling

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Relying strictly on push webhooks misses silent failures when carriers stop sending events Combined primary webhook ingestion with tiered BullMQ polling sweeps for parcels idle beyond expected transit windows, trading modest background API usage for zero blind spots.
Out-of-order carrier scans can overwrite newer delivery statuses with stale transit events Enforced monotonic state-transition rules and event-timestamp comparisons in PostgreSQL, preserving late scans in the audit log without regressing customer-facing parcel states.
Calling carrier label APIs synchronously during return requests blocks the browser UI Generated simple carrier QR codes asynchronously with immediate BullMQ priority queues and streamed completion status over GraphQL subscriptions/polling, keeping UI feedback snappy.
Sharing one flat status across split parcels misleads buyers when half an order arrives early Modeled parcel-level status independently alongside aggregated order summaries in PostgreSQL and React, accepting slightly richer UI timelines for clear per-item transparency.

Webhook Security & Idempotent State

Because shipping webhooks and return portals directly trigger customer communications and financial refunds, strict integrity controls surround every entry point. Carrier webhook endpoints validate provider HMAC signatures and IP allowlists before touching queues, while customer tracking portals require signed opaque lookup tokens scoped strictly to order numbers and postal-code verification—never exposing sequential order IDs.

Every external event computes a deterministic idempotency digest stored in Redis and checked inside PostgreSQL transactions. Return-merchandise authorizations lock eligible line-item quantities with row-level SELECT ... FOR UPDATE guards so simultaneous click retries or duplicate mobile submissions cannot issue multiple return labels or refunds for the same item.

Carrier Burst Absorption & Query Speed

Holiday shipping waves create dramatic spikes in both tracking-page views and midnight depot scan webhooks. BullMQ worker pools scale horizontally in Docker containers independent of the GraphQL API tier, enforcing per-carrier concurrency caps in Redis so outbound polling never trips carrier rate-limit bans.

On the read path, PostgreSQL indexes active exception flags, carrier codes, and customer lookup hashes while archiving completed historical scan payloads into partitioned tables. Support agents filtering thousands of delayed German and EU shipments inside React receive sub-second triage views without locking active ingestion writers.

Operational Outcomes

Replacing brittle point-to-point carrier scripts with an event-driven post-purchase state machine streamlined coordination across logistics, support, and warehouse teams:

  • Faster exception resolution: Automated SLA sweeps surface stuck depots and failed address deliveries immediately, allowing operations teams to intervene before buyers open support disputes.
  • Unified split-order clarity: Shoppers and agents view every warehouse leg, carrier milestone, and return eligibility status inside one coherent React timeline.
  • Controlled, auditable returns: Quantity-locked RMA workflows and direct warehouse verification eliminate duplicate refund leaks and manual spreadsheet reconciliation.
  • Resilient peak-season throughput: Decoupled BullMQ ingestion buffers carrier webhook surges smoothly without degrading customer tracking portal responsiveness.

01 — Questions

asked about this kind of project

How does the system handle orders split across multiple warehouses and different parcel carriers?

PostgreSQL models a strict separation between commercial order lines and physical fulfillment parcels. Each parcel tracks its own carrier adapter, tracking number, and milestone state independently, while roll-up status rules present an accurate consolidated timeline to both support agents and buyers.

What happens when carrier webhooks arrive out of order, duplicated, or late?

Every incoming webhook carries a deterministic deduplication key stored in Redis and PostgreSQL. State transitions pass through an explicit finite-state guard that compares carrier event timestamps against existing milestones so late duplicate scans never regress a delivered parcel back to in-transit.

How are self-service returns prevented from allowing duplicate refund claims on split shipments?

RMA creation executes inside serialized PostgreSQL transactions that lock the eligible quantity per order line item. Already-returned or pending-inspection units are deducted immediately, preventing double claims across simultaneous tabs or API retries.

Why pair webhook ingestion with scheduled BullMQ polling fallbacks?

Regional parcel carriers occasionally drop webhooks during peak holiday traffic or fail to emit final customs-hold events promptly. Lightweight BullMQ sweepers poll parcels whose last scan exceeds expected transit SLAs so stuck shipments surface before customers contact support.

Why choose Node.js and TypeScript alongside PostgreSQL for fulfillment orchestration?

High-concurrency webhook bursts and JSON payload normalization fit Node.js non-blocking I/O naturally, while shared TypeScript schemas across backend adapters and React interfaces keep complex split-shipment and RMA states strictly type-safe.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.