Web framework Pusa, shifting JavaScript frontend logic to the server side

The Pusa web framework has been released, implementing a concept that transfers frontend logic, executed in the browser using JavaScript, to the backend — controlling the browser and DOM elements, as well as business logic, executed on the backend. The JavaScript code running on the browser side is replaced by a universal layer that calls handlers located on the backend. There is no need to develop using JavaScript for the frontend. The reference implementation of Pusa is written in PHP and distributed under the GPLv3 license. Besides PHP, the technology can be implemented in any other language, including JavaScript/Node.js, Java, Python, Go, and Ruby.

Pusa defines a communication protocol based on a minimalist set of commands. When the page loads, the browser retrieves the basic DOM content and the JavaScript kernel of Pusa-Front. Pusa-Front sends browser events (such as click, blur, focus, and keypress) and request parameters (the triggering element, its attributes, URL, etc.) to the Pusa-Back server handler through Ajax requests. Based on the received data, Pusa-Back determines the controller, executes the payload, and formulates a response set of commands. Upon receiving the request response, Pusa-Front executes the commands, altering the DOM content and the browser environment.

The state of the frontend is formed but not controlled by the backend, making development for Pusa similar to coding for a graphics card or Canvas, where execution results are not controlled by the developer. For creating interactive applications based on Canvas and onmousemove, there is an option to load and use additional JavaScript scripts on the client side. Among the drawbacks, the method also shifts part of the load from the frontend to the backend and increases data exchange frequency. proxy server.

Among the advantages are: eliminating the need for frontend JavaScript developers, a stable and compact client-side code (11kb), the main code being inaccessible from the frontend, no need for REST serialization or tools like gRPC, and avoiding issues with synchronizing request routing between the frontend and backend.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster