Orders, deliveries and payments are one conversation
Commerce, logistics and financial workflows touch the same transaction. We keep the data separate, then connect it deliberately.
A single order touches commerce, logistics and payments. The mistake is to turn that obvious truth into one enormous database table.
One workflow, several domains
We model the transaction as a workflow across three bounded areas. Each area owns its records and rules, and they communicate through explicit events.
Commerce owns intent
The order begins as an intent: what was bought, by whom, at what price. Commerce is responsible for turning a basket into a confirmed order and keeping the record of what the customer asked for.
Logistics owns movement
Logistics owns the physical journey: serviceability, courier assignment, delivery status and proof of completion. It does not need to understand the pricing rules behind the order.
Payments own movement of value
Payments owns the financial side: the payment attempt, its reference, the amount recorded and the reconciliation state. It does not decide what was ordered.
Events, not shared tables
The domains share identifiers and event contracts, not tables. An order placement produces an event that logistics and payments consume in their own time. This keeps each domain’s state coherent and makes failures local.
type OrderPlaced = {
orderId: string;
deliveryRequestId: string;
amountMinor: number;
currency: "GMD";
};
export function handleOrderPlaced(event: OrderPlaced) {
// Each domain records its own state; the identifiers are the contract.
return {
delivery: event.deliveryRequestId,
payment: event.orderId,
};
}The reconciliation habit
Events can arrive late, twice or not at all. We treat reconciliation as a first-class part of the workflow rather than an afterthought: every step has an expected state, and the difference between expected and actual is visible to the people operating the platform.
What this buys us
It gives the operations team a readable picture of where a transaction is stuck, instead of a single row that is half order, half delivery and half payment. It also means a change to the payment rules does not require rewriting the delivery workflow.
This is an implementation direction, not a finished claim. Quarreh is pre-launch, and we will publish what survives contact with real operations.
