Skip to content

The Axon builder

The Axon builder renders an application’s Screenplay model into a Java application on Axon Framework (Spring Boot and Maven), with the Axon Stage renderer. It supports the same four levels as the Cratis builder, through the same builder system: it is cratis build run with --target axon, packaged with the axon build kit, which says how to verify the result and what an agent may write.

The Axon renderer is experimental. It reports what it cannot place as warnings, and refuses the model in strict mode. It builds backend slices only: commands, events, read models, automations and translations. Screens are not part of the Axon target, so Studio offers the Axon builder no user interface work.

  • The Cratis CLI, connected to Studio and approved. See Connect a builder and approve it.
  • A clean clone of the application’s repository, with Git credentials that can push to it.
  • Without --docker: a JDK 21 or later. With it, only Docker.
  • For the Code and AI and AI levels, a coding agent, and an AI provider in Studio under Settings > AI if its calls go through Studio.

Install the kit into the project once. It tells the builder how to verify the result and what an agent may write:

Terminal window
cratis build init --kit axon --agent claude

Then run a level:

Terminal window
cratis build run --level screenplay --target axon
cratis build run --level code --target axon
cratis build run --level code-ai --target axon --agent claude --ai studio
cratis build run --level ai --target axon --agent claude --ai studio

--kit <folder> uses another kit for one run.

At each level the builder:

  1. writes the model to the screenplay folder of the project,
  2. renders it with the Axon renderer at Code and Code and AI,
  3. at Code and AI, lets the agent add the behavior the model describes on top of the rendered code: the slices’ descriptions, the described handlers and queries, the specifications and the feedback. It completes the bodies the renderer left, which the renderer lists in UNSUPPORTED.md and runtime/UnsupportedImplementations.java. At AI nothing is rendered, and the agent writes the slices from the model and the same instructions. See The instructions the agent gets,
  4. verifies with ./mvnw -q -B test, and
  5. commits on the branch Studio names and reports the outcome.

Generated files carry a managed header and belong to the renderer. The kit keeps agents out of them and lets them write the slots the renderer leaves.

The Axon builder has its own image on Docker Hub, cratis/studio-axon-builder: the Cratis builder image with the axon kit.

Terminal window
cratis build run --level code --target axon --docker

With --target axon, --docker picks this image for you; the Cratis builder image has the same tools but not the kit. The image is built from the Cratis Grip repository, versioned with it and published with every Grip release. The CLI uses the newest version, tells you when a newer one is out, and cratis update pulls it.

Open the application’s Settings > Building in Studio, set Builder to the machine, and mark slices Ready for implementation. See Choose who builds. The builder’s manifest says it builds the backend only, so an application whose builder is the Axon builder gets its screens from another builder, or from none.