Pusa web framework that moves the logic of the JavaScript frontend to the server side

The Pusa web framework has been published with the implementation of the concept that transfers the front-end logic executed in the browser using JavaScript to the back-end side - browser and DOM element management, as well as business logic are performed on the back-end. The JavaScript code executed on the browser side is replaced by a universal layer that calls handlers located on the backend side. There is no need to develop with JavaScript for the frontend. The Pusa reference implementation is written in PHP and distributed under the GPLv3 license. In addition to PHP, the technology can be implemented in any other language, including JavaScript/Node.js, Java, Python, Go, and Ruby.

Pusa defines an exchange protocol based on a minimalistic set of commands. When the page loads, the browser loads the underlying DOM content and the Pusa-Front JavaScript core. Pusa-Front sends browser events (such as click, blur, focus, and keypress) and request parameters (the element that fired the event, its attributes, URL, etc.) to the Pusa-Back server handler via Ajax requests. Based on the received data, Pusa-Back determines the controller, executes the payload and generates a response set of commands. Upon receiving a response from a request, Pusa-Front executes commands, modifying the contents of the DOM and the browser's environment.

The state of the frontend is generated but not controlled by the backend, which makes development for Pusa similar to code for a video card or Canvas, where the result of execution is not controlled by the developer. To create interactive applications based on Canvas and onmousemove, you can download and use additional JavaScript scripts on the client side. Among the shortcomings of the method, there is also a transfer of part of the load from the frontend to the backend and an increase in the frequency of data exchange with the server.

Among the advantages stand out: elimination of the need for the participation of front-end JavaScript developers, stable and compact client code (11kb), inaccessibility of the main code from the front-end side, no need for REST serialization and gRPC-type tools, elimination of problems of coordinating request routing between front-end and back-end.

Source: opennet.ru

Add a comment