Commerce Chain Optimization

Overview

Supply Chain module overview: procurement, fulfillment, inventory, and quality loops.

SCM in Commerce Chain uses four canonical loops:

Each loop is a typed LoopDefinition with explicit states, transitions, and actor permissions.

At a glance

| Loop | Core states | | --- | --- | | procurement | OPEN → PO_CONFIRMED → RECEIPT_SCHEDULED → GOODS_RECEIVED → INVOICE_MATCHED → CLOSED | | fulfillment | OPEN → RESERVED → PICKED → PACKED → SHIPPED → CLOSED | | inventory | OPEN → ADJUSTED → RECONCILED → CLOSED | | quality | OPEN → HOLD → ASSESSMENT → RESOLVED → CLOSED |

Module interface and services

Each @betterdata/scm-* package exports services, state machines, and helpers. Configure runtime dependencies once at startup (database accessor, OutboxWriter, and where required ChannelReader) — there is no global db() inside the packages.

import { configureInventoryRuntime, getAvailability } from "@betterdata/scm-inventory";

Runtime configuration

Loop participation

Each SCM package exports a loop participant manifest (for example inventoryLoopParticipant) built with LoopIds and EventNames from @betterdata/loop-definitions.

import { inventoryLoopParticipant } from "@betterdata/scm-inventory";

Loop participation