Scrivio Interview library
DesignAdvanced6 min read · updated 12 November 2026

Several teams each own a part of the customer data (identity, billing, support, marketing) in separate services and databases. How do you model 'customer' across the organization without one shared customer table?

Let each bounded context, identity, billing, support and marketing, keep its own model of customer with only the attributes it needs, and share a stable global customer id rather than a table. Give every attribute one system of record (email belongs to identity, for example), propagate changes to the other contexts as events published through an outbox, build the customer 360 view downstream in the warehouse, and govern identifiers, merges and deletion centrally so that, for instance, a GDPR erasure reaches every context.

Why this question is asked

Customer is the entity every team thinks it owns. A shared customer table looks like the obvious way to stay consistent, but it couples every service to one schema, one database and one release schedule, and soon nobody can change a column. Interviewers ask this at senior level to see whether we can keep data consistent enough without central coupling, and whether we remember the hard parts: ownership per attribute, propagation, merges and deletion. In this answer, we will recap bounded contexts, give each context its own customer, define systems of record, propagate changes with the outbox pattern, place the 360 view, and govern identifiers and erasure.

1A Quick Recap of Bounded Contexts

A bounded context, an idea from domain-driven design, is a part of the business where a word has one precise meaning and one team owns the model. Customer means different things in different contexts. To identity, it is a person who signs in, with an email and credentials. To billing, it is a payer with a tax id, currency and payment method. To support, it is someone with tickets and a service level. To marketing, it is a profile with consents and segments.

Forcing these into one table produces the overloaded wide table we see in many legacy systems. Accepting that each context has its own customer model is not duplication but precision, provided the contexts agree on who the customer is.

2A Shared Id, Not a Shared Table

What the contexts must share is identity: a global customer id, created once, typically by the identity context when a customer signs up, and never reused or changed. Every context stores that id with its own attributes, so any two contexts can talk about the same customer without sharing storage.

SQL
-- identity service database
CREATE TABLE customer (customer_id uuid PRIMARY KEY, email text NOT NULL UNIQUE, created_at timestamptz NOT NULL);
-- billing service database
CREATE TABLE billing_customer (customer_id uuid PRIMARY KEY, tax_id text, currency char(3) NOT NULL,
invoice_email text NOT NULL);
-- support service database
CREATE TABLE support_customer (customer_id uuid PRIMARY KEY, tier text NOT NULL, display_name text);

Notice that billing has its own invoice_email. That is legitimate when invoices go to an accounts department, and it shows why attribute ownership must be explicit: is invoice_email a copy of the login email, or a separate fact owned by billing?

3One System of Record per Attribute

For every shared attribute we name exactly one owning context, the system of record. Login email belongs to identity. Legal name and tax id belong to billing. Marketing consent belongs to marketing, or to a consent service. Other contexts may keep copies for their own use, but they never edit them; they receive updates from the owner.

Copies are eventually consistent, so we state staleness expectations. Support seeing an email change within a minute is fine; billing using an old tax id on an invoice may not be, so billing owns that field itself. Writing this down as a small ownership table, attribute, owner, consumers, and acceptable delay, turns arguments into decisions.

Who owns which customer attribute
AttributeSystem of recordCopied toStaleness
login emailIdentitySupport, Marketingunder 1 minute
legal name, tax idBillingSupportminutes
marketing consentMarketing / consentBilling (emails)seconds, legally sensitive
support tierSupportnobody-

4Propagating Changes With an Outbox

When identity changes an email, it publishes a CustomerEmailChanged event. The naive way, update the database then send to Kafka, can lose events: the commit succeeds and the process crashes before the send, or the send succeeds and the transaction rolls back. The outbox pattern fixes that. The service writes the change and an event row into an outbox table in the same local transaction, and a relay, for example Debezium reading the outbox through change data capture, publishes the row afterwards.

Step throughEmail change through the outbox
Identity serviceIdentity DBOutbox relayKafkaSupport service
UPDATE customer + INSERT outbox row, one transaction
read new outbox row (CDC)
publish CustomerEmailChanged v7
deliver event
apply if version > stored version
commit offset

6 messages in order. Play them, or step through them one at a time.

Consumers must be idempotent, because an event can arrive more than once, and should apply changes by version or timestamp so a late, older event does not overwrite a newer one. The event log also gives auditors a history of every change to customer data.

5The 360 View Belongs Downstream

Leadership often asks for a single customer view. That view is valuable for analytics and for support agents, but if it becomes an operational service that every other service calls synchronously, we have rebuilt the shared table with extra network hops, and its outage stops everyone.

So the customer 360 is built downstream, in the warehouse or a read-only search index, by consuming the same events and data from each context, joined on the global id. It may be minutes behind, which is fine for its purpose, and it can be rebuilt from the sources at any time.

6Governing Identifiers, Merges and Deletion

Some decisions must be central even when schemas are not. How global ids are minted and never reused. How duplicates are detected and merged. How deletion and erasure work. A GDPR erasure request must reach every context, including copies, caches, the warehouse and backups policy, so we publish a CustomerErasureRequested event and require each context to confirm completion, tracked by a central register with a deadline, since the regulation expects a response within a month.

Teams then evolve their own schemas freely, adding columns or restructuring tables, as long as they honour the shared id, the ownership table and the event contracts.

7Follow-up questions

How do you handle merging two duplicate customers?

Choose a surviving id, usually the older or the more complete record, and publish a CustomersMerged event naming the survivor and the retired id. Each context merges its own data, moving orders, tickets and consents to the survivor according to its own rules, and keeps the retired id as an alias so late events and old links still resolve. The identity context records the alias permanently, never reuses the retired id, and merges are reviewed for conflicts such as two different tax ids.

Why not let services read each other's customer tables directly?

Then the owning team can no longer change its schema without breaking others, and an outage or slow query in one database spreads across services. Events and APIs are contracts that can be versioned; another team's table is not.

What if a context needs an attribute synchronously, such as a fresh email for a password reset?

Then it should ask the owner through an API at that moment, rather than trust its copy. Copies serve display and reporting; decisions that need the latest truth go to the system of record.

8Conclusion

In this answer, we gave each bounded context its own customer model with only the attributes it needs, shared a stable global customer id instead of a table, named one system of record per attribute with explicit staleness, propagated changes reliably with an outbox and idempotent consumers, built the 360 view downstream in the warehouse, and governed ids, merges and erasure centrally while letting teams evolve their schemas.

What to say in the interviewAbout 90 seconds aloud

Open with

I would accept that customer means different things in identity, billing, support and marketing, and let each bounded context own its own customer model with only the attributes it needs.

Then, if they want more

What they share is a stable global customer id, minted once, usually by identity at sign-up, and never reused. Then I would make ownership explicit per attribute: login email belongs to identity, legal name and tax id to billing, consent to marketing or a consent service.

Other contexts may hold copies, but they never edit them, and we agree how stale each copy may be. Changes propagate as events like CustomerEmailChanged, published through a transactional outbox so the database change and the event cannot diverge, with a CDC relay such as Debezium, and consumers that are idempotent and apply changes by version.

When a context needs the freshest value for a decision, it calls the owner's API instead of trusting its copy. The customer 360 view leadership wants is built downstream in the warehouse or a search index from those events, not as an operational service every request depends on.

Finally, a few things stay central: how ids are minted, how duplicates are merged with alias ids, and deletion, so a GDPR erasure request is published to every context and each one confirms completion. Inside those rules, teams evolve their schemas independently.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Several teams each own a part of the customer data (identity, billing, support...": https://scrivio-interview-library.netlify.app/databases/data-modeling/ca02f8e7f2/