Skip to main content

UseCase Types

Use cases are the center of the domain layer in Zuraffa.

The v5 workflow for generating them is still:

  1. create or verify the entity with zfa entity create
  2. generate the use cases with zfa make
  3. run zfa build

UseCase patterns

1. Standard UseCase (async)

zfa make Product --preset=crud --methods=get,getList

2. Stream UseCase

zfa make Product --preset=crud --methods=watch,watchList

3. Sync UseCase

zfa make ValidateEmail usecase --type=sync --params=String --returns=bool --domain=auth

4. Completable UseCase

zfa make Product --preset=crud --methods=delete

5. Background UseCase

zfa make ProcessImages usecase --type=background --params=List<File> --returns=List<Image> --domain=media

6. Orchestrator UseCase

zfa make ProcessCheckout usecase --domain=checkout --usecases=ValidateCart,CreateOrder,ProcessPayment --params=CheckoutRequest --returns=Order

Execution model

Generated use cases remain callable classes that return Result<T, AppFailure> variants or streams thereof, depending on the selected use case type.


Next steps