Search code examples
c#restapidomain-driven-designcqrs

CQRS Projections by consumer is not designed for API Portfolio Architecture?


I don't understand how to make a generic API REST, (like recommendation, no specific API by consumer) in an API Portfolio, but and the other recommendation of CQRS that tell, make projections by consumers, and so an API (GET) by consumers.

I wish a simple solution, and in this case, how to avoid to make only one projection with everything inside.

It's the same problem. How to expose DDD Application Layer, via an API REST, because Applicaiton Layer should return the consumer want, to return only data need with specific format etc...

Thanks


Solution

  • Basically, REST is not a goal per se. Furthermore, it's often believed that resource-basednes of REST harms Domain-Driven Design.

    As the article referred above states for your case it's perfectly fine to build customer-centric endpoints as in your case.

    As for me, I do think that most developers strive to implement REST not because of it's resource-oriented but because it's stateless which facilitates horizontal scalability. And also because stereotypical architecture is something that is easy to catch up.

    P.S. Orignal spec states that HATEOAS is required for REST API. Based on my experience I've never seen it implemented in any of those so-called "REST API", and I doubt you'll be the first. So you won't be implementing REST API in a strcit definition of it anyways :)