Skip to main content
Version: 0.4.0

Model the data

Say what data the organization holds, which system is the authority for each kind of it, how the copies are kept in step, and why personal data is processed. The guide grows one small model, a shop, a step at a time, and every step is a whole model that builds with no error or lint: type it into model/ in a repository kq init made, and check it with kq validate or in VS Code as you type. Every statement used here is described in full in Data.

Name the business data​

A domain object is a kind of business data, conceptually: Order, Customer. Declare it in a platform or a monolith, with the domain that owns it after :. How confidential it is and whether it is personal data are said here, on the concept, so its copies can't disagree. Every domain object is held at least once where it is first created, so each starts with one holding, which the next step explains:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { object order "Order" : selling object buyer "Customer" : selling confidentiality confidential personal-data personal component customers "Customers" : backend { sql customers-db "Customers DB" { root buyer authoritative origin } } component order-service "Order Service" : backend { sql orders-db "Orders DB" { root order authoritative origin } } storefront realizes selling } }

confidential is one of the repository's confidentiality levels, by default public, internal, confidential and restricted, and personal-data personal says a customer identifies a person. The customer's Code is buyer because customer is a reserved word, a persona. See Domain object.

Say where it is held​

A data entity is one component's holding of a domain object, in a named storage inside the component that owns it. Every entity is a root or part of another. Mark the holding that is the system of record authoritative, exactly one per domain object, and where the data is first created origin. Add the order's lines, and the few properties that matter:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { object order "Order" : selling object order-line "Order line" : selling object buyer "Customer" : selling confidentiality confidential personal-data personal component customers "Customers" : backend { sql customers-db "Customers DB" { root buyer authoritative origin identifier "Customer Id" property "Email" personal } } component order-service "Order Service" : backend { sql orders-db "Orders DB" { root order authoritative origin identifier "Order Id" property "Total" order-line part of order [1..*] authoritative origin identifier "Line Id" } } storefront realizes selling } }

identifier names an identifying property and property another significant one: a few, not a column list. personal marks the email personal in this holding, and never sets a level. Authority covers the whole domain object, never some of its properties. When two systems each own part of one concept, model each part as its own domain object. See Storage and data entity.

Keep copies in step​

A holding written from <component> over <protocol or channel> is a replica, kept in step from that component's copy, and it states its scheme as a connection does. Between systems there is no foreign key: what links them is that both hold the same domain object, so references joins entities of one component only. The order service keeps its own copy of the customer, and each order refers to it:

ecosystem shop "Shop" { domain selling "Selling" platform storefront "Storefront" { object order "Order" : selling object order-line "Order line" : selling object buyer "Customer" : selling confidentiality confidential personal-data personal component customers "Customers" : backend { sql customers-db "Customers DB" { root buyer authoritative origin identifier "Customer Id" property "Email" personal } } component order-service "Order Service" : backend { sql orders-db "Orders DB" { root order authoritative origin identifier "Order Id" property "Total" references buyer [1] order-line part of order [1..*] authoritative origin identifier "Line Id" root buyer from customers over http auth client-credentials identifier "Customer Id" } } storefront realizes selling } }

Without the replica, references buyer would have nothing to point at. See What a sync carries.

Say why personal data is processed​

A data use says why you process personal data, and on what legal ground. Write it in a domain or an ecosystem: its name is the purpose, via names the work it covers, basis the lawful bases, subjects whose data it is and data the domain objects. The shop processes customers' data to fulfil their orders, under a contract:

ecosystem shop "Shop" { domain selling "Selling" { data-use fulfil-orders "Fulfil orders" via selling basis contract subjects customer data buyer } platform storefront "Storefront" { object order "Order" : selling object order-line "Order line" : selling object buyer "Customer" : selling confidentiality confidential personal-data personal component customers "Customers" : backend { sql customers-db "Customers DB" { root buyer authoritative origin identifier "Customer Id" property "Email" personal } } component order-service "Order Service" : backend { sql orders-db "Orders DB" { root order authoritative origin identifier "Order Id" property "Total" references buyer [1] order-line part of order [1..*] authoritative origin identifier "Line Id" root buyer from customers over http auth client-credentials identifier "Customer Id" } } storefront realizes selling } }

Where the data is held is read from the model, never written again: here, both holdings of the customer. See Data uses.

Say where personal data goes​

Personal data that leaves the EEA needs a legal ground. A residency is a named set of countries your repository declares in its residencies setting, and one that also lists its adequate countries is a transfer regime: data may leave it for those with no stated ground. Make the EEA one in kanoniq.repository.json, with the countries your privacy officer accepts as adequate:

"residencies": {
"eea": {
"countries": ["AT", "BE", "BG", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GR", "HR", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MT", "NL", "NO", "PL", "PT", "RO", "SE", "SI", "SK"],
"adequate": ["AD", "AR", "CA", "CH", "FO", "GB", "GG", "IL", "IM", "JE", "JP", "KR", "NZ", "UY"]
}
}

You never write where data is: it's read from where it runs. Here the customers component runs on a host in a West Europe network, so its holding is in the Netherlands; the contact centre is a SaaS that states location aws.us-east-1, so its copy of the customer is in the United States. A transfer is read, never stated. Its ground goes on the contract of the supplier that imports the data, transfer scc, and a policy names the residency with leaves, here asking every transfer out of the EEA to state its ground:

ecosystem shop "Shop" { policy grounded in model "A transfer states its ground" when personal-data: personal or special-category and leaves: eea -> deny transfer: unstated environments PRD network weu "West Europe" : vnet location azure.westeurope environment PRD host app-vm "App VM" : vm in weu environment PRD x1 domain selling "Selling" { data-use fulfil-orders "Fulfil orders" via selling basis contract subjects customer data buyer } platform storefront "Storefront" { object buyer "Customer" : selling confidentiality confidential personal-data personal component customers "Customers" : backend { environment PRD x1 on app-vm sql customers-db "Customers DB" { root buyer authoritative origin identifier "Customer Id" property "Email" personal } } component contact-centre "Contact centre" : saas location aws.us-east-1 { document cases "Cases" { root buyer from customers over http auth client-credentials identifier "Customer Id" } } storefront realizes selling } supplier helpdesk "Helpdesk Cloud, Inc." headquarters US { contract helpdesk-cloud "Helpdesk subscription" law IE transfer scc covers storefront/contact-centre } }

Without transfer scc on the contract, the copy would be KQ137: personal data leaving the EEA with no ground. A SaaS whose place isn't stated is KQ138, since an unstated place is never a pass:

component survey "Survey" : saas { document responses "Responses" { root buyer from customers over http auth client-credentials } }

Give it a location or a country to put it right. See Settings and What a clause can name.

See what you modeled​

A Domain's layered view under the data lens answers what the Domain's components hold: each domain object in its Domain's box, each storage in the column of the component that owns it, and a line from each copy to the entity it is kept in step from. Selling's, drawn from the last step:

The diagram in words

Selling · Layered application view · lens: data

Ecosystem

  • Shop (Ecosystem)

Domains

  • Selling (Domain)
    • Order (Domain Object)
    • Order line (Domain Object)
    • Customer (Domain Object)

Data

  • Customers DB (SQL)
    • Customers - Customer (Data Entity)
  • Orders DB (SQL)
    • Order Service - Order (Data Entity)
    • Order Service - Order line (Data Entity)
    • Order Service - Customer (Data Entity)

Domain Components

  • Storefront (Platform)

Lines

  • Customers - Customer → Order Service - Customer: sync, http · client-credentials
  • Customers - Customer → Customer: representation
  • Order Service - Order → Order: representation
  • Order Service - Order line → Order line: representation
  • Order Service - Customer → Customer: representation

In VS Code, the viewer draws it as you type. See A Domain's data.

Where next​

© 2026 Extenza Works. All rights reserved.