Fork me on GitHub

Can components depend on other components and how?

David Vujic09:02:42

Yes, I believe you can require a component just as with any other namespace. If I’m not mistaking, the components will know about each other because they are referenced in the project specific deps.edn (and the dev deps.edn). I found an example in the Polylith RealWorld repo:


Nice, thanks! That answers it.

👍 1

Components only know about interfaces which is something all components “implements” by exposing at least one namespace, e.g. com.mycompany.invoicer.interface (`com.mycompany` is the top namespace in this example). Then other components can access invoicer by require:ing that interface namespace. Each project then decides which concrete component to include (maybe a component with the name invoicer or some other name, as long as it contains the namespace com.mycompany.invoicer.interface).

👍 1