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.