For teams in several languages · TypeScript · Python · Rust
One backend. Every team in its own language.
Your data team writes Python, your product team TypeScript, your platform team Rust. kernable gives them one model and the same guarantees, whatever they write.
The language is a choice, not a wall.
The rules that must hold for everyone live in the kernel, not in a library per language. So every team gets them, and none has to rebuild them:
- 01
One language imposed on every team→Each team in the language it knowsPython for data, TypeScript for the product, Rust where it counts, in one application.
- 02
Every language its own retries and edge cases→The same guarantees everywhereOrdering, read-after-write and signatures are the kernel's job, not each SDK's.
- 03
Services that drift apart over time→One model for allCommands, events and queries mean the same in every language.
- 04
Integration through ad-hoc APIs and queues→Every service gets every changeIn order, from one log, to every service allowed to see it.
- 05
Rewriting to join the platform→Any language can joinTypeScript, Python and Rust have SDKs; any other speaks the open gRPC protocol.
Mix languages inside one application.
Each part of your application is its own process, in its own language. The kernel holds them together.
The data team's pricing rules: decides commands and emits events.
The product team's views: builds tables from events and answers queries.
The platform team's integrations: acts on events and calls other systems.
Your access rules, checked on every request, whoever wrote the rest.
One cart, two languages.
The cart's rules in Python, its read model in TypeScript, from the tested example in the docs. What the Python worker decides, the TypeScript read model shows right away.
from kernable import Kernable, Rejected, domain
shop_domain = domain("shop")
cart_aggregate = shop_domain.aggregate("cart", {"items": 0, "checked_out": False})
@cart_aggregate.apply("ItemAdded")
def _(state, data):
state["items"] += data["qty"]
@cart_aggregate.apply("CheckedOut")
def _(state, data):
state["checked_out"] = True
@cart_aggregate.command("AddItem")
def _(state, data):
if state["checked_out"]:
raise Rejected("Cart is checked out")
return [{"type": "ItemAdded", "data": data}]
@cart_aggregate.command("CheckOut")
def _(state, data, cmd, ctx):
if state["items"] == 0:
raise Rejected("Cart is empty")
# ctx.now() and ctx.id() stay the same if the command runs again.
return [{"type": "CheckedOut", "data": {"at": ctx.now().isoformat(), "orderId": ctx.id()}}]
k = Kernable(key="app.key")
k.worker(cart_aggregate).run()
import { Kernable, Rejected, domain } from "@kernable/sdk";
const shopDomain = domain("shop");
const cartsReadmodel = shopDomain.readModel("carts");
const rows = new Map<string, { items: number; order?: string }>();
cartsReadmodel.on("ItemAdded", (data: { qty: number }, evt) => {
const row = rows.get(evt.aggregateId) ?? { items: 0 };
row.items += data.qty;
rows.set(evt.aggregateId, row);
});
cartsReadmodel.on("CheckedOut", (data: { orderId: string }, evt) => {
rows.get(evt.aggregateId)!.order = data.orderId;
});
cartsReadmodel.query("GetCart", (data: { id: string }) => {
const row = rows.get(data.id);
if (!row) throw new Rejected("no such cart", "not_found");
return row;
});
const kernable = new Kernable({ key: "app.key" });
await kernable.listener(cartsReadmodel).run();
From Getting started: every example there runs against a real kernel in CI.
Bring your teams onto one model.
We help you draw the domain boundaries between your teams, agree on the commands and events between them, and build the first part on kernable, in each team's language.
Twenty years of shipping software, the last seven designing the architecture other engineers build on. Author of comby, the event sourcing and CQRS framework that carries multiple commercial platforms in regulated markets. kernable brings the same model to teams that work in any language.
LinkedIn →[ Early access ]
Build on kernable before 1.0.
kernable is in private preview. Tell us what you're building, and we'll send you the binaries and the docs.