Crablet helps Spring teams turn an event-modeled domain into a working event-sourced application. It uses AI-assisted generation to produce the structural code around commands, events, views, automations, outbox publishers, and tests, then runs that code on a small Java 25 Spring Boot runtime.
- Event-model-first workflow for DCB-style domains
- AI-assisted generation for commands, events, handlers, views, automations, outbox publishers, and tests
- Cross-entity consistency without forcing everything into one aggregate stream
- Small Java runtime for consistency, persistence, polling, and operational behavior
- Manual APIs available when generated code needs customization
Crablet can be used directly as a Java framework: EventStore, command handlers, and CommandExecutor are the typical write path; views, outbox, automations, and the optional HTTP command adapter layer on top. For a first project, start with the module reference, Create a new Crablet app manually, the Tutorial, the Commands and Event Store module READMEs, and the Wallet example for a full app shape.
The only tool you interact with is Claude Code. You describe outcomes in plain language; Claude handles modeling, planning, generating, and repairing — entirely through conversation.
Prerequisites: Java 25, Claude Code CLI, ANTHROPIC_API_KEY
# 1. Build the codegen JAR (from this repo)
make install && make codegen-build
# 2. Copy the template and drop the JAR in place
cp -r templates/crablet-app ../my-service
cp embabel-codegen/target/embabel-codegen.jar ../my-service/tools/cd ../my-service
export ANTHROPIC_API_KEY=sk-ant-...
claudeThe template's .claude/settings.json wires embabel-codegen as an MCP server. You never call java -jar directly — Claude Code calls the tools on your behalf.
Add the first vertical slice: Submit Loan Application.
Outcome:
- a customer submits a loan application
- Crablet records LoanApplicationSubmitted
- reviewers can query pending applications
Use the Crablet feature-slice workflow.
Ask for missing facts before changing files.
Claude will:
- Ask for the missing business facts (entity identity, idempotency, required fields, read model columns)
- Run
/event-modelingto updateevent-model.yaml - Call
embabel_planand show you the planned artifact list - Wait for your approval before calling
embabel_generate - Fix any compile errors and tell you when to run
./mvnw verify
Repeat for each new slice. Update event-model.yaml when something is structural; edit generated code only for behavior the model cannot express.
Codegen is optional. The stable runtime APIs (CommandHandler, ViewProjector, CommandExecutor) work independently — you can build a full Crablet application without the generator. The AI-first path is a productivity layer on top, not a requirement.
Crablet is a good fit when command decisions depend on more than one entity stream, consistency is naturally query-based, and you want the code to make concurrency semantics explicit.
It is probably not the right tool if plain CRUD is enough, one aggregate per command already fits your domain, or your team is not ready to standardize on Java 25.
- Learning mode: run one application instance with commands, views, automations, and outbox together. See Learning Mode.
- Command-only production: applications using only
crablet-eventstoreandcrablet-commandscan scale horizontally in the normal Spring Boot way. See Commands-First Adoption. - Poller-backed production: applications enabling views, outbox, or automations should default to one application instance per cluster for the simplest topology, or use one singleton worker service per poller-backed module for isolation. See Deployment Topology.
Crablet intentionally targets Java 25. The framework leans on modern Java features such as records, sealed types, and pattern matching to keep the public API small and explicit.
Traditional event sourcing ties consistency to a single aggregate stream. DCB lets you define consistency boundaries dynamically, so a command can check consistency across multiple entity types using a query.
Crablet maps that model onto three append methods. These are Crablet API terms, not DCB spec vocabulary:
| Method | Use case | Concurrency check |
|---|---|---|
appendIdempotent |
Entity creation and duplicate prevention | Uniqueness/idempotency check |
appendNonCommutative |
State-dependent operations | Stream-position-based conflict detection |
appendCommutative |
Order-independent operations | None, optionally guarded by lifecycle checks |
Read more in DCB And Crablet and Command Patterns.
Documentation index — how user (docs/user/) and dev (docs/dev/) are organized.
Quickstart · Tutorial · Create a new Crablet app manually · Learning mode · Commands-first adoption · Module reference · Public API · Deployment topology · DCB and Crablet · Command patterns · Configuration · Build · Performance · Troubleshooting · Upgrade · Management API · Fault recovery · Leader election · Connection poolers · Observability · Wallet example
AI-first workflow · Feature slice workflow · Event modeling · Event model format · Templates · Crablet app template · Embabel codegen
Contributors: see Build, CLAUDE.md, and framework development docs (maintainer plans, reviews, doc verification).
MIT License - see LICENSE.