3

I have used Electron for many years and like the fact that I can deliver a frontend app that has a bunch of backend services (connections to databases etc) that can be bundled in a dmg.

Electron is however a bit heavyweight and I have been looking at NeutralinoJs and Tauri to see if I can do the same. I've tried NeutralinoJs and it's certainly good for bundling a frontend app but it appears not have any mechanism for writing backend services and being written in C++, I suspect this is unlikely to happen.

Does Tauri allow you to write backend services in Rust - I can't tell from the documentation.

jmc42
  • 359
  • 5
  • 22

2 Answers2

5

You need to understand how NeutralinoJS Works.

NeutralinoJS written in C++ starts a server on the specified port in neutralino.config.json

"port": 0,

port 0 means Neutralino will chose a random port and start the server on it which serves all the content inside the folder we specified in the config file:

"documentRoot": "/resources/",

After starting the server Neutralino uses the native WebView APIs to start a new window and tells the WebView to load the URL we want, in our case it will be 127.0.0.1 with the port we specified.

but since this WebView can't directly modify our storage or get information about the computer, Neutralino has some Pre-Defined APIs written in C++ to view and edit information on our computer.

since we use JavaScript, the Author of Neutralino has provided us a bridge using which we can access all the Pre-Defined APIs written in C++, and this bridge which provides us this stuff is neutralino.js.

neutralino.js handles all the communication between our WebView and the Neutralino Process.

the path of neutralino.js is also defined in the config file:

"clientLibrary": "/resources/js/neutralino.js",

So if you want to work with the "Backend", you have 2 options you can either directly add those APIs in the Neutralino's Source Code or you can use a better way to work with BackEnd in Neutralino called "Extensions".

Aditya
  • 1,132
  • 1
  • 9
  • 28
2

Yes, it's a core feature. Here's their guide about Rust commands that can be called from Javascript: https://tauri.studio/en/docs/usage/guides/command

According to their roadmap, support for C-interop languages like Go, Nim, and Python is underway.

gcaptain
  • 21
  • 2
  • 4