Previewkernable is not released yet: these docs describe work in progress, and things may change before 1.0.Not released yet.Request early access →
Skip to content

Build a shop ​

In ten parts you build a small shop on kernable: customers register and place orders, a service confirms every order by email, customers may only touch their own data, and a customer can have their personal data erased. Part 8 runs it as it would in production; part 9 adds accounts, sign-in and an HTTP API with kernable's kit, and part 10 a business process that ships paid orders and cancels unpaid ones.

Every part shows the code in TypeScript, Python and Rust; pick one with the tabs, or mix them: part 5 is about exactly that.

The shop you build in eight parts. Each step adds what one part builds and shows it at work.
CommandEventQueryAcknowledgementPersonal dataRejection / mismatch
PartYou addYou learn
1. Run a kernelthe kernel, the SDKwhat the kernel does and what your processes do
2. Aggregates and commandscustomer, order, the workercommands, events, rejections, idempotency
3. Read models and queriescustomers, ordersqueries through the kernel, reading your own writes
4. A reactorconfirmationslistener order, follow-up commands
5. A second languagenothing newmixing languages in one application
6. Authorizationguardgrants and middleware, the request context
7. Personal datavault declarations, erasurethe vault, secrets, erasing a person
8. Operatea production setupa key per service, an offline root key, rotation and revocation, mutual TLS, metrics, persistent read models, deploys
9. Accounts and sign-inapi, the kit, a rule of the shopaccounts and sessions, tenants, groups, invitation links, a query's target, Explain, rules on data next to the kit
10. A business processfulfilmentprocesses run by the kernel: cases, waits with a timeout, incidents, the UI's diagram and statistics

From part 2 on, the snippets show what a part adds to a file, without its imports. The complete files, as they are at the end, are in the repository under docs/examples/shop/ts, docs/examples/shop/py and docs/examples/shop/rs; kernable's tests run them for every part, in every language.

You need Node.js ≥ 22.18 for TypeScript, Python ≥ 3.10 for Python or Rust (stable) for Rust, and about an hour.