I borrowed the conceptual solution for this from Clojure and built archi.
It can be used for what you’re describing.