Domain-Driven Design – Understanding Application Gateway in DDD

domain-driven-design

Is there any sort of concept in DDD related to an "Application Gateway"?

I'm defining an "Application Gateway" as an API layer (REST, GraphQL, etc.) that provides a single interface for clients to interact with.

This would be in contrast to the client talking to the application layer for each bounded context.

This approach would require the "Application Gateway" to interact with multiple bounded contexts which seems like it may violate DDD in some way.

Is there anything like this in DDD? Is this not a DDD concern?

Best Answer

This is outside the DDD concern. If you correctly identify the bounded contexts and the Aggregate boundaries, if your Domain layer is pure (no side effects) with no dependencies to Infrastructure or Presentation then how you call it is no DDD concern.

In other words, you can have any kind of client for the Domain layer, in any architecture.

This approach would require the "Application Gateway" to interact with multiple bounded contexts which seems like it may violate DDD in some way.

Why? This is how well designed/modularized monoliths work. It may not be well suited for a microservice architecture, at the system level, as a microservice should not be larger than a Bounded context.

Related Topic