Appendix F: BRD-to-Code Module Mapping

Version: 4.0.0 Last Updated: February 25, 2026 BRD Version: 20.0 (19,900+ lines, 7 modules, 113 decisions)


F.1 Purpose & How to Use This Document

This appendix maps every business capability in the Business Requirements Document (BRD v20.0) to a specific code-level service in the POS Platform implementation. It bridges the gap between business requirements (written for stakeholders) and the modular monolith implementation (written for developers).

Who Should Use This

AudienceUse Case
DevelopersFind which service to create/modify when implementing a BRD feature
ArchitectsVerify module boundaries and dependency direction rules
QA EngineersTrace test coverage back to BRD sections
Product OwnersUnderstand how business features map to technical components

How to Read the Tables

Each service entry includes:

  • Service Name: Technology-agnostic logical name (e.g., sale.cart.command.service)
  • BRD Section(s): Which BRD section(s) this service implements
  • Capability: What business function this service performs
  • Pattern: CQRS Command, Query, CRUD, Event Handler, Rule Engine, etc.
  • Owns Tables: Database tables this service is the authoritative writer for
  • Publishes/Consumes Events: Domain events for inter-service communication

F.2 Architecture Context

The POS Platform follows an Event-Driven Modular Monolith architecture (selected in Chapter 04) with the following pattern assignments per module:

ModuleCQRSEvent SourcingPattern
Module 1: SalesFull CQRSFull ESSeparate command/query services
Module 2: CustomersStandard CRUDNoneRepository pattern with caching
Module 3: CatalogStandard CRUDNoneRead-heavy, Redis cache
Module 4: InventoryMaterialized read modelES for audit trailCommand/query split for PO, transfers
Module 5: SetupStandard CRUDNoneConfiguration data, direct access
Module 6: IntegrationsStandard CRUDAudit-trail-only ESExtractable gateway

Design Principles

  • Maximum Granularity: One service per business capability, not one service per module
  • Single Responsibility: Each service does ONE thing well
  • DDD Boundaries: Services own their aggregates; cross-module access via events or public API
  • No God Services: Break coarse-grained services (e.g., IOrderService) into focused capabilities

Reference: Chapter 04 (Architecture Styles Analysis), Section L.4 for full architecture rationale.


F.3 Module Overview

The BRD defines 6 business modules. The code architecture maps these to 7 code modules plus cross-cutting concerns and an optional RFID module:

#BRD ModuleCode ModuleServicesPattern
1Sales (1.1-1.20)modules/sales/37Full CQRS + ES
2Customers (2.1-2.8)modules/customers/7CRUD
3Catalog (3.1-3.15)modules/catalog/20CRUD + Cache
4Inventory (4.1-4.19)modules/inventory/23Materialized + ES audit
5Setup (5.1-5.21)modules/setup/21CRUD
6Integrations (6.1-6.13)modules/integrations/20CRUD + Audit ES
XCross-cutting (Ch 07, 14)cross-cutting/8Mixed
RRFID/Raptag (Ch 10 D13)modules/rfid/6CRUD + Command
TOTAL142

F.4 Module 1: Sales – Service Breakdown (37 Services, Full CQRS+ES)

BRD Sections: 1.1-1.20

F.4.1 Cart & Checkout Commands

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
1sale.cart.command.service1.1Create cart, add/remove line items, attach customerCommandorders (draft state)SaleCreated, SaleLineItemAdded, SaleLineItemRemoved
2sale.cart.query.service1.1Get active cart, list items, calculate running totalsQuery(reads orders, order_items)SaleLineItemAdded, SaleLineItemRemoved
3sale.park.command.service1.1, 1.1.1Park/retrieve/expire held sales, manage TTL, soft-reserve inventoryCommandorders (parked state)SaleParked, SaleRetrieved, SaleExpired
4sale.park.query.service1.1List parked sales for terminal/locationQuery(reads orders WHERE status=parked)SaleParked, SaleRetrieved

F.4.2 Discount & Pricing Commands

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
5sale.discount.command.service1.2Apply/remove line discounts, global discounts, enforce calculation orderCommand(writes to order discount fields)DiscountApplied, DiscountRemoved
6sale.promotion.engine.service1.2, 1.14Evaluate automatic promos (Buy X Get Y), validate coupon codes, stack rulesRule Enginepricing_rules (read)PromotionTriggered, CouponRedeemedSaleLineItemAdded
7sale.price-override.command.service1.2Manual price override with manager auth, reason codeCommand(writes to order_items.unit_price)PriceOverridden

F.4.3 Payment & Settlement Commands

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
8sale.payment.command.service1.3Process split tenders, validate payment covers total, calculate changeCommandpayment_attemptsPaymentReceived, PaymentFailed
9sale.payment.card.service1.18SAQ-A semi-integrated card flow: initiate terminal, receive token + authIntegrationpayment_attempts (card entries)CardPaymentAuthorized, CardPaymentDeclined
10sale.payment.cash.service1.3Cash tendering, change calculation, drawer interactionStateful(writes to cash_movements)CashPaymentReceived
11sale.payment.giftcard.service1.3, 1.5Check GC balance, apply partial/full, deductCommandgift_card_transactionsGiftCardRedeemed
12sale.payment.storecredit.service1.3Check credit balance, apply on-account, validate credit limitCommand(reads/writes customer store_credit)StoreCreditApplied
13sale.payment.affirm.service1.3Third-party financing flow: create session, handle webhookIntegrationpayment_attempts (affirm entries)AffirmLoanApproved
14sale.finalize.command.service1.3Finalize order: write record, deduct inventory, award loyalty, record commissionCommand (Orchestrator)orders (completed state)SaleCompletedPaymentReceived

F.4.4 Post-Sale Commands

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
15sale.void.command.service1.4, 1.4.1Void same-day order: reverse inventory, loyalty, commission; check eligibilityCommandorders (voided state)SaleVoided
16sale.return.command.service1.4Process return: validate receipt, apply policy, issue refundCommandreturns, return_itemsReturnInitiated, ReturnCompleted
17sale.exchange.command.service1.4Dedicated exchange: items OUT + items IN, calculate differenceCommandreturns (exchange type), ordersExchangeProcessed
18sale.return-policy.engine.service1.9Evaluate return eligibility: time window, receipt validation, manager overrideRule Engine(reads tenant_settings, return policy config)ReturnPolicyEvaluated

F.4.5 Gift Card Commands

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
19sale.giftcard.command.service1.5Sell/activate gift cards, reload, deactivate, check complianceCommandgift_cards, gift_card_transactionsGiftCardIssued, GiftCardActivated, GiftCardReloaded
20sale.giftcard.query.service1.5Balance lookup, transaction history, expiration checkQuery(reads gift_cards, gift_card_transactions)GiftCardRedeemed, GiftCardIssued

F.4.6 Special Order & Layaway

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
21sale.specialorder.command.service1.6Create/manage special orders and back ordersCommandorders (special_order type)SpecialOrderCreated, SpecialOrderFulfilledInventoryReceived
22sale.layaway.command.service1.3.2Create layaway, accept deposits, release inventory on final paymentStatefulorders (layaway state)LayawayCreated, LayawayPaymentReceived, LayawayCompleted, LayawayCancelled
23sale.hold-for-pickup.command.service1.11Hold/stage/expire pickup orders including BOPISStatefulorders (hold states)HoldCreated, HoldStaged, HoldPickedUp, HoldExpired

F.4.7 Cash Drawer Operations

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
24sale.cashdrawer.command.service1.12Open/close drawer, paid in/out, cash drops, no-saleCommandcash_drawers, cash_movements, cash_dropsDrawerOpened, DrawerClosed, DrawerCashDrop, DrawerPaidIn, DrawerPaidOutCashPaymentReceived
25sale.cashdrawer.count.service1.12Denomination-level cash counts (opening, closing, mid-shift, audit)Commandcash_countsCashCounted
26sale.cashdrawer.pickup.service1.12Armored car pickup tracking, bank deposit reconciliationCommandcash_pickupsCashPickupCompleted
27sale.shift.command.service1.12Clock-in/out to shift, link to drawer, track totalsStatefulshiftsShiftOpened, ShiftClosedDrawerOpened, DrawerClosed, SaleCompleted

F.4.8 Tax Engine

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
28sale.tax.calculation.service1.17Calculate compound 3-level tax (State/County/City), handle exemptionsCalculation(reads taxes, location_tax)TaxCalculated

F.4.9 Commission & Loyalty

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
29sale.commission.command.service1.8Calculate and record commissions per sale, proportional reversal on returnCommand(commission fields on orders)CommissionRecorded, CommissionReversedSaleCompleted, ReturnCompleted, SaleVoided
30sale.loyalty.command.service1.15Award/redeem loyalty points, tier calculation, bonus rulesCommandloyalty_transactions, loyalty_accountsLoyaltyPointsEarned, LoyaltyPointsRedeemed, LoyaltyTierChangedSaleCompleted

F.4.10 Queries & Read Models

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
31sale.history.query.service1.4Sales history with filters (date, user, status, location)Query(reads orders, order_items)SaleCompleted, SaleVoided, ReturnCompleted
32sale.receipt.query.service1.4Generate/reprint receipt data, email receiptQuery(reads orders, order_items, payments)ReceiptEmailed
33sale.receipt.validate.service1.4Validate receipt barcode authenticity, match to orderQuery(reads orders)
34sale.daily-summary.projection.service1.1.2, 1.3.4Materialized daily sales summary, hourly heatmapEvent Handler(writes read model views)SaleCompleted, SaleVoided, ReturnCompleted
35sale.price-check.query.service1.13Price check mode: lookup product price without sale contextQuery(reads products, pricing_rules)

F.4.11 Offline & Serial Tracking

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
36sale.offline.sync.service1.16Queue offline transactions, sync on reconnect, conflict resolutionStatefulsync_queue (sale entries)OfflineSaleSynced, SyncConflictDetected
37sale.serial-tracking.command.service1.10Associate serial numbers with sale line items, validate uniquenessCommand(serial_number field on order_items)SerialNumberSold

F.5 Module 2: Customers – Service Breakdown (7 Services, CRUD)

BRD Sections: 2.1-2.8

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
38customer.profile.crud.service2.1Create/update/delete customer profiles, manage PIICRUDcustomersCustomerCreated, CustomerUpdated, CustomerDeleted
39customer.search.query.service2.1Search customers by name, email, phone, loyalty numberQuery(reads customers)CustomerCreated, CustomerUpdated
40customer.group.crud.service2.2Manage customer groups/tiers (VIP, Wholesale, etc.), auto-tier rulesCRUD(customer group/tier fields)CustomerGroupAssigned, CustomerTierChangedSaleCompleted
41customer.notes.crud.service2.3Customer notes, preferences, internal flagsCRUD(notes fields on customers)
42customer.communication.crud.service2.4Marketing consent, preferred channels, opt-in/outCRUD(communication preference fields)CommunicationPreferenceChanged
43customer.merge.command.service2.5Merge duplicate customer records, reassign historyCommandcustomers (merge target)CustomersMerged
44customer.privacy.command.service2.5, 2.6GDPR anonymization, data export, deletion requestCommandcustomers (anonymized_at)CustomerAnonymized, CustomerDataExported

F.6 Module 3: Catalog – Service Breakdown (20 Services, CRUD+Cache)

BRD Sections: 3.1-3.15

F.6.1 Product Management

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
45catalog.product.crud.service3.1Create/update/delete products, manage attributes, soft deleteCRUDproductsProductCreated, ProductUpdated, ProductDeleted
46catalog.variant.crud.service3.1Create/update/delete variants (size/color), matrix managementCRUDvariantsVariantCreated, VariantUpdated, VariantDeleted
47catalog.product.query.service3.1Get product by ID/SKU/barcode, list with pagination/filtersQuery(reads products, variants)ProductCreated, ProductUpdated
48catalog.bulk-import.command.service3.1Bulk CSV/Excel import of products and variantsCommandproducts, variantsBulkImportCompleted
49catalog.product.lifecycle.service3.2Manage product lifecycle: draft, active, discontinued, archivedStatefulproducts (lifecycle states)ProductActivated, ProductDiscontinued, ProductArchived

F.6.2 Categorization & Tagging

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
50catalog.category.crud.service3.5Manage hierarchical categories, sort orderCRUDcategoriesCategoryCreated, CategoryUpdated
51catalog.collection.crud.service3.5Marketing/seasonal collections with date rangesCRUDcollections, product_collectionCollectionCreated, CollectionUpdated
52catalog.tag.crud.service3.5Freeform product tagsCRUDtags, product_tag
53catalog.brand.crud.service3.1Brand reference data managementCRUDbrands

F.6.3 Pricing

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
54catalog.pricing.crud.service3.3Manage pricing rules, price books, tier pricingCRUDpricing_rulesPricingRuleCreated, PricingRuleUpdated
55catalog.pricing.calculation.service3.3Calculate effective price (hierarchy: price book > tier > promo > base)Calculation(reads pricing_rules, products)
56catalog.markdown.command.service3.3Schedule markdowns, automatic clearance pricingCommandpricing_rules (markdown type)MarkdownApplied, MarkdownExpired

F.6.4 Barcode & Label

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
57catalog.barcode.service3.4Generate/validate/lookup UPC/EAN barcodesCRUD(barcode fields on products/variants)
58catalog.label.print.service3.10Generate label/price tag print jobs, template selectionCommand(label print queue)LabelPrintJobCreated

F.6.5 Search, Media & Vendor

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
59catalog.search.service3.9Full-text product search, faceted filtering, suggestionsQuery(reads products via FTS indexes)ProductCreated, ProductUpdated
60catalog.media.crud.service3.11Product image management, upload, reorderCRUD(image fields on products/variants)
61catalog.vendor.crud.service3.8Vendor/supplier management, lead times, min order quantitiesCRUD(vendor reference tables)VendorCreated, VendorUpdated
62catalog.notes.crud.service3.12Product notes and attachmentsCRUD(notes/attachments on products)
63catalog.permissions.service3.13Catalog approval workflows, permission checksRule Engine(reads role_permissions)CatalogChangeApproved, CatalogChangeRejectedProductUpdated
64catalog.analytics.query.service3.14Product performance analytics, sales velocity, margin analysisQuery(reads products, order_items, inventory)SaleCompleted

F.7 Module 4: Inventory – Service Breakdown (23 Services, Materialized+ES Audit)

BRD Sections: 4.1-4.19

F.7.1 Stock Level Queries

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
65inventory.level.query.service4.1, 4.2Get current stock by variant/location, available qty calculationQuery(reads inventory_levels materialized view)InventoryAdjusted, InventorySold, InventoryReceived
66inventory.level.adjustment.service4.7Manual adjustments: count, damage, theft, found, with reason codesCommandinventory_levels, inventory_transactionsInventoryAdjusted
67inventory.status-model.service4.2Manage inventory statuses: available, reserved, committed, in_transit, damagedStatefulinventory_levels (status fields)InventoryStatusChanged

F.7.2 Purchase Orders

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
68inventory.po.command.service4.3Create/edit/approve/cancel purchase ordersCommand(purchase_orders table)PurchaseOrderCreated, PurchaseOrderApproved, PurchaseOrderCancelled
69inventory.po.query.service4.3List/search POs, status tracking, ETA displayQuery(reads purchase_orders)PurchaseOrderCreated, PurchaseOrderApproved
70inventory.receiving.command.service4.4Receive against PO: full/partial, inspection, discrepancy handlingCommandinventory_levels, inventory_transactionsInventoryReceived, ReceivingDiscrepancyLoggedPurchaseOrderApproved

F.7.3 Reorder Management

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
71inventory.reorder.engine.service4.5Auto-reorder point monitoring, suggested PO generationRule Engine(reads inventory_levels, reorder configs)ReorderPointReached, ReorderSuggestedInventoryAdjusted, InventorySold

F.7.4 Counting & Auditing

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
72inventory.count.command.service4.6Physical inventory counts: full, cycle, spot checkCommandinventory_transactions (count type)InventoryCounted
73inventory.count.query.service4.6Count session management, variance reportsQuery(reads count sessions/results)InventoryCounted

F.7.5 Transfers

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
74inventory.transfer.command.service4.8Create/ship/receive inter-store transfersCommand(transfer tables), inventory_transactionsInventoryTransferred, TransferShipped, TransferReceived
75inventory.transfer.query.service4.8List transfers, track in-transit, ETAQuery(reads transfer tables)TransferShipped, TransferReceived

F.7.6 Vendor Returns & Costing

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
76inventory.rma.command.service4.9Vendor RMA: create, ship back, track creditCommand(RMA tables)VendorRMACreated, VendorRMAShipped
77inventory.costing.calculation.service4.11Landed cost calculation: freight, duty, insurance allocationCalculation(cost fields on inventory_transactions)LandedCostCalculatedInventoryReceived
78inventory.serial-lot.command.service4.10Serial/lot number assignment, tracking, recall supportCommand(serial/lot fields)SerialNumberAssigned, LotCreated

F.7.7 Movement History & Dashboard

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
79inventory.movement.query.service4.12Stock ledger, movement history by variant/locationQuery(reads inventory_transactions)all Inventory* events
80inventory.dashboard.projection.service4.17Inventory dashboard materialized views: stock value, aging, velocityEvent Handler(writes dashboard read models)InventoryAdjusted, InventorySold, InventoryReceived

F.7.8 POS Integration & Fulfillment

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
81inventory.sale-deduction.event-handler.service4.13Deduct inventory on sale completion, restore on void/returnEvent Handlerinventory_levels, inventory_transactionsInventorySold, InventoryRestoredSaleCompleted, SaleVoided, ReturnCompleted
82inventory.reservation.command.service4.13Soft-reserve inventory for pending sales, holds, layawaysCommandinventory_levels (quantity_reserved)InventoryReserved, InventoryReservationReleasedSaleParked, HoldCreated, LayawayCreated
83inventory.fulfillment.command.service4.14Online order fulfillment: pick, pack, ship from storeCommand(fulfillment fields on orders)FulfillmentStarted, FulfillmentShipped

F.7.9 Offline & Alerts

#Service NameBRD Section(s)CapabilityPatternOwns TablesPublishes EventsConsumes Events
84inventory.offline.sync.service4.15Offline inventory operations queue, sync, conflict resolutionStatefulsync_queue (inventory entries)OfflineInventorySynced
85inventory.alert.service4.16Low stock alerts, reorder notifications, expiring lot alertsEvent HandlerLowStockAlert, ReorderAlertInventoryAdjusted, InventorySold
86inventory.rules.engine.service4.18Business rules evaluation from YAML config (negative stock, auto-transfer)Rule Engine(reads tenant_settings)
87inventory.report.query.service4.17Inventory reports: valuation, aging, shrinkage, turnoverQuery(reads inventory_levels, inventory_transactions)

F.8 Module 5: Setup & Configuration – Service Breakdown (21 Services, CRUD)

BRD Sections: 5.1-5.21

F.8.1 System Settings

#Service NameBRD Section(s)CapabilityPattern
88setup.settings.crud.service5.2System settings, branding, locale, defaultsCRUD
89setup.currency.crud.service5.3Multi-currency configuration, exchange ratesCRUD

F.8.2 Location Management

#Service NameBRD Section(s)CapabilityPattern
90setup.location.crud.service5.4Create/update/deactivate locations, assign type, set hoursCRUD

F.8.3 User & Role Management

#Service NameBRD Section(s)CapabilityPattern
91setup.user.crud.service5.5User profile management, activation/deactivationCRUD
92setup.role.crud.service5.5Role management, permission assignment matrixCRUD
93setup.timetracking.command.service5.6Clock-in/clock-out, break managementCommand

F.8.4 Register & Hardware

#Service NameBRD Section(s)CapabilityPattern
94setup.register.crud.service5.7Register management, IP limits (max 2/365 days), retire (OWNER-only)CRUD
95setup.printer.crud.service5.8Printer/peripheral registration, connection managementCRUD
96setup.device.crud.service5.7Device registration, hardware fingerprint, status managementCRUD

F.8.5 Tax Configuration

#Service NameBRD Section(s)CapabilityPattern
97setup.tax.crud.service5.9Tax rate definitions, location-tax assignments, effective datesCRUD

F.8.6 Payment & UoM Configuration

#Service NameBRD Section(s)CapabilityPattern
98setup.payment-method.crud.service5.11Payment method configuration, processor settingsCRUD
99setup.uom.crud.service5.10Units of measure management, conversion rulesCRUD

F.8.7 Custom Fields & Workflows

#Service NameBRD Section(s)CapabilityPattern
100setup.customfield.crud.service5.12Custom field definitions, validation rules, entity assignmentCRUD
101setup.approval-workflow.crud.service5.13Approval workflow configuration, threshold rulesCRUD

F.8.8 Receipt & Email

#Service NameBRD Section(s)CapabilityPattern
102setup.receipt.crud.service5.14Receipt template configuration, header/footer customizationCRUD
103setup.email-template.crud.service5.15Email template management, variable substitutionCRUD

F.8.9 Audit & Onboarding

#Service NameBRD Section(s)CapabilityPattern
104setup.audit.config.service5.18Audit log configuration, retention policiesCRUD
105setup.rules.engine.service5.19Business rules YAML configuration, validationCRUD
106setup.loyalty.config.service5.17Loyalty program configuration: earn rate, tiers, expiryCRUD
107setup.onboarding.wizard.service5.20Tenant onboarding wizard: step tracking, initial data seedingStateful
108setup.integrations-hub.config.service5.16Integration connections configuration (Setup side of Module 6)CRUD

F.9 Module 6: Integrations – Service Breakdown (20 Services, CRUD+Audit ES)

BRD Sections: 6.1-6.13

F.9.1 Core Integration Infrastructure

#Service NameBRD Section(s)CapabilityPattern
109integration.provider.registry.service6.2Provider registration, IIntegrationProvider managementCRUD
110integration.circuit-breaker.service6.2Circuit breaker state machine (CLOSED/OPEN/HALF_OPEN) per providerStateful
111integration.outbox.relay.service6.2Transactional outbox polling, event publication via LISTEN/NOTIFYEvent Handler
112integration.idempotency.service6.2Idempotency key tracking for at-least-once deliveryStateful
113integration.webhook.pipeline.service6.2Inbound webhook receipt, signature validation, routingIntegration
114integration.dead-letter.service6.2Failed integration message capture, retry, replayEvent Handler

F.9.2 Shopify Integration

#Service NameBRD Section(s)CapabilityPattern
115integration.shopify.product-sync.service6.3Bidirectional product/variant sync via GraphQL, bulk operationsIntegration
116integration.shopify.inventory-sync.service6.3Inventory level sync with safety buffers, oversell preventionIntegration
117integration.shopify.order-sync.service6.3Online order ingestion, BOPIS flow, fulfillment updatesIntegration
118integration.shopify.webhook-handler.service6.3Shopify webhook processing: orders/create, products/update, etc.Event Handler

F.9.3 Amazon SP-API Integration

#Service NameBRD Section(s)CapabilityPattern
119integration.amazon.catalog-sync.service6.4Amazon catalog/listings management, compliance validationIntegration
120integration.amazon.order-sync.service6.4Amazon order polling (2-min interval), FBM fulfillmentIntegration
121integration.amazon.inventory-sync.service6.4Amazon inventory feed, FBA + FBM channel quantitiesIntegration

F.9.4 Google Merchant Integration

#Service NameBRD Section(s)CapabilityPattern
122integration.google.product-sync.service6.5Google Merchant product data feed, disapproval preventionIntegration
123integration.google.inventory-sync.service6.5Local inventory ads feed (2x/day batch)Integration

F.9.5 Cross-Platform Orchestration

#Service NameBRD Section(s)CapabilityPattern
124integration.cross-platform.validation.service6.6Strictest-rule-wins validation across all channelsRule Engine
125integration.cross-platform.inventory-orchestrator.service6.7Safety buffer computation, channel allocation, saga compensationStateful (Saga)

F.9.6 Payment, Email & Shipping

#Service NameBRD Section(s)CapabilityPattern
126integration.payment-processor.service6.8Payment processor gateway abstraction (Stripe, Square)Integration
127integration.email.service6.9Email sending via provider abstraction (SendGrid, SES)Integration
128integration.shipping.service6.10Carrier rate lookup, label generation, trackingIntegration

F.10 Cross-Cutting Services (8 Services)

These services satisfy architecture requirements from the Blueprint (Ch 07, Ch 14) rather than direct BRD business sections. They provide infrastructure that all modules depend on.

#Service NameBlueprint ReferenceCapabilityPattern
129crosscutting.event-store.serviceCh 07 L.4A.1Append events, optimistic concurrency, snapshot managementStateful
130crosscutting.tenant.middleware.serviceCh 07 L.10A.4Tenant resolution from JWT, RLS policy enforcementStateful
131crosscutting.auth.serviceCh 14JWT validation, PIN authentication, permission checksStateful
132crosscutting.audit-log.serviceCh 07 L.4ACross-cutting audit trail: who, what, when, before/afterEvent Handler
133crosscutting.notification.serviceCh 07Push notifications, in-app alerts, SignalR real-timeEvent Handler
134crosscutting.sync.orchestrator.serviceCh 07 L.10A.1Offline sync coordination: device registration, conflict resolutionStateful
135crosscutting.report.engine.serviceVariousSaved report execution, scheduling, export (CSV/PDF)Query
136crosscutting.state-machine.serviceCh 07 L.4ADatabase-driven state machine: validate transitions, log historyRule Engine

Optional: RFID Module (Raptag, 6 Services)

#Service NameBlueprint ReferenceCapabilityPattern
137rfid.config.crud.serviceCh 10 D13RFID tenant configuration (EPC prefix, serial counter)CRUD
138rfid.tag.crud.serviceCh 10 D13Tag lifecycle: create, activate, sell, transfer, voidCRUD
139rfid.printer.crud.serviceCh 10 D13Printer registration, status monitoringCRUD
140rfid.printjob.command.serviceCh 10 D13Print job queue management, progress trackingCommand
141rfid.scan.command.serviceCh 10 D13Scan session management: start, record reads, completeCommand
142rfid.inventory-reconciliation.serviceCh 10 D13Compare RFID scan results against expected inventoryCalculation

F.11 Module Dependency Matrix

F.11.1 Inter-Module Dependencies

Module 1 (Sales) --> Module 3 (Catalog):
  sale.cart.command.service --> catalog.product.query.service (lookup product/variant)
  sale.promotion.engine.service --> catalog.pricing.calculation.service (resolve price)
  sale.price-check.query.service --> catalog.product.query.service (read product)

Module 1 (Sales) --> Module 4 (Inventory):
  sale.finalize.command.service --> inventory.sale-deduction (via SaleCompleted event)
  sale.park.command.service --> inventory.reservation (soft-reserve on park)
  sale.void.command.service --> inventory.sale-deduction (via SaleVoided, restores)
  sale.return.command.service --> inventory.sale-deduction (via ReturnCompleted, restores)

Module 1 (Sales) --> Module 2 (Customers):
  sale.cart.command.service --> customer.profile.crud.service (attach customer)
  sale.loyalty.command.service --> customer.profile.crud.service (read loyalty)
  sale.payment.storecredit.service --> customer.profile.crud.service (check credit)

Module 1 (Sales) --> Module 5 (Setup):
  sale.tax.calculation.service --> setup.tax.crud.service (read tax rates)
  sale.shift.command.service --> setup.user.crud.service (validate employee)
  sale.cashdrawer.command.service --> setup.register.crud.service (validate register)

Module 1 (Sales) --> Module 6 (Integrations):
  sale.payment.card.service --> integration.payment-processor.service (card auth)
  sale.receipt.query.service --> integration.email.service (email receipt)

Module 3 (Catalog) --> Module 4 (Inventory):
  catalog.product.lifecycle.service --> inventory.level.query.service (check stock)

Module 4 (Inventory) --> Module 3 (Catalog):
  inventory.po.command.service --> catalog.vendor.crud.service (vendor details)
  inventory.reorder.engine.service --> catalog.product.query.service (product details)

Module 4 (Inventory) --> Module 5 (Setup):
  inventory.level.query.service --> setup.location.crud.service (location details)
  inventory.rules.engine.service --> setup.settings.crud.service (business rules)

Module 6 (Integrations) --> Module 3 (Catalog):
  integration.shopify.product-sync --> catalog.product.query.service (read products)
  integration.amazon.catalog-sync --> catalog.product.query.service (read products)
  integration.google.product-sync --> catalog.product.query.service (read products)
  integration.cross-platform.validation --> catalog.product.query.service (validate)

Module 6 (Integrations) --> Module 4 (Inventory):
  integration.shopify.inventory-sync --> inventory.level.query.service (read stock)
  integration.amazon.inventory-sync --> inventory.level.query.service (read stock)
  integration.google.inventory-sync --> inventory.level.query.service (read stock)
  integration.cross-platform.inventory-orchestrator --> inventory.level.query (allocate)

Module 6 (Integrations) --> Module 1 (Sales):
  integration.shopify.order-sync --> sale.finalize.command.service (create order)

Cross-Cutting --> All Modules:
  crosscutting.tenant.middleware.service --> ALL (RLS enforcement)
  crosscutting.auth.service --> ALL (permission checks)
  crosscutting.audit-log.service --> ALL (via event subscription)
  crosscutting.event-store.service --> Module 1, 4, 6 (ES-enabled modules)

F.11.2 Dependency Direction Rules

RuleDescription
AllowedModule 1 –> Module 2, 3, 4, 5 (sales orchestrates)
AllowedModule 6 –> Module 3, 4 (integrations read catalog/inventory)
AllowedModule 4 –> Module 3 (inventory references catalog)
ForbiddenModule 2 –> Module 1 (customers cannot call sales)
ForbiddenModule 3 –> Module 1 (catalog cannot call sales)
ForbiddenModule 5 –> Module 1, 2, 3, 4 (setup is pure configuration)
Event-OnlyModule 4 <– Module 1 (inventory reacts to sale events, not direct calls)

F.12 Service-to-BRD Traceability Matrix

Every BRD top-level section (x.y) maps to at least one service. Full bidirectional traceability:

Coverage Statistics

BRD ModuleSectionsServicesCoverage
Module 1: Sales (1.1-1.20)59 subsections37 services100%
Module 2: Customers (2.1-2.8)10 subsections7 services100%
Module 3: Catalog (3.1-3.15)48 subsections20 services100%
Module 4: Inventory (4.1-4.19)55 subsections23 services100%
Module 5: Setup (5.1-5.21)63 subsections21 services100%
Module 6: Integrations (6.1-6.13)28 subsections20 services100%
TOTAL263 subsections128 services100%

Orphaned Capabilities: None

All BRD sections 1.1-6.13 have at least one mapped service.

Architecture-Only Services (14)

Cross-cutting (#129-136) and RFID (#137-142) services are justified by Blueprint architecture requirements (Ch 07, Ch 10, Ch 14) rather than BRD sections.


F.13 CQRS Pattern Reference

F.13.1 When to Split Command/Query

CriterionSplit (CQRS)Keep Together (CRUD)
Write and read models differ significantlyYes
Audit trail required (Event Sourcing)Yes
Read-heavy with denormalized viewsYes (materialized projections)
Simple entity CRUD with no complex readsYes
Configuration dataYes

F.13.2 CQRS Event Flow

1. Client sends Command (e.g., CreateSaleCommand)
       |
       v
2. Command Handler validates business rules
       |
       v
3. Aggregate produces Domain Events (e.g., SaleCreated, SaleLineItemAdded)
       |
       v
4. Events appended to Event Store (events table)
       |
       +---> 5a. Projection Handlers update Read Models (materialized views)
       +---> 5b. Audit Log Handler writes to audit_log
       +---> 5c. Outbox Relay publishes to external subscribers
       +---> 5d. Integration Handler triggers sync (Module 6)
              |
              v
6. Query reads from optimized Read Model (not event store)

F.13.3 Domain Events Summary

AggregateModuleEvent Count
Sale1 (Sales)25
Return1 (Sales)5
Gift Card1 (Sales)4
Layaway/Hold1 (Sales)6
Cash Drawer1 (Sales)6
Inventory4 (Inventory)12
Customer2 (Customers)8
Employee5 (Setup)4
Integration6 (Integrations)10
TOTAL80

F.14 Folder Structure Reference (Technology-Agnostic)

src/
+-- modules/
|   +-- sales/
|   |   +-- commands/
|   |   |   +-- cart/
|   |   |   +-- checkout/
|   |   |   +-- payment/
|   |   |   +-- return/
|   |   |   +-- cash-drawer/
|   |   |   +-- gift-card/
|   |   |   +-- layaway/
|   |   |   +-- hold/
|   |   +-- queries/
|   |   +-- events/
|   |   +-- event-handlers/
|   |   +-- domain/
|   |   |   +-- aggregates/
|   |   |   +-- value-objects/
|   |   |   +-- rules/
|   |   +-- repositories/
|   |   +-- dtos/
|   |
|   +-- customers/
|   |   +-- commands/
|   |   +-- queries/
|   |   +-- domain/
|   |   +-- repositories/
|   |
|   +-- catalog/
|   |   +-- commands/
|   |   |   +-- product/
|   |   |   +-- variant/
|   |   |   +-- pricing/
|   |   |   +-- category/
|   |   |   +-- bulk-import/
|   |   +-- queries/
|   |   +-- domain/
|   |   +-- cache/
|   |
|   +-- inventory/
|   |   +-- commands/
|   |   |   +-- adjustment/
|   |   |   +-- purchase-order/
|   |   |   +-- receiving/
|   |   |   +-- transfer/
|   |   |   +-- count/
|   |   |   +-- reservation/
|   |   |   +-- fulfillment/
|   |   +-- queries/
|   |   +-- events/
|   |   +-- event-handlers/
|   |   +-- domain/
|   |
|   +-- setup/
|   |   +-- commands/
|   |   +-- queries/
|   |
|   +-- integrations/
|   |   +-- core/
|   |   |   +-- provider-registry/
|   |   |   +-- circuit-breaker/
|   |   |   +-- outbox-relay/
|   |   |   +-- idempotency/
|   |   |   +-- webhook-pipeline/
|   |   |   +-- dead-letter/
|   |   +-- providers/
|   |   |   +-- shopify/
|   |   |   +-- amazon/
|   |   |   +-- google/
|   |   |   +-- payment/
|   |   |   +-- email/
|   |   |   +-- shipping/
|   |   +-- orchestration/
|   |   +-- anti-corruption-layer/
|   |
|   +-- rfid/
|       +-- commands/
|       +-- queries/
|       +-- domain/
|
+-- cross-cutting/
|   +-- event-store/
|   +-- tenant/
|   +-- auth/
|   +-- audit/
|   +-- sync/
|   +-- notifications/
|   +-- reporting/
|   +-- state-machine/
|
+-- shared/
|   +-- domain/
|   +-- interfaces/
|   +-- infrastructure/
|
+-- api/
    +-- controllers/
    +-- startup/

F.15 Summary Statistics

MetricValue
BRD Modules6
Code Modules7 + cross-cutting + RFID
Total Services142
Module 1 (Sales)37 services
Module 2 (Customers)7 services
Module 3 (Catalog)20 services
Module 4 (Inventory)23 services
Module 5 (Setup)21 services
Module 6 (Integrations)20 services
Cross-Cutting8 services
RFID (Optional)6 services
Domain Events80
State Machines19
BRD Decisions Mapped107/107 (100%)
BRD Coverage100% (all sections mapped)
Orphaned Capabilities0

Service Pattern Distribution

PatternCount%
CRUD3524.6%
Command2819.7%
Query149.9%
Integration139.2%
Stateful128.5%
Event Handler107.0%
Rule Engine74.9%
Calculation53.5%
Other (Orchestrator, Saga)1812.7%
TOTAL142100%

Migration from Current Service Layer

The current Chapter 11 defines 5 coarse-grained services. This mapping decomposes them:

Current Service (Ch 14)Decomposed IntoCount
IOrderServicesale.cart.*, sale.park.*, sale.discount.*, sale.payment.*, sale.finalize.*, sale.void.*, sale.return.*, sale.exchange.*, sale.layaway.*, sale.hold-for-pickup.*, sale.giftcard.*, sale.receipt.*, sale.history.*23
IInventoryServiceinventory.level.*, inventory.po.*, inventory.receiving.*, inventory.transfer.*, inventory.count.*, inventory.rma.*, inventory.reservation.*, inventory.fulfillment.*23
ICustomerServicecustomer.profile.*, customer.search.*, customer.group.*, customer.merge.*, customer.privacy.*, sale.loyalty.*7
IItemServicecatalog.product.*, catalog.variant.*, catalog.search.*, catalog.bulk-import.*20
IReportServicecrosscutting.report.engine.service, sale.daily-summary.*, inventory.dashboard.*, catalog.analytics.*4
(new services)setup.*, integration.*, cross-cutting, RFID55

RFID Decisions (BRD v20.0, #108-113)

BRD v20.0 added 6 new decisions for the RFID Counting Subsystem:

#DecisionSummary
108RFID scope limited to counting onlyNo lifecycle tracking (sold_at, transferred_at stripped). Tag status limited to: active, void, lost
109EPC serial generation via PostgreSQL SEQUENCEPer-tenant SEQUENCE for serial numbers, not column-based last_serial_number
110Chunked sync with 5,000 events per chunkUNIQUE(session_id, epc) idempotency, resume via upload-status endpoint
111RSSI-based multi-operator dedupWhen multiple operators scan the same tag, highest RSSI wins for section assignment
112Auto-save with 30-second SQLite checkpointCrash recovery dialog, battery-triggered saves on Raptag mobile app
113Maximum 10 operators per counting sessionSection assignment per operator, session_operators join table

Related services: rfid.tag.crud.service, rfid.session.command.service, rfid.scan.command.service, rfid.sync.command.service, rfid.config.crud.service, rfid.encoding.command.service


Document Information

AttributeValue
Version5.0.0
Created2026-02-24
Updated2026-02-25
AuthorClaude Code
StatusActive
SectionAppendix F
BRD Version20.0

This appendix is part of the POS Blueprint Book. All content is self-contained.