Skip to main content
Under Reviewv0.1.0-alpha

Shipping Module

The Shipping module handles package rate calculation, shipping carrier integration, tracking registration, and shipment status management.


Overview

The shipping subsystem allows querying rates across multiple configured shipping providers (e.g., Flat Rate, Free Above X, Weight-Based) and manages the lifecycle of order shipments. It supports:

  • Rate Calculation: Estimating shipping costs based on weight and order value.
  • Shipment Creation: Logging tracking information, assigning carrier details, and initiating shipping logs.
  • Status Tracking: Transitioning shipment statuses (e.g., from pending to in-transit or delivered).
  • Event Dispatching: Publishing order.shipped events when packages transition to the transit stage, enabling external modules to trigger notifications.

Architecture


API Routes

Customer Endpoints

MethodRouteDescriptionAuth
POST/shipping/ratesCalculates delivery rates across all providersNo (Public)
GET/shipping/order/:order_idFetches shipment and tracking details for a specific orderYes (Customer)
GET/shipping/track/:tracking_numberPublic tracking lookup by tracking numberNo (Public)

Admin Endpoints

MethodRouteDescriptionAuth
GET/admin/shippingLists all shipments in the databaseYes (Admin)
POST/admin/shippingCreates a new shipment record for an orderYes (Admin)
PUT/admin/shipping/:idUpdates tracking number and shipment statusYes (Admin)

Data Model

StatusDescription
pendingShipment record created, package not yet dispatched
in_transitPackage handed over to carrier; tracking number assigned
deliveredSuccessfully received by the customer
returnedPackage returned to origin

Key Flows

Calculate Shipping Rates

Admin Create Shipment

Update Shipment Status

Track Shipment by Tracking Number


Event Subscriptions

EventTriggerConsumers
order.shippedShipment enters in_transit phaseNotifications module (send tracking details to customer)