GenServer design with steps

Sounds like what you’re trying to design is a state machine, Erlang/OTP provides gen_statem.

I’ve built StatesLanguage based on gen_statem that allows you to describe your state machine in a JSON format, and provide the callbacks for your different states and their transitions.

Hexdocs

It also provides the ability to output your graph to different visualization engines. This is an example of outputting to graphviz, https://github.com/CityBaseInc/states_language/blob/master/README.md#mix-tasks

If you decide to use it, I’d love any feedback you have. There’s a forum post here