A model is a set of .vishwakarma files. Start with an entity — a noun your business stores. Here is a product in Chowk's catalog:
entity Product aggregate_root global {
id uuid pk filterable[eq]
sku string required immutable filterable[eq] specs [Sku]
name string required
price Money required
status ProductStatus required
}price is a value object — an amount and a currency, with no identity of its own, compared by its contents and embedded directly in the product:
value Money {
amount_minor int64 required
currency Currency required
}Then a command to add a product, and a query to read one back:
command CreateProduct {
aggregate Product
operation create
// A server-set field: a product is always born DRAFT, never chosen by the caller.
set status = expr "'DRAFT'"
sku string required specs [Sku]
name string required
price Money required
}
query GetProduct {
returns Product
method get
where "this.id == id"
id uuid required
}That is the whole loop: describe the noun, describe the verbs, and the platform generates the table, the API, the validation, and the typed client. You never hand-write what the description already implies.