The "middle tier" is a mediator between the JavaScript frontend and the MarkLogic backend, providing REST/JSON API endpoints to the frontend for the data retrieved from the backend. It also takes care of the authentication to the backend, hiding it from the frontend.