I have a web application that has some logic calculation duplication on PHP backend and frontend, I can’t place logic entirely to backend and make an AJAX request each time, even with effective cache, because of high performance requirements and responsiveness of an app.
Could you please suggest an approach to this problem?
I would move the calculation logic to the front end, if the result is not to be used further down the line.
For example: If you are doing a simple mortgage calculator, and the end user wants a simple answer after entering down payments, etc. Then use the front end.
On the other hand if the result of the calculation has to be used further down the line with objects like grids, email, or databases, then keep the logic in the back end.