Assume I have a simple system with two (simplified) domains in the backend where the Root aggregates are the following, simplified ones:
Product
withproduct_id
anddescription
Warehouse
with awarehouse_id
,warehouse_name
andMap<product_id, amount>
The system is a modular monolith where each domain is a separate, isolated module. Every module/domain has HTTP endpoints to retrieve and manipulate their main entity.
The requirement is to display a list on the website, the only frontend to the system right now, which looks like this:
Product | Amount in Warehouses |
-----------|------------------------------|-------
Product 1 | Seattle: 32, Baltimore: 17 | Save
Product 2 | Seattle: 0, Baltimore: 21 | Save
...
In addition to just displaying the values the "Product" field and the "amount per warehouse" field are editable. Also, the list should be sortable and filterable, e.g. by amount per warehouse or product name.
I have a few questions related to the interaction and the placement of HTTP endpoints that will be used by the frontend application.
- Where to place an endpoint that retrieves this whole list, including data from different domains and handling the filtering logic?
- Should this actually be a dedicated endpoint or should all logic be done in the frontend, assembling the data as needed? Should the frontend even know about all the different domains/modules?
- Does it make sense to create a dedicated "Backend for Frontend" module that provides all URLs, handles the authentication, etc., and manages the complete "application" logic?
I tried finding a similar question here for the past hour, but I couldn't find one which tackles this exact issue.