It can definitely help if scope/runtime is limited. I myself have played with something similar : https://github.com/statelyai/xstate Modelling entire interaction as state machine so program always remains/lands in known states. IMO FSMs probably better suited as it has error modelling and handling inbuilt.