NeutralinoJS vs ElectronJS

NeutralinoJS vs ElectronJS

I decided to create a cross-platform desktop application that will run on Windows, MacOS, and Linux. I heard about a recent project Neutralino and tried using this framework. It has been a tough road…

First application

Why Neutralino instead of the common Electron? Because Electron creates big executables. If you take a look at the statistics provided on Neutralino, you will find lots of benefits.

The start was very quick and pleasant. The installation itself was as simple as possible with npm:

npm i -g @neutralinojs/neu

Next, I bootstrapped a new application:

By the way, I’ve put together a small collection of tools I use regularly — things like time tracking, Git helpers, database utilities, and a few others that make development a bit smoother.

neu create code-library --template ts

I decided to use Typescript templates. More advanced ones, like Vue, Angular, React, should be added in the future. That’s a pity.

Furtunately, it was easy to build and worked immediately:

neu build ; .\neutralino-win.exe

Then I tried to understand the folder structure:

  • code in /app/assets/*.js and /src/*.ts
  • HTML in /app/*.html
  • styles in /app/assets/*.css and /src/*.css
  • and there is a mysterious file /src/index.d.ts
  • nearly all source files start with the MIT License comment
  • .gitignore does not include all ignores (like log or built executables)
  • executables are built in the root folder, always named neutralino-*
  • wrong application name in settings*.json
  • and there is a GitHub configuration that displays sponsorship for the original author in your repo

I wouldn’t be surprised of most of that if I cloned the Neutralino project, but I used a command-line tool to create a new, empty project.

The documentation is very short and presents the main concepts. I haven’t found many answers there. For example, I changed the application name in the the settings.json file and the application stopped working. Because I used a space in the project name. No error during compilation, no information in the documentation.

As for the file structure, I discovered that:

  • source HTML templates are in /app/*.html
  • source code files are in /src/*.ts (except for “built-in” index.d.ts). These files are compiled to /app/assets/app.js
  • source CSS files are in /src/*.css and included in the .ts files. They are compiled to /app/assets/app.css

So some sources are in /app/ and some in /src/. And the former contains built assets too. That’s quite confusing.

Capabilities

Neutralino says its “Javascript API offers access to OS level functions”. Don’t be too excited, as you can barely:

  • read the settings JSON file
  • read and save application’s data (the documentation says that you retrieve the data by providing a key, but save it by providing only an object without a key – I’m not sure how it works)
  • create, remove, delete directory and file
  • run an “OS command”. Maybe that’s a shell command?
  • get an environment variable
  • show the file open/save dialogs (that’s a nice thing)
  • exit the application, print debug message and check RAM usage

I bet there is a Node module that allows you to do pretty anything missing here, but there is no knowledge in this project.

Electron

I really appreciate Neutralino, but it’s far from being useful for anything serious yet. First, it lacks consistency and legibility. Second, it lacks documentation. Third, it lacks lots of OS API. I wish it all good, though now I will have to switch to Electron.

Neutralino cannot be compared to the maturity and popularity of Electron. It’s enough to check its API or take a look at the applications created with Electron. As it’s much older, there is lots of knowledge on the internet, in articles, questions, and in sample open-source applications.

Read next

4.3 3 votes
Article Rating
Subscribe
Notify of
guest
1 Comment
Inline Feedbacks
View all comments
Tonio Loewald
Tonio Loewald
4 years ago

Thanks for taking the plunge. Neutralino looked promising but your experience matches my instinct.

That fact that the developer(s) is wasting time on integrating TypeScript, Angular, React, etc. points to poor judgment. Those aren’t part of the problem this project solves and they’re not something the nwjs or electron folks have bothered to do despite far more maturity and support.

In the end, the ~100MB tax for Electron is actually a pretty small price to pay for not needing to worry about browser differences (and having something that actually works and has documentation.)

1
0
Would love your thoughts, please comment.x
()
x