Creating Rust-based NodeJS modules

Creating NodeJS modules with Rust - sample webapp session from Amora Labs on Vimeo.

The popularity enjoyed by NodeJS in the past years made it a lot easier for front-end developers to become fullstack developers while mastering a single language — Javascript — and thousands JS-based shops flourished. The non-blocking nature of NodeJS and the asynchronous ways of JS made it relatively easy to ship quality webapps while in parallel, the copious amounts of cheap CPU and RAM available on the cloud allowed developers to mostly ignore naive algorithms unless they were working on products at a scale that most developers don’t do such as Facebook and Google stuff.

In this article I’ll show you how to build Rust-based NodeJS modules by exploring how to improve a naive webapp bottleneck. I thought this was a better example than the standard hello world we tend to see in these type of article, still, there are many ways to solve the problem presented here and before complaining to me that the one true solution to this problem lies elsewhere, one should remember that this is a demo crafted to show the reader about NodeJS modules. What is presented here is not a real product. So without further ado, lets first check what is that we are building here.

Introducing Remote DB Lib

DB Lib is a minimalistic database library for LiveCode that works on Desktop and Mobile and allows you to build database-savvy apps without writing SQL directly. This post is to introduce a great new feature called Remote DB Lib. As you may know from posts on the How To Use LiveCode mailing list and forums, many developers would like to use DB Lib in their apps over the internet. Like all other database libraries that work on top of RevDB, DB Lib (until today) needed to connect directly to the database server to work and this is not a good solution for apps that work over the internet since exposing MySQL to the internet at large is a huge security risk.

Today I am releasing the first version of a drop-in replacement library called Remote DB Lib. This new library has the same API as the current DB Lib but instead of working on top of RevDB, it works alongside a matching PHP file on your server, it is this PHP file that actually talks to the database server. The Remote DB Lib picks all your DB Lib calls and packs it on an encrypted message that is sent to the PHP file where it is decrypted and executed. This library is using state of the art AES 256 encryption (you can also add a free SSL certificate from Let’s Encrypt to add even more security) to protect your data.

Cool Links of The Week #2

Links Bacanas da Semana