Skip to content

Package boundaries

How EdgeCart splits commerce code into packages and enforces dependency direction.

EdgeCart’s commerce code is split into narrow workspace packages. New code should import the narrowest package it needs; packages/commerce is a compatibility facade for existing imports.

Commerce packages

Package Responsibility
commerce-core D1 schema, DTO mappers, money/currency, IDs, pagination, validation, errors, payment-provider contract.
commerce-sales Stores, members, sales channels, API keys, customers/groups, regions, tax, promotions.
commerce-catalog Products, variants, categories, collections, price lists, translations, inventory.
commerce-cart Cart lifecycle, line items, totals, plugin adjustments.
commerce-storefront Storefront read models and key-free config bootstrap.
commerce-orders Checkout, orders, cancellations/archive, fulfillment.
commerce-payments Payment collections/sessions, authorize, capture, refunds, provider webhooks, reconciliation.
commerce-order-changes Returns, claims, exchanges, versioned order changes.
commerce-observability Audit/outbox, webhook delivery, email delivery.

Dependency direction

The boundary script enforces the allowed direction:

core → sales/catalog → cart/storefront → orders → payments → order-changes
                                 ↘ observability

core has no business dependencies. Cross-package imports must use the package entrypoint. scripts/check-commerce-boundaries.mjs fails CI when the direction is violated, and packages/commerce/scripts/check-exports.mjs snapshots the facade’s export surface.

Client and contract packages

Package Responsibility
contract Types-only API contract: DTOs, request bodies, envelopes, resource interfaces.
admin-api Typed Admin API client and image upload.
storefront-api Typed Storefront API client and config bootstrap.
marketplace-api / marketplace-contract Marketplace client and attestation/signature primitives; not wired into the app yet.

Plugin packages

plugin-sdk, plugin-runtime, plugin-registry, plugin-blocks, and plugin-cli implement the plugin manifest, sandbox runtime, registry, Block Kit validation, and CLI. See the plugin documentation for the public surface.

Type to search…

↑↓ navigate↵ selectEsc close