Arquitectura de Datos

Data Mesh: Its Relationship with Domain-Driven Design and Bounded Contexts, How to Organize Data Around the Business

Learn how Domain-Driven Design strategic patterns (Ubiquitous Language, Bounded Contexts, and Context Mapping) guide the identification of data domains and data products in Data Mesh, avoiding the single enterprise model fallacy and the mechanical 1:1 mapping of microservices to analytics.

Content explored 0%
18px

The indicator keeps the furthest percentage explored; marking the article complete is your choice.

When the Word "Order" Means Three Different Things in the Same Company

At CommerceFlow, the executive leadership team asks for a seemingly simple number for the monthly close: "How many completed orders did we have in October, and what was their total value?"

Three teams query the data and walk into the meeting with three different numbers:

  • The Sales domain team reports 120,400 orders: in their world, an order is completed the moment the shopper clicks "Place Order" and locks in a promotional price.
  • The Payments domain team reports 114,850 orders: in their vocabulary, a transaction only counts as valid once the payment gateway settles funds in the bank net of automated fraud reversals.
  • The Inventory domain team reports 118,100 orders: in warehouse terminology, a completed order is one whose physical units have been picked, packed, and deducted from shelf stock—even if a single customer checkout had to be split into two separate warehouse shipments.

To "fix" the discrepancy once and for all, a well-meaning architect proposes creating a single massive table called enterprise_master_order with 190 columns where every team writes its statuses. Two months later, the table is unmaintainable: it contains columns named status_1, payment_status_real, and warehouse_order_flag, nobody knows which team is responsible when a metric breaks, and artificial intelligence models predicting product returns accidentally mix failed payment authorizations with actual fulfilled sales.

This failure is not caused by SQL syntax or storage hardware. It is a failure of semantic boundaries. And it is the exact territory where strategic Domain-Driven Design (DDD)—originally formulated by Eric Evans and explicitly adopted by Zhamak Dehghani as the foundation for domain boundaries in Data Mesh—gives us the tools to organize analytical data around the business without falling for the illusion of a single universal enterprise data model.

When software engineers and data architects collaborate, they often use the words "domain," "context," and "product" interchangeably. In a Data Mesh architecture grounded in Domain-Driven Design, distinguishing these five concepts prevents costly modeling mistakes:

  1. Domain (Business Domain): The overall sphere of knowledge and activity in which the organization operates. For CommerceFlow, the overarching business domain is retail e-commerce.
  2. Subdomain: A specific area of business capability or problem space within that overarching domain. DDD distinguishes Core subdomains (where competitive advantage lives, such as pricing and conversion optimization in Sales), Supporting subdomains (such as stock allocation in Inventory), and Generic subdomains (such as standard payment gateway integration). (If you want to explore these concepts deeper in operational software, see our dedicated Domain-Driven Design series).
  3. Bounded Context: Belongs to the solution space. It is an explicit semantic, functional, and team boundary within which every term in the domain model—the Ubiquitous Language—has a single, unambiguous meaning. Inside the Sales Bounded Context, "Order" means one exact concept; inside the Inventory Bounded Context, "Stock Allocation" means another.
  4. Data Domain: In Data Mesh, the organizational and architectural unit that takes accountability for producing, governing, and maintaining the analytical datasets corresponding to a business area. It typically aligns with a Bounded Context (or a cohesive group of closely related Bounded Contexts), extending team ownership from operational software into the analytical plane.
  5. Data Product: The concrete, autonomous, documented, and governed analytical asset that a Data Domain exposes to the rest of the organization through stable output ports (for example, sales-orders, confirmed-payments, or inventory-availability).
ConceptWhere It LivesCore Question It AnswersExample at CommerceFlow
DomainOverall businessWhat business is the organization in?Retail e-commerce
SubdomainProblem spaceWhich specific business capability are we addressing?Checkout conversion, Payment settlement, Stock control
Bounded ContextSolution spaceWithin what boundary does this model and vocabulary hold a single unambiguous meaning?Sales Context, Payments Context, Inventory Context
Data DomainData Mesh organizationWhich domain team owns and governs these analytical datasets?Sales Data Domain, Payments Data Domain
Data ProductPublished analytical interfaceWhich governed dataset with an explicit SLA can external consumers query?sales-orders, confirmed-payments, inventory-availability

Ubiquitous Language: Why Forcing a Single Global Model Distorts Reality

The principle of Ubiquitous Language states that software engineers, domain experts, and data practitioners working inside a Bounded Context should use the exact same terms in conversations, application code, and data schemas.

Whenever a central team tries to enforce a single monolithic "Order" or "Customer" table across the entire company, they end up inventing an artificial dialect that no business unit truly recognizes. Conversely, when we respect CommerceFlow's Bounded Contexts, we see that each domain legitimately models a different facet of reality.

Look at how the same real-world purchase event is modeled with distinct responsibilities and vocabulary across the internal operational TypeScript interfaces of our three Bounded Contexts:

// Educational snippet: Internal operational models across three distinct Bounded Contexts.
// Notice how the same real-world event (a purchase) is modeled with different responsibilities
// and Ubiquitous Language in each context.

// 1. Bounded Context: SALES
// Business focus: Capture buyer intent, apply promotions, and lock commercial pricing.
export interface SalesOrderOperational {
  readonly orderId: string;           // Canonical global order identifier
  readonly buyerCustomerId: string;
  readonly checkoutCompletedAt: string;
  readonly appliedPromoCodes: string[];
  readonly orderLifecycleState: 'CHECKOUT_CONFIRMED' | 'CANCELLED_BY_BUYER';
  readonly lines: Array<{
    readonly productSku: string;
    readonly quantityOrdered: number;
    readonly unitPriceAfterDiscountUsd: number;
  }>;
}

// 2. Bounded Context: PAYMENTS
// Business focus: Authorize, capture, settle real funds, and manage fraud/refunds.
// Notice Payments knows nothing about promotional cart coupons or physical warehouse shelves.
export interface PaymentTransactionOperational {
  readonly paymentTransactionId: string;
  readonly orderId: string;           // Reference to the originating order
  readonly gatewayProvider: 'STRIPE' | 'ADYEN' | 'LOCAL_BANK';
  readonly attemptNumber: number;     // Internal: technical gateway retry counter
  readonly capturedGrossUsd: number;
  readonly gatewayFeeUsd: number;
  readonly refundedAmountUsd: number;
  readonly settlementStatus: 'AUTHORIZED_ONLY' | 'SETTLED_IN_BANK' | 'CHARGEBACK_LOST';
  readonly settledAtUtc: string | null;
}

// 3. Bounded Context: INVENTORY
// Business focus: Physical warehouse availability, temporary reservations, and shrinkage.
// Notice Inventory knows nothing about payment gateways or promotional discounts.
export interface WarehouseSkuStockOperational {
  readonly warehouseId: string;
  readonly productSku: string;
  readonly physicalUnitsOnShelf: number;
  readonly reservedUnitsInActiveCarts: number;
  readonly damagedBlockedUnits: number; // Internal: unsellable damaged goods
  readonly lastInventoryCountAt: string;
}

Comparing the glossary across domains reveals why internal operational structures should never be dumped raw into a shared analytical store without translation:

Informal Conversational TermMeaning in Sales Ubiquitous LanguageMeaning in Payments Ubiquitous LanguageMeaning in Inventory Ubiquitous Language
"Order Amount"Sum of discounted prices committed to the buyer at checkout (committed_sale_amount_usd)Net money actually settled in the bank after gateway fees and refunds (net_settled_amount_usd)Replacement cost of physical merchandise (or not applicable at all)
"Successful Operation"Buyer confirmed checkout (CHECKOUT_CONFIRMED)Funds settled irrevocably in bank (SETTLED_IN_BANK)Reserved units allocated from sellable shelf stock without stockout
"Internal Detail That Must Not Leak Outside"Abandoned draft carts or transient session stateGateway retry counters (attemptNumber) and payment tokensDamaged bin counts (damagedBlockedUnits) and internal aisle transfers

Why a Bounded Context Does NOT Map Mechanically 1:1 to a Data Product or Microservice

Once teams see the natural alignment between Domain-Driven Design and Data Mesh, they often fall into a dangerous trap: assuming a rigid 1:1 mapping between technical artifacts.

Keep three practical design rules in mind:

  1. A microservice is NOT a Data Product: Inside the Sales Bounded Context, four microservices might collaborate (cart-service, pricing-engine, coupon-validator, and order-orchestrator), each with its own internal database or cache. If every microservice exposed its internal table as a "data product," analytical consumers would be forced to reassemble internal Sales implementation details. Instead, the Sales data domain encapsulates those four microservices and publishes a cohesive, business-meaningful data product: sales-orders.
  2. A Bounded Context may publish zero, one, or multiple Data Products: A purely technical utility context (such as a push-notification dispatcher) might publish zero analytical data products. Conversely, a core domain like Sales might publish both sales-orders (detailed confirmed orders) and customer-conversion-funnels if they serve distinct analytical consumers and SLAs.
  3. Logical domain boundaries do not require physical infrastructure fragmentation: Having separate Sales, Payments, and Inventory data domains does not mean each team must run its own cloud account or query cluster. All three can publish their data products onto a shared Self-Serve Data Platform (for instance, tables registered in AWS Glue, stored in Amazon S3, governed with AWS Lake Formation, and queried through Amazon Athena), while preserving strict semantic and ownership boundaries.
           INSIDE THE "SALES" BOUNDED CONTEXT (Private to the domain)
┌───────────────────────────────────────────────────────────────────────────┐
│  [cart-service] ──> [pricing-service] ──> [order-service]                 │
│  (Internal Redis)   (Rule tables)         (Operational PostgreSQL)        │
│                                                    │                      │
│                           Curated & transformed by the Sales domain       │
│                                                    ▼                      │
│                                    ┌───────────────────────────────┐      │
│                                    │ Published Data Product:       │      │
│                                    │ sales_dp.sales_orders         │      │
│                                    └───────────────┬───────────────┘      │
└────────────────────────────────────────────────────┼──────────────────────┘
                                                     │ Stable contract
                                                     ▼
                                     [Downstream Consumers in the Mesh]

End-to-End Practical Example: Designing CommerceFlow's Domains and Data Products

Let us apply Context Mapping from DDD to design how Sales, Payments, and Inventory structure their data products and how they resolve cross-domain concepts like "Paid Order."

Step 1: Producer and Consumer Context Map

In Domain-Driven Design, when separate Bounded Contexts need to exchange information without polluting each other's internal models, they establish a Published Language: an explicit, minimal, stable contract for communication. In Data Mesh, the public schema of each Data Product and the global identifiers agreed upon in federated governance act as that Published Language:

┌─────────────────────────────┐      ┌─────────────────────────────┐      ┌─────────────────────────────┐
│ Domain: SALES               │      │ Domain: PAYMENTS            │      │ Domain: INVENTORY           │
│                             │      │                             │      │                             │
│ Data Product:               │      │ Data Product:               │      │ Data Product:               │
│ sales_dp.sales_orders       │      │ payments_dp.                │      │ inventory_dp.               │
│                             │      │ confirmed_payments          │      │ inventory_availability      │
│ Public IDs:                 │      │                             │      │                             │
│ • order_id                  │      │ Public IDs:                 │      │ Public IDs:                 │
│ • product_sku               │      │ • payment_id                │      │ • product_sku               │
│ • customer_id               │      │ • order_id                  │      │ • snapshot_date             │
└──────────────┬──────────────┘      └──────────────┬──────────────┘      └──────────────┬──────────────┘
               │                                    │                                    │
               └────────────────────────────────────┼────────────────────────────────────┘
                                                    │
                        Customer-Supplier / Published Language (Canonical Global IDs)
                                                    ▼
                     ┌──────────────────────────────────────────────────────────────┐
                     │ Analytical Consumers / AI Pipelines / Finance Reporting      │
                     │ Compose the "Paid Orders with Stock Availability" view       │
                     │ by joining public contracts without internal model coupling  │
                     └──────────────────────────────────────────────────────────────┘

Step 2: Contrasting Semantic Coupling with Domain-Aligned Data Products

First, consider what happens when Bounded Context boundaries are violated: the Sales team tries to add an is_paid_by_bank boolean inside its own table by reading an initial gateway webhook or sneaking a read against an internal Payments table:

-- ANTI-PATTERN: Violating Bounded Context boundaries.
-- The Sales domain attempts to assert whether an order has settled in the bank,
-- unaware of subsequent bank reversals, chargebacks, or fraud holds owned by Payments.

SELECT
    order_id,
    customer_id,
    order_total_usd,
    -- Domain boundary bug: Sales assumes an initial authorization code means settled cash.
    CASE WHEN initial_gateway_auth_code IS NOT NULL THEN TRUE ELSE FALSE END AS is_paid
FROM sales_internal.orders_table;

When Finance relies on that is_paid column published by Sales, it books revenue for thousands of orders whose payment authorizations later expired or were reversed inside the Payments domain.

Now compare the DDD and Data Mesh aligned solution, where each domain publishes only the business facts over which it holds true semantic authority:

  1. Sales publishes sales_dp.sales_orders: Reports which orders were confirmed by buyers, which product_sku items were ordered, and the committed sale price (committed_sale_amount_usd). It makes zero claims about bank settlement.
  2. Payments publishes payments_dp.confirmed_payments: Reports which orders (order_id) have irrevocably settled funds (settlement_status = 'SETTLED'), the settlement timestamp, and the true net settled amount (net_settled_amount_usd).
  3. Inventory publishes inventory_dp.inventory_availability: Reports by product_sku and date how many sellable units (sellable_available_units) exist after subtracting active reservations and internal warehouse damage.

When a downstream consumer (such as Finance, a Machine Learning feature pipeline, or a consumer-aligned data product) needs the composite concept of "Paid Order," it joins the authoritative public contracts of Sales and Payments explicitly:

-- DDD BOUNDED CONTEXT & DATA MESH ALIGNED DESIGN:
-- Each domain exposes only the authoritative truth of its Bounded Context.
-- The composite concept of "Paid Order with Stock Context" is assembled
-- by joining public Data Products via canonical global identifiers (order_id, product_sku).

SELECT
    so.order_id,
    so.order_date,
    so.customer_id,
    so.product_sku,
    so.quantity_ordered,
    so.committed_sale_amount_usd AS sales_committed_amount_usd,
    cp.payment_id,
    cp.net_settled_amount_usd AS payments_net_settled_usd,
    cp.settled_at_utc,
    ia.sellable_available_units AS current_sellable_stock
FROM sales_dp.sales_orders so
INNER JOIN payments_dp.confirmed_payments cp
    ON so.order_id = p_order_id_alias.order_id -- joined on canonical order_id
LEFT JOIN inventory_dp.inventory_availability ia
    ON so.product_sku = ia.product_sku
   AND so.order_date = ia.snapshot_date
WHERE so.order_lifecycle_state = 'CHECKOUT_CONFIRMED'
  AND cp.settlement_status = 'SETTLED'
  AND so.order_date >= DATE '2026-10-01';

Let us write the exact executable SQL join cleanly without aliases that could confuse a parser:

-- Clean executable SQL joining the three domain Data Products:
SELECT
    so.order_id,
    so.order_date,
    so.customer_id,
    so.product_sku,
    so.quantity_ordered,
    so.committed_sale_amount_usd AS sales_committed_amount_usd,
    cp.payment_id,
    cp.net_settled_amount_usd AS payments_net_settled_usd,
    cp.settled_at_utc,
    ia.sellable_available_units AS current_sellable_stock
FROM sales_dp.sales_orders so
INNER JOIN payments_dp.confirmed_payments cp
    ON so.order_id = cp.order_id
LEFT JOIN inventory_dp.inventory_availability ia
    ON so.product_sku = ia.product_sku
   AND so.order_date = ia.snapshot_date
WHERE so.order_lifecycle_state = 'CHECKOUT_CONFIRMED'
  AND cp.settlement_status = 'SETTLED'
  AND so.order_date >= DATE '2026-10-01';

Notice what this separation achieves:

  • If Payments introduces a new rule for international wire holds tomorrow, it updates only the internal transformation feeding payments_dp.confirmed_payments.
  • If Inventory changes how it tracks damaged pallets in its warehouses, it updates only how sellable_available_units is computed in inventory_dp.inventory_availability.
  • No domain encroaches on another domain's business logic, and every consumer knows the exact meaning and owner of each field.

Step 3: Cross-Domain Semantic Integrity Assertions

To ensure that context relationships (Context Mapping) do not drift over time—for instance, Payments emitting confirmed payments with a malformed order_id that does not match any order published by Sales—the platform runs automated cross-context integrity assertions without coupling operational databases:

-- Cross-domain semantic interoperability assertion between Payments and Sales Data Products:
-- Detects confirmed payment records whose order_id does not exist in the published
-- Sales orders product (context orphans).

SELECT
    cp.payment_id,
    cp.order_id,
    cp.settled_at_utc
FROM payments_dp.confirmed_payments cp
LEFT JOIN sales_dp.sales_orders so
    ON cp.order_id = so.order_id
WHERE so.order_id IS NULL
  AND cp.settled_at_utc >= CURRENT_TIMESTAMP - INTERVAL '24' HOUR;

Three Real-World Scenarios with Different Domain Boundary Decisions

Let us see how strategic DDD principles guide different boundary choices across industries.

Scenario 1: Professional Online Learning Platform (One Person, Three Distinct Domain Meanings)

  • Context: An education platform operates three Bounded Contexts: IdentityAndBilling (paid subscriptions), CourseDelivery (video and lesson progress), and Certification (proctored official exams).
  • Initial problem: They built a single analytics.users table where the column status = 'ACTIVE' sometimes meant "has an active paid billing plan," other times "watched a lesson this week," and other times "holds an unexpired certificate." Retention reports contradicted each other constantly.
  • DDD & Data Mesh decision: Align data products with each Bounded Context's authority while sharing the canonical student_id:
    • IdentityAndBilling publishes billing_dp.active_subscriptions (authoritative owner of Subscriber).
    • CourseDelivery publishes learning_dp.student_engagement (authoritative owner of Active Learner).
    • Certification publishes certification_dp.issued_credentials (authoritative owner of Certified Professional).
  • Key takeaway: Naming data products and columns after each context's specific Ubiquitous Language eliminates the ambiguity of overloaded words like active or status.

Scenario 2: Freight Trucking Operator (When to Group Multiple Microservices into One Data Domain)

  • Context: The fleet maintenance department at a logistics company runs three small microservices maintained by the same six-person team: tire-sensor-service, engine-diagnostics-service, and workshop-schedule-service.
  • Architectural question: The team wonders whether they must create three separate data domains and three catalog namespaces to mirror their three microservices 1:1.
  • Recommended decision: Do not fragment. All three microservices share the same Ubiquitous Language, the same owning team, and solve a single business capability (Preventive Fleet Maintenance). They belong to a single Data Domain (FleetMaintenance) and should publish one cohesive data product (fleet_maintenance_dp.vehicle_health_status) that hides the internal microservice split.

Scenario 3: Hotel Booking System Running a Modular Monolith (DDD + Data Mesh Without Microservices)

  • Context: A hotel group runs its entire core platform as a modular PostgreSQL monolith, cleanly separated internally into three modules with isolated database schemas: reservations, front_desk_checkin, and housekeeping. Three dedicated engineering teams maintain these modules.
  • Recommended decision: Even though operational deployment is a single monolith sharing one relational database instance, the three modules already represent clear Bounded Contexts with distinct team ownership. Each team can publish its own analytical data product (reservations_dp.bookings, frontdesk_dp.stays, housekeeping_dp.room_readiness) to the shared analytical platform on Amazon S3 / Amazon Athena without first breaking the monolith into microservices.

Common Pitfalls When Combining DDD and Data Mesh (and How to Avoid Them)

Common PitfallWhy It HappensSound Engineering Remedy
The Totalitarian "Enterprise Canonical Model"Trying to force a single giant Customer or Order schema across every domain in the company.Standardize only minimal global identifiers (customer_id, order_id) and let each domain publish its own attributes in its Ubiquitous Language.
Orphaned or 50/50 Shared OwnershipDeclaring two domains (Sales and Payments) "co-owners" of the exact same analytical table.When two teams co-own a table, neither is truly accountable. Every data product must have one clear owning domain.
Exposing Raw ORM/Database Tables (Anemic Dump)Copying internal microservice tables verbatim into the analytical catalog.Design the data product output port as a consumer-oriented contract that hides join tables and transient operational states.
Mirroring Political Org Charts Instead of Business CapabilitiesRedrawing data domains every time management reorganizes reporting lines.Anchor data domains to durable business capabilities (Sales, Payments, Inventory) that outlive reporting-line shuffles.

Practical AI Prompts to Apply Strategic DDD to Your Data Architecture

Use these two prompts to uncover Ubiquitous Language collisions and design clean domain data product boundaries.

Prompt 1: Uncovering Semantic Collisions in Ubiquitous Language Across Domains

Act as an expert in Domain-Driven Design (DDD) and Data Mesh architecture. I need to identify semantic collisions (terms that share the same name but mean different things across teams) in my organization before defining our Data Products.

Organization context:
- Domains or teams involved: [E.G., Sales, Payments, Inventory, Customer Support]
- Overloaded terms currently causing conflicting reports: [E.G., "Completed Order", "Active Customer", "Net Revenue", "Available Product"]
- How each area currently calculates or interprets those terms: [DESCRIBE THE OBSERVED DIFFERENCES]

Constraints:
- Do not force a single artificial definition if each domain legitimately requires its own operational concept.
- Apply Bounded Context, Ubiquitous Language, and Published Language principles.

Expected output:
1. A disambiguated glossary assigning precise, expressive names to each concept within its owning Bounded Context (avoiding vague terms like "status" or "total").
2. Which domain should be the authoritative owner of each business fact in its Data Product.
3. Which canonical global identifiers should act as the Published Language bridge to join those products safely.

What a human must verify when reviewing the output: Validate the proposed vocabulary with real domain experts in finance, operations, and product to ensure the names match how the business actually reasons about its operations.

Prompt 2: Mapping Operational Bounded Contexts to Data Products Without 1:1 Microservice Cloning

Act as a software and data architect. I want to design the initial Data Products for a specific business domain starting from its existing operational services and tables, without leaking internal implementation details.

Domain context:
- Bounded Context / Domain name: [E.G., Inventory]
- Internal microservices or modules inside this domain today: [LIST SERVICES AND OPERATIONAL TABLES]
- Analytical questions or AI models downstream teams need to answer using data from this domain: [DESCRIBE CONSUMER USE CASES]

Constraints:
- Do not create one Data Product per microservice, and do not expose technical internal tables (retry queues, locks, temporary staging).
- Clearly separate the internal operational model from the public Data Product contract.

Expected output:
1. Which internal tables or events must remain strictly private inside the Bounded Context.
2. Proposal for 1 or 2 cohesive Data Products aligned with consumer use cases, including their proposed public SQL schema.
3. Context Map summary showing what this domain produces and which global identifiers it shares with peer domains.

What a human must verify when reviewing the output: Confirm that the proposed data product schema can remain stable even if the domain team later refactors, merges, or replaces its internal microservices.

Application Exercises

Work through these three practical scenarios using Bounded Contexts, Ubiquitous Language, and Data Product boundaries.

Exercise 1: Decoupling a Contaminated Analytical Model

At CommerceFlow, a developer in the Inventory domain is asked to add the dollar profit margin of each available unit directly into the inventory_dp.inventory_availability data product. To ship quickly, the developer configures the Inventory pipeline to read the internal pricing_rules_internal table from the Sales operational database and the supplier_invoices_raw table from Procurement. Two weeks later, Sales refactors its volume discount tables, and Inventory's daily data product pipeline crashes completely.

Question: From a Bounded Context and Data Mesh perspective, which boundary was violated here, and how should this business need be solved while respecting domain authority?

Exercise 2: How Many Data Products Should We Publish?

CommerceFlow's Payments domain internally runs five microservices: card-tokenizer, fraud-scoring-engine, gateway-retry-worker, settlement-reconciler, and refund-processor. Kicking off their Data Mesh adoption, an engineer proposes: "Since we have five microservices in Payments, DDD says we should publish exactly five Data Products in the catalog: one with card tokens, one with internal fraud scores, one with the retry queue, one with settlements, and one with refunds."

Question: Evaluate the engineer's proposal. What security and coupling problems would it create, and what alternative design would you recommend for the Payments domain?

Exercise 3: Resolving the "Customer" Identity Collision Across Domains

On an e-commerce platform, when an anonymous visitor browses products, the Marketing domain tracks them using an anonymous_cookie_id. When they check out as a guest, the Sales domain records a checkout_guest_email. When they eventually register a permanent account and save a payment method, the CustomerIdentity domain assigns a registered_account_id. Today, all three domains name their column simply customer_id, causing cross-domain SQL joins to fail or return empty results.

Question: Using Ubiquitous Language and cross-context identifier governance, how would you rename and structure these entities across data products so analysts can measure the full conversion funnel without lying about what each identifier represents?


Reasoned Solutions

Solution to Exercise 1

The Bounded Context encapsulation boundary was violated: the Inventory domain reached into the private operational tables of two other domains (Sales and Procurement) and took on responsibility for calculating a financial metric ("profit margin") outside warehouse authority and Ubiquitous Language.

The sound solution is:

  1. Inventory restricts inventory_dp.inventory_availability strictly to warehouse facts over which it holds authority: physical, reserved, and sellable units by product_sku.
  2. Sales publishes its official pricing data product by SKU, and Procurement publishes validated unit acquisition costs by SKU.
  3. The composite financial margin metric is computed by joining those three public data products through their stable contracts (either inside the Finance domain or in a dedicated downstream analytical data product), without Inventory ever reading private Sales tables.

Solution to Exercise 2

The engineer's proposal confuses internal microservice topology with Data Product design.

  • Problems it would cause: Exposing card-tokenizer as an analytical dataset would create a severe security and compliance violation (PCI-DSS); exposing gateway-retry-worker would couple analytical consumers to low-level technical retry queues that carry no business meaning.
  • Recommended design: Keep the five microservices as private implementation details inside the Payments Bounded Context. Design public data products around consumer business needs: for example, a primary payments_dp.confirmed_payments product (which already reconciles settlements and refunds in clean financial language) and, if risk analytics teams require it, a second governed product payments_dp.fraud_risk_assessments—never exposing card tokens or retry queues.

Solution to Exercise 3

The bug stems from using the overloaded name customer_id for three distinct concepts across three Bounded Contexts. Applying Ubiquitous Language and Context Mapping:

  1. In the Marketing data product, name the field explicitly visitor_tracking_id.
  2. In the Sales data product, expose buyer_email_hash (governed by PII hashing rules) alongside the canonical customer_account_id (nullable for guest checkouts).
  3. Have the CustomerIdentity domain—the authoritative owner of user accounts and identity resolution—publish both the registered account master (customer_account_id) and an identity-link data product (identity_dp.customer_identity_links) that maps which visitor_tracking_id sessions and guest checkouts later resolved to a registered customer_account_id.

Decision Criteria for Applying What You Learned and Final Summary

When organizing data domains and data products in your organization, apply these practical criteria:

  • Use DDD Bounded Contexts as your starting map: Look for where business vocabulary, validation rules, and team ownership shift; wherever two teams define "order," "payment," or "active user" differently, you have distinct contexts that should not share an unmediated internal table.
  • Protect the boundary between operational models and Data Products: Never expose raw transactional database tables directly as analytical products; translate internal context state into a stable, consumer-oriented public contract.
  • Do not blindly mirror microservices or org charts: Group data products around cohesive, durable business capabilities, maintaining cross-domain interoperability through shared canonical identifiers (Published Language).

With this fifth article, we complete the foundational block of our Data Mesh series: we now understand what Data Mesh is, how it evolved from earlier storage architectures, how its four principles balance one another, how it compares and combines with Data Lakehouse and Data Fabric, and how Domain-Driven Design helps us draw clean semantic boundaries around the business. Starting in the next article, we will dive deep into the first of the four pillars: Domain-Oriented Data Ownership.

Loading conversation…

Keep learning