ecommerce.kq

A model as it is stored: plain text in git, nothing else. Northwind sells to the public and hands parcels to a carrier. This file is all of Northwind; the carrier is a second file of eighteen lines, modeled only as far as Northwind depends on it.

Every reference links to the declaration it points at, so the file can be read the way the model resolves it. Nothing on this page is generated: it is the source Kanoniq parses, shown unchanged.

  • 1 ecosystems
  • 6 domains
  • 4 platforms
  • 15 components
  • 17 connections
  • 18 realizations
1/// Everything Northwind runs to sell to the public: the storefront, the order
2/// pipeline behind it, and the customer record either side.
3ecosystem shop "Northwind Retail" (SHOP) {
4
5 /// Moving a shopper from browsing to a placed order.
6 domain shop-selling "Selling" {
7 function-group browse-catalogue "Browse catalogue"
8 /// Finding a product without knowing its name: facets, synonyms, ranking.
9 function-group search-products "Search products"
10 function-group manage-basket "Manage basket"
11 function-group place-order "Place order" critical
12 function-group apply-promotions "Apply promotions"
13 }
14
15 /// Everything that happens to an order once it has been placed.
16 domain shop-fulfilment "Fulfilment" {
17 /// Holding stock against an order so two shoppers cannot buy the last one.
18 function-group reserve-stock "Reserve stock" critical
19 function-group pick-and-pack "Pick and pack"
20 function-group arrange-delivery "Arrange delivery"
21 function-group handle-returns "Handle returns"
22 }
23
24 /// Who the shopper is, what they have told us, and how we answer them.
25 domain shop-customer "Customer" {
26 function-group register-account "Register account"
27 function-group manage-preferences "Manage preferences"
28 function-group answer-enquiries "Answer enquiries"
29 }
30
31 /// The range, the ranging decisions, and the catalogue content behind them.
32 domain shop-merchandising "Merchandising"
33 /// List price, markdowns, and the rules that choose between them.
34 domain shop-pricing "Pricing"
35
36 /// Sign-in, sign-up and tokens, for every app that needs to know who is calling.
37 domain shop-identity "Identity" enabler {
38 function-group authenticate "Authenticate"
39 }
40
41 broker bus "Service Bus" : azure.service-bus.topics {
42 /// Published once the order is accepted and payment is authorised.
43 channel order-placed "Order placed"
44 /// Every physical movement in the distribution centre, picks included.
45 channel stock-moved "Stock moved"
46 }
47
48 /// Everything a shopper touches, and the read paths that serve it.
49 platform platform-storefront "Storefront" {
50
51 /// Ranged and described by merchandisers, never by a shopper.
52 object product "Product" : shop-merchandising canonical
53 object basket "Basket" : shop-selling
54
55 /// The public web shop. Listing and product pages are server-rendered;
56 /// basket and checkout are client-side routes.
57 component web-shop "Web Shop" : user-facing-app technology "Next.js" {
58 spa web-shop-ui "Web Shop"
59 role shopper "Shopper" in platform-customer/identity-service : customer
60 }
61
62 /// The iOS and Android shop. Same journeys as the web shop, and the same
63 /// BFF behind it.
64 component mobile-shop "Mobile Shop" : user-facing-app technology "React Native" {
65 mobile-app mobile-shop-ui "Mobile Shop"
66 role shopper "Shopper" in platform-customer/identity-service : customer
67 }
68
69 /// The single front door for the storefront apps. Fans out to the
70 /// catalogue, search and basket services; owns no data of its own.
71 component storefront-bff "Storefront BFF" : backend technology ".NET"
72
73 /// Product, variant and category master data. Read far more than written.
74 component catalogue-service "Catalogue Service" : backend technology "Go" {
75 sql catalogue-db "Catalogue DB" {
76 root product authoritative origin
77 identifier "SKU"
78 property "Name"
79 property "List price"
80 }
81 }
82
83 /// Free-text and faceted product search over a denormalised index.
84 component search-service "Search Service" : backend technology "Elasticsearch"
85
86 /// Holds a basket for a signed-in shopper or an anonymous session, and
87 /// reprices it on every change.
88 component basket-service "Basket Service" : backend technology "Go" {
89 /// Real but short-lived, and nothing outside depends on it.
90 sql basket-db "Basket DB" {
91 root basket authoritative origin transient
92 identifier "Basket Id"
93 property "Updated at"
94 }
95 }
96
97 web-shop -> storefront-bff/storefront-bff-api over http
98 mobile-shop -> storefront-bff/storefront-bff-api over http
99
100 storefront-bff -> catalogue-service/catalogue-api over http
101 storefront-bff -> search-service/search-api over http
102 storefront-bff -> basket-service/basket-api over http
103 storefront-bff -> platform-orders/order-service/order-api over http
104 storefront-bff -> platform-customer/identity-service/identity-api over http
105
106 /// Pulls product data to rebuild the index. Not on the shopper's read path.
107 search-service -> catalogue-service/catalogue-api over http
108
109 web-shop realizes shop-selling/browse-catalogue
110 web-shop realizes shop-selling/manage-basket
111 mobile-shop realizes shop-selling/browse-catalogue
112 storefront-bff realizes shop-selling
113 search-service realizes shop-selling/search-products
114 basket-service realizes shop-selling/manage-basket
115 catalogue-service realizes shop-merchandising
116 }
117
118 /// Order handling, promotions, stock, and the warehouse behind them.
119 platform platform-orders "Orders" {
120 policy-set model platform-rules "Platform rules" {
121 /// Inside one platform as well, every call says how it authenticates.
122 policy stated "Calls state their scheme" when type: call and within: platform -> deny auth: unstated
123 }
124 exempt platform-rules/stated for order-service -> stock-service/stock-api because "Moves to workload identity with the 2027 platform" until 2027-03-31
125
126 object order "Order" : shop-selling
127 object order-line "Order Line" : shop-selling
128
129 /// Owns the order lifecycle from placement through to dispatch.
130 component order-service "Order Service" : backend technology "Java" {
131 sql orders-db "Orders DB" {
132 root order authoritative origin
133 identifier "Order Number"
134 property "Placed at"
135 property "Total"
136
137 order-line part of order [1..*] authoritative origin
138 identifier "Line Number"
139 property "Quantity"
140 property "Unit price"
141 }
142 /// Runs on Azure, so the platform holds its credential.
143 workload order-service-app "Order Service" : client in platform-customer/staff-directory {
144 credential managed
145 }
146 }
147
148 component promotion-service "Promotion Service" : backend technology "Java" {
149 policy workload-callers in architecture "Callers present a workload token" when direction: in -> allow only auth: workload-identity
150 workload promotions "Promotion API" : server in platform-customer/staff-directory {
151 app-role read-promotions "Promotions.Read"
152 }
153 }
154
155 component stock-service "Stock Service" : backend technology "Java"
156
157 /// Bought in, runs in the distribution centre, and is the system of record
158 /// for physical stock movement.
159 component warehouse-wms "Warehouse WMS" : cots {
160 /// A pick list per order, read from the order placed and never written back.
161 sql wms-db "WMS DB" {
162 root order from order-service over bus/order-placed
163 identifier "Order Number"
164 property "Pick status"
165 }
166 }
167 component returns-portal "Returns Portal" : user-facing-app technology "Mendix" {
168 spa returns-portal-ui "Returns Portal"
169 /// Warehouse staff booking a return in.
170 role returns-clerk "Returns clerk" in platform-customer/staff-directory : employee
171 }
172
173 order-service -> promotion-service/promotion-api over http auth workload-identity via platform-customer/staff-directory grant read-promotions
174 order-service -> stock-service/stock-api over http
175
176 order-service -> warehouse-wms over bus/order-placed
177 warehouse-wms -> stock-service over bus/stock-moved
178
179 order-service realizes shop-selling/place-order
180 promotion-service realizes shop-selling/apply-promotions
181 stock-service realizes shop-fulfilment/reserve-stock
182 warehouse-wms realizes shop-fulfilment/pick-and-pack
183 returns-portal realizes shop-fulfilment/handle-returns
184 promotion-service realizes shop-pricing primary
185 }
186
187 /// Identity, the customer record, and the people who answer the phone.
188 platform platform-customer "Customer" {
189
190 object customer-record "Customer" : shop-customer
191
192 /// Sign-in, sign-up and tokens. Not the customer record.
193 component identity-service "Identity Service" : saas idp technology "Auth0" {
194 identity shoppers "Shoppers" : customer
195 }
196
197 /// The staff accounts the back-office applications sign in with.
198 component staff-directory "Staff Directory" : saas idp technology "Entra ID" {
199 identity staff "Staff" : employee
200 }
201
202 /// The customer record, contact history and marketing preferences.
203 component crm "CRM" : saas technology "Salesforce" {
204 sql crm-db "CRM records" {
205 root customer-record authoritative origin
206 identifier "Customer Id"
207 property "Email"
208 }
209 }
210
211 component contact-centre "Contact Centre" : cots {
212 spa contact-centre-ui "Contact Centre"
213 role agent "Agent" in staff-directory : employee
214 }
215
216 contact-centre -> crm/crm-api over http
217 crm -> identity-service/identity-api over http
218
219 identity-service realizes shop-identity/authenticate
220 staff-directory realizes shop-identity/authenticate
221 crm realizes shop-customer/register-account
222 crm realizes shop-customer/manage-preferences
223 contact-centre realizes shop-customer/answer-enquiries
224 }
225 // Who Northwind buys its software from, and under which contract. Every name, date and term here is illustrative.
226 supplier salesforce "Salesforce Ireland Ltd" headquarters IE {
227 contract crm-subscription "Sales Cloud subscription" starts 2024-01-01 ends 2029-12-31 notice P90D law IE covers platform-customer/crm
228 }
229 supplier okta "Okta, Inc." headquarters US {
230 contract identity-subscription "Auth0 subscription" starts 2024-03-01 ends 2029-02-28 notice P60D law US covers platform-customer/identity-service
231 }
232 supplier microsoft "Microsoft Ireland Operations Ltd" headquarters IE {
233 contract entra-agreement "Entra ID agreement" starts 2023-07-01 ends 2029-06-30 notice P90D law IE covers platform-customer/staff-directory
234 }
235 supplier manhattan "Manhattan Associates Ltd" headquarters GB {
236 contract wms-licence "Warehouse WMS license" starts 2022-04-01 ends 2030-03-31 notice P180D law GB covers platform-orders/warehouse-wms
237 }
238 supplier contact-works "Contact Works Ltd" headquarters NL {
239 contract contact-centre-licence "Contact centre license" starts 2025-01-01 ends 2029-12-31 notice P90D law NL covers platform-customer/contact-centre
240 }
241}
242
  • declaration
  • relationship
  • kind and transport
  • flag
  • name
  • date and period
  • description

Back to Kanoniq