​API proxy design best practice - single entity, aggregate or bounded context

Hi,

What is the general best practice for the API proxy.

I can think of three different ways:

1. Different proxy for different entity, like employee, customer etc.

2. Different proxy for different aggregates (term fetch from DDD).

3. Single proxy for whole sub-domain, like for order, inventory etc.

Thanks

Balesh

0 1 191
1 REPLY 1

D) all of the above

In general the best practice is to create proxies per each entity, OR each task. Start designing your proxies based on entities of data /employees /customers /locations etc. but if you have a task that needs to interact with multiple services like a fetch, you can still do it. The key is to make the consumption easy to understand so developers can understand exactly what it is doing.

Maybe the best way to look at this would be start with single entities, and if you end up with a use case that doesn’t fit in that design model, move to an aggregate approach.