We are currently working on migration of an old monolithic desktop application. We've discussed a lot and we decided microservices is the way to go. At the moment we are separating a big part of the old application and for that we clearly identified two microservices. And, in order to avoid frontend from knowing each microservice separatedly, we are building a BFF that will take care of aggregating data and call each microservice needed.
For one case I need to fill a grid that shows some kind of summarized data. This data comes mainly by data owned by Microservice A and is completed with data from microservice B.
What Microservice A is currently doing is executing the specific SQL query to obtain the data with all Counts, Sums, etc needed. Then this is called by BFF which also calls Microservice B to complete the missing data.
Is it that bad to let Microservice A know about specific logic that is needed by frontend?
We discussed this and some disagree and says this logic shouldn't be in Microservice A and instead BFF should be who perform all the calculations needed to return the data to frontend.
I personally agree in some point but I don't see a clear way to solve it. One option is to let Microservice A only returns a huge collection of results so the BFF takes care, of group, count, sum, etc.
Is it that bad to let a microservice have specific logic for a grid or should it be BFF responsability?
I tried to explain as simple as possible but I know it could be a mess to read anyway. Please let me know any doubt you might have.
Thanks