For those looking for a JavaScript framework that is lighter than the best-known options currently available, Neutralino.js could well be of interest!
Be aware, though, that the framework is not yet entirely mature; keeping a very close eye on it is nevertheless not a bad idea.
What is Neutralino?
Neutralino.js is an open-source framework for developing desktop applications. The two advantages that set it apart from the competition are: its very light weight of around 6 MB (although, in its compressed version, its weight can be reduced to as little as 1 MB!) and its portability, meaning that the framework needs no dependencies in order to be used.
Indeed, this characteristic of not depending on any library or platform in order to function allows the JavaScript framework to gain enormously in terms of weight and therefore to be more competitive.
The programming languages used by Neutralino.js are JavaScript for Windows, Linux and Mac, TypeScript to ensure security and maintainability, and HTML and CSS for the front-end side of applications.
How do you set up the Neutralino framework?
Using the JS framework is fairly simple; for installation, there are two options:
download the lightweight, portable devkit, or
use the npm package manager via the command $ npm i -g @neutralinojs/neu, then neu create myapp --template to create your application based on a pre-built template.
Neutralino offers the possibility of managing and modifying the application’s files from the Filesystem module of the JS API. For example, it is possible to create a new file with the filesystem.createDirectory function, to delete a file with filesystem.removeFile, or to delete a directory using filesystem.removeDirectory.
Who are the framework’s creators?
Neutralino.js started out as a university project between three students based in Sri Lanka: Shalitha Suranga, Chathumaduri Hettiarachchi and Deepal Samarakoon.
Neutralino, an alternative?
The project, launched in October 2018, set out to fill gaps that recur in other well-known frameworks. Setting aside any ambition to replace them, Neutralino aims to be an alternative for all developers looking to use a lighter SDK (software development kit) while retaining a sense of simplicity. Their slogan, “IT’S EASIER THAN YOU THINK”, captures this desire to stay simple.
Neutralino’s distinctive features
A cross-platform framework
Neutralino.js makes it possible to develop cross-platform applications. This makes the JS framework portable, since it gives developers the option of running it on different operating systems such as macOS, Microsoft Windows and Linux.
Neutralino client and Neutralino server
Neutralino is still a project at the experimental stage, and it has chosen to be based on a client-server environment. It is therefore made up of an API provided by a JavaScript library to access native OS-level functions on the client side, and a server that listens to and processes the client’s requests via the XMLHttpRequest object.
Neutralino client / Neutralino server
Choosing the rendering mode
Neutralino can be run using three different methods. Obviously, only one of these options can be used at a time.
First of all, it is possible to run the rendering in a browser by specifying browser mode in the settings.json file. You can also run it in a native window with window mode.
Configuring the settings.json file is fairly simple; the function should look like this:{ "appname": "neutralino", "appport": "8080", "mode": "window" }
Opinions on the framework
For now, the Neutralino.js project has a few shortcomings to resolve before it becomes a serious competitor on the market. The idea behind the project is an interesting one for developers. The work already carried out on it makes it possible to start understanding and getting to grips with the framework, all the more so because installing it is simple and quick thanks to the npm command.
However, the documentation still needs fleshing out. Many of the problems encountered while programming have to be resolved by developers themselves because of the lack of support. That has the effect of making development time longer.
But the big issue raised remains that of access to native OS-level functions. The promise does not yet live up to expectations. Ultimately, with the JS framework you can only create, modify and delete a file or a directory; read the application’s data as well as the settings in the JSON file; display RAM usage, the debug message, the file open and save dialog box; and quit the application.
The developer community is therefore expecting more from the Neutralino framework before being able to use it in larger-scale projects, even though the creators maintain that it can already be used in production. Improvements will be made, in particular in terms of security and refactoring.
Neutralino and React
In April 2020, the creators updated the Neutralino–React template developed two years earlier. You can see a change in the structure of the code, which was previously based on the inherited model in an HTML file. In the new version, they have favoured the use of React components in a JS file.
Another change concerns the transpilation of the code. As it was not optimal, it slowed the application down slightly by running at every start-up. The integration of webpack will make it possible to transpile the code only when the application is published.
The Neutralino project was launched in 2018 by three students during a university project. The framework aims to be lighter than other JS frameworks for creating cross-platform desktop applications, and does not hesitate to compare itself to Electron.js or NW.js in terms of memory resource consumption. However, Neutralino is still considered experimental by developers, who expect more from it before using it in large projects. The authors plan to add features and improvements such as support for Angular.
If you want to find out more about JavaScript frameworks, do read our article on Vue.js.