Skip to content
James Ross
articlePublished Updated 10 min read

Designing a multi-brand commerce control plane

By James Ross

A multi-brand commerce control plane is the layer between a brand's catalog and the channels, warehouses and payment rails that fulfil it. The control plane puts available-to-promise inventory, order routing, fulfillment, invoicing and settlement for several brands into one PostgreSQL-backed application, and gives each brand a scoped portal into its own slice. The application is built and test-backed; every provider rail is capture-only or disabled until certification.

A central control platform linking brand catalog towers to warehouses, docks and payment rails, depicting a multi-brand commerce control plane.

Why a control plane instead of point-to-point integrations

A control plane exists because point-to-point integrations multiply the number of places that can hold a different answer to “how many can we sell?” Four truths have to agree at once — a brand’s catalog, a warehouse node’s stock, a channel’s expectation of what is available, and a statement that finance will sign — and the design problem is not the CRUD. Three brands, two channels and two warehouses already produce twelve edges. Each edge is a small program with its own retry logic, its own idea of what counts as stock, and its own failure mode.

A multi-brand control plane collapses those edges into one canonical model. Catalog, inventory, orders, fulfillment, invoices, fees, refunds, chargebacks and settlement statements live once. Channels and providers attach at the edge through a connector contract that returns canonical records, so the pricing, ATP and settlement engines never parse a vendor payload.

The trade-off is real: a control plane is a product to operate, not a script to run. It needs migrations, a job queue, an audit trail, role management and an on-call story. That cost only makes sense when the number of brands and channels is large enough that the edges would otherwise be maintained separately. Below that threshold, a single store and a single ERP are better served by a narrow connector — the kind described in the NetSuite to Shopify inventory sync.

The runtime shape: one database, two writers

The system is a pnpm monorepo with three deployable pieces: a Next.js web application, a worker, and a shared TypeScript domain package. PostgreSQL 16 is the only stateful service. The web app serves the public sales page, the internal console, the tenant-scoped brand portal and the API route handlers. The worker owns migrations, scheduling, job claims, connector operations, reconciliation and heartbeats. Both writers use the same shared package for validation and domain transitions.

There is no message broker. A PostgreSQL table is the queue. The worker claims rows with FOR UPDATE SKIP LOCKED, which lets several worker processes pull work without coordinating through an external service. The PostgreSQL documentation describes the trade-off plainly: skipping locked rows gives an inconsistent view of the data and is “not suitable for general purpose work”, but it avoids lock contention for multiple consumers reading a queue-like table (PostgreSQL SELECT).

That choice keeps the operational surface small. It also means job latency is bounded by polling and by database health, which is why the roadmap defers a dedicated workflow engine or broker until measured contention or long-running partner waits justify one. The trigger is written down in advance, which is the useful part.

Every state change follows the same three-step shape:

  1. Validate the input at the application boundary.
  2. In one transaction, write canonical state, append an audit or event record, and insert any durable job for follow-up work.
  3. Let the worker claim the job, apply an idempotent transition, and record the outcome or the retry state.

The transaction is what makes that sequence trustworthy. At PostgreSQL’s default Read Committed isolation each statement takes a new snapshot, so the state write, the event and the job insert have to commit together rather than sit in adjacent statements (PostgreSQL transaction isolation).

Operators recover supported failures through the application. Direct database edits are not a supported recovery path, because they bypass the event record that makes the next reconciliation possible.

How available-to-promise inventory works

Available-to-promise in the control plane is calculated per SKU and warehouse node and then reserved for a specific order line. Pricing runs first; a successful pricing pass triggers an ATP check, and a failed check becomes an explicit rejection or a hold with a reason and a resolution action. It never produces a partial order.

Three rules keep the number honest. First, reservations are durable records, not a counter that someone decrements in memory. Second, a reservation is consumed when the matching shipment is created and released through a guarded operation when an order is cancelled before shipment. Third, a routing attempt that cannot reserve stock leaves the order in a recoverable state rather than writing a negative quantity.

The test that matters here is concurrency, not arithmetic. The connector test matrix includes a database scenario that initialises inventory and then fires simultaneous routing attempts, with one required assertion: ATP never becomes negative and only valid reservations exist. A single-threaded unit test would pass while the production failure — two orders promising the same unit — stayed invisible.

Holds are part of the inventory model rather than an afterthought. A hold carries a reason, an owner and a resolution action, and the console shows all three. That detail matters at scale: an order stuck on “hold” with no reason is indistinguishable from a bug, and operators learn to ignore it.

The order state machine and its guards

An order moves through explicit states, and each transition is validated rather than assigned. The clearest example is pushed_to_node: an order reaches that state only through its state guard, after the fulfillment connector has accepted the push and the worker has persisted the external reference. No route handler sets the column directly.

The same discipline applies to the job lifecycle. The Jobs page shows queue state, attempts, a payload redacted of personal data where practical, the result, the error, and retry and cancel controls. The connector model states the rule plainly: a queued job is not evidence that anything left the system.

Exceptions are first-class. Validation and invariant failures are terminal until an operator corrects the input. Configured transient faults are retryable and deterministic by fixture or fault key. Cancellation before shipment releases eligible reservations. A replay returns or reuses existing records rather than consuming inventory twice.

Almost every serious inventory bug is a replay that was treated as a new event.

Routing and fulfillment without a live 3PL

Fulfillment runs against a mock 3PL today, and the mock is deliberately shaped like a real one. After ATP and routing reserve inventory, the console creates a pending fulfillment and a mock_3pl_push job. On acceptance, the adapter records a mock external reference and the worker schedules a shipment after a configured local delay. The shipment job creates tracking, consumes the matching active reservation, creates exactly one internal invoice, and writes the events.

The worker then schedules the follow-on work: mock_3pl_push followed by mock_3pl_ship, with protection against duplicate creation and idempotent handling of a duplicate delivery. The order moves to pushed_to_node only after the state guard allows it.

This is the part that looks like theatre and is not. The mock exercises the same seams a real provider will use: idempotency context, correlation values, canonical results, external IDs, typed failures, and a sync-run record that the operator can inspect. When a real adapter is registered, it has to preserve those rules; the architecture document is explicit that a network adapter must not change the state machine, pricing, ATP, routing or settlement behaviour.

Why money is integer minor units

Money in the system is stored as signed integer minor units. A settlement statement is reconciled from immutable transaction evidence: invoices, marketplace fees, refunds, chargebacks and corrections. The statement itself moves through draft generation, approval and locking, then an internal payment reference.

Two properties follow from the integer choice. Addition and comparison are exact, so a statement total either equals the sum of its lines or it does not; there is no tolerance band hiding a rounding difference. And every adjustment is a record with a source, not an edit to a prior total. A refund or chargeback that arrives late creates a new line, and the reconciliation run either explains the difference or raises it.

The finance boundary is deliberately narrow. The settlement engine consumes only reconciled succeeded or refunded transactions, and “mark paid” records an internal state and an audit event — it does not initiate a payout. That is not a missing feature; it is the boundary that keeps a portal download from being mistaken for a payment instruction.

The connector model: six modes, one contract

The connector model is the most reusable idea in the system. Every integration is configured with an immutable mode, and the runtime registry resolves only explicitly allowlisted adapter IDs and modes. The mode is part of the configuration, not a feature flag that someone can flip in a console.

Mode Network calls What it proves When to use it
manual None Operator workflow, validation, holds, audit A channel with no API, or the first weeks of a new brand
csv None Import validation, atomic commit, replay safety Bulk onboarding, catalog loads, reconciliation extracts
mock None Adapter contract, state transitions, failure handling Development, automated tests, demos
capture None (records only) Request shape, idempotency, evidence retention Provider credentials do not exist yet
sandbox Vendor test tenant Credential flow, payload acceptance, error mapping Certification, before any production write
network Production Nothing on its own Only after every activation gate passes

Which should you choose? For any rail whose credentials or certification do not exist, use capture and treat the recorded evidence as a contract test, not an integration. Use manual or csv when the business needs to operate now and the volume is low. Move to sandbox only when the provider has issued a test tenant, and to network only when reconciliation thresholds, pause controls and a named owner exist. The mode ladder is a sequence of evidence, not a maturity badge.

The enforcement details matter more than the labels. A durable connector outcome must retain a source marker and the raw mock payload, but never a secret. The worker must reject an unsupported connector type before it creates a job side effect. Network dispatch fails closed unless the current authorization and rollout gates pass. And no UI label may call a mock result “sent”, “delivered”, “paid” or “synced” without also identifying it as simulated.

Brand isolation is a server-side scope, not a filter

The portal is a separate route group that shares UI primitives but never reuses unscoped console queries or console mutation routes. Every portal data access begins with a single server-side scope constructor that returns the authenticated user ID and brand ID. Repository functions accept that scope and apply it in SQL through the canonical relationship: products.brand_id for catalog, sales_order_lines.brand_id for orders, and a direct brand_id for settlements and chargebacks.

No portal page may accept a brandId from a URL parameter, cookie, form field or hidden input. Aggregates, counts, exports, pagination totals, search results and not-found responses all use the same scope, so guessing another brand’s identifier reveals neither existence nor data. Portal responses use purpose-built DTOs that omit customer email, phone, full addresses, raw payloads, credentials, internal job diagnostics and payment references.

Admin access to a brand portal is a separate, audited read-only preview, and it is not an authorization bypass. The role model keeps catalog, ops, finance and readonly inside the internal console; only brand reaches the portal.

What broke and what we changed

Browser tests mutated the shared development stack. The first browser suites ran against the same database developers were using. The fix was structural: the suite now builds the production application and runs PostgreSQL, worker and web under an isolated Compose project, and the raw Playwright command rejects the normal development port. A separate containment lane snapshots aggregate counts from a fixed allowlist, runs two full suites, and verifies the counts did not move.

Mock outcomes read like real ones. A job result that says “sent” when nothing left the process is worse than no label at all, because it trains operators to trust the wrong screen. The connector model now prohibits that wording unless the same surface says “Simulated”, and the console shows persisted mock sync runs with counts, timestamps and errors.

Capture fixtures were being mistaken for integration evidence. The status document now separates implemented, verified, capture-only, externally activated and human-accepted, and states that the labels are not interchangeable. That sounds like documentation hygiene; in practice it is the control that stops a demo from becoming a production promise.

Demo data could reach production. The deployment contract requires demo seeding to be disabled in production, and a post-build scan proves the production bundle contains no demo fixtures. The earlier failure mode was subtle: a seeded environment is convenient, and convenience spreads.

What the architecture deliberately does not do

It does not run a workflow engine, a broker, an external identity provider, a search platform or a PIM. Each of those has a written adoption trigger tied to measured load or orchestration behaviour. That is a bet that a PostgreSQL queue and a normalised schema will carry the first several brands until the measurements say otherwise.

It also does not claim certification. The 353 unit tests, 16 migrations, 32 database tests and 11 browser scenarios prove the tested internal and capture behaviour. They do not prove production scale, exhaustive authorization, external provider effects or human acceptance, and the status record says so in the same document that reports the passing counts.

Frequently asked questions

What is a multi-brand commerce control plane?

A multi-brand commerce control plane is one application that holds catalog, inventory, orders, fulfillment, invoicing and settlement for several brands, and exposes each brand's data through a scoped portal. It replaces a set of point-to-point integrations with one canonical model, so pricing, available-to-promise inventory and reconciliation are calculated once rather than per channel.

Is the control plane connected to Shopify or Amazon today?

No. Shopify, Amazon, Walmart, Stripe, TaxJar, 3PL and partner/EDI modules exist as provider-neutral contracts and capture fixtures. No provider is certified or live; production activation requires approved accounts, current specifications, credentials, certification, reconciliation thresholds and rollback controls. The integration document describes each one as a foundation, not a connection.

How does the system stop two orders from promising the same unit?

Inventory is reserved per SKU and warehouse node as a durable record, and a routing attempt that cannot reserve stock becomes a rejection or a hold rather than a partial order. The database test suite includes simultaneous routing attempts with an assertion that ATP never goes negative and only valid reservations exist. Cancellation before shipment releases the reservation through a guarded operation.

Why keep money in integer minor units?

Integer minor units make addition and comparison exact, so a statement total either equals the sum of its lines or the discrepancy is real. Floating-point currency invites rounding differences that are small enough to hide and large enough to fail an audit. Every refund, fee or chargeback is also an immutable line rather than an edit, which keeps the evidence trail intact.

How is one brand kept out of another brand's data?

Every portal request resolves a server-side scope containing the authenticated user and brand, and every repository query applies that scope in SQL. The scope is never read from a URL, cookie or form field, and exports and counts use the same predicate. A guessed identifier returns the same generic not-found response as a genuinely missing record.

Why a PostgreSQL queue instead of a message broker?

A PostgreSQL table with FOR UPDATE SKIP LOCKED gives several workers a safe way to claim jobs without another service to operate. The documented cost is that skipping locked rows is not a general-purpose consistent read, which is fine for queue semantics. The roadmap defines the measured contention and long-running-wait triggers that would justify a broker or workflow engine later.