I've read and enjoyed the "Clean Architecture" book. So the first thing I tried to do is to implement my project with it.
Where I work we follow a design method called IDesign
in which the architecture is broken into:
- "clients" - encapsulate communication with consumers (e.g. UI)
- "managers" - manages business flows (drives use cases)
- "engines" - stateless computational components (not always needed)
- "resource accesses" - encapsulates accesses to data sources
A component of each type is logically a service so I was trying to treat each one as a component in "Clean Architecture". What I'm having a hard time with is this.
RA (Resource access) component is clearly low level so manager for instance should not depend on it.
We can have multiple managers and engines using the same RA so according to my favorite uncle each should define its own interface and the RA component should implement all of them.
What I cannot understand is, if I'll want to make the RA component into a micro-service, how would its API look?
I'm trying to follow this approach in a NodeJS project which makes it even harder for me to grasp how to implement such a solution..
The best I could up with so far is to have a single API for the RA and on each engine/manager to have internal onion architecture approach in which a repository layer class is implementing a "Use Case" layer interface and calls the RA API (in memory at first stage, through network potentially in the future).
Another thing I struggled with is the entity objects. should the RA service map to them when returning response? Again it makes sense when this is the same process but between micro services I'm not so sure...