Skip to content

Generating code

When a model is ready, click Generate Code in Designer’s toolbar. Designer downloads a Rust project, as a zip, that implements the model.

Designer generates Rust. The SDKs support other languages for writing components by hand.

  • A Cargo workspace, with a crate for each State Change and each State View on the canvas.
  • A domain crate with a type for every command, event and State View, generated from their schemas.
  • A decide stub for each State Change, with the right signature and a todo!() where the business logic goes.
  • An evolve stub for each State View, with a match arm for each event the view folds, marked // TODO. Unlike decide, an unfilled evolve compiles and runs: it returns the state unchanged.
  • Test scaffolds from the model’s specifications: each has the specification’s given data and expected result, and is marked #[ignore] until you complete it, by calling your decide or evolve and uncommenting its assertions.
  • build_all.sh, which compiles every component to WebAssembly.
  • install.sh, which creates the database if it doesn’t exist and publishes the components to it. See Deploying to Sandbox.

Check each State View’s selector. A view’s metadata.json selects the stream of the first event it folds. If the view folds events from more than one stream, widen the selector to cover them, or the other events never reach it.

  • docker-compose.yml, which runs EvidentSource and its MCP server on your machine, in memory.
  • A ShadowTraffic configuration, for generating load against the running system.
  • A CLAUDE.md and agent skills, so an AI coding assistant can help implement the stubs.
  • A README.md describing the project.

Rust, with the WebAssembly target: rustup target add wasm32-wasip2.

Generating again downloads the whole project again, from the model as it stands. It doesn’t merge with changes you’ve made to an earlier download, so keep the project in version control, and merge each regeneration into it there.