In this article Adrian Thierry tells us about NectarJS, this slightly crazy project that appeared on KickStarter recently allows you to compile JavaScript code natively to any platform, in WebAssembly or even in ASM.js.
Hello Adrien, and thank you for this interview, I first propose to introduce you:
Hello Mathieu, I'm a French entrepreneur, an IT security expert, and passionate about new technologies. I founded Seraum, an IT security consulting and training company, five years ago. I've conducted various research projects on online payment security and access security in general. I develop several security solutions and test them in real time on hackmyfortress.com , a hacking challenge that offers $30,000 to whoever succeeds in hacking it.
Can you explain to us what NectarJS is?
NectarJS is a cross-platform JavaScript compiler in SAAS, or CAAS (Compiler As A Service). It allows you to compile JavaScript from any platform, to any platform. Currently, it is possible to compile to Windows (32 & 64 bits), Linux (32, 64 bits and ARM), Arduino (UNO and Mega), in WebAssembly et ASM.JS. It is therefore possible to compile JavaScript from a Rasbperry PI 3 to an Arduino. I am talking about compilation, the result obtained is an executable binary file or firmware specific to the targeted platform. You can also compile from your Android phone to Windows or Linux. The development platform is no longer an obstacle. Within a team of developers, there will no longer be any need to worry about such a version of VM or such a test or compilation environment.

How did you get the idea for this project?
While running benchmarks, I discovered Crystal , which allows you to compile code very similar to Ruby. The compiled result is 5 to 10 times faster than NodeJS on HTTP requests. I had two choices to gain speed: migrate my NodeJS stack to Crystal (which is restricted to Linux), or compile JavaScript to improve speed. I opted for the second choice and obtained encouraging results very quickly. Various benchmarks confirmed my choices and motivated me to continue development. I posted a random news item on Hacker News that went viral (137 points and 78 comments).
This project really seems too crazy to be true, can you explain a bit how it works without giving the whole recipe?
NectarJS creates an AST (abstract syntax tree), and generates from it an intermediate language (IL) that can then be compiled to any platform. The NectarJS client, installed on machines wishing to compile, will simply encrypt the code and send it to the servers for compilation.
What are the current project limitations, can I compile my Node/Express application?
Not yet, we are at the beginning of development and we still have a lot of libraries to code or transcribe. We can already compile some pieces of the FS (FileSystem) or Process library of NodeJS, but there is still a long way to go. Eventually, there will be no limitations. We intend to completely compile JavaScript to the ES5 standard, then to ES6 and ES7. We also have the algorithm that allows us to compile “eval()” or “this.”.
How would I debug my natively compiled application?
There will be several ways to debug your application. The browser, via WebAssembly, can be a simple way to analyze the operation of its code with everyday tools. We also plan to integrate into NectarJS all tracing and debugging tools, which will allow compiling in debug mode and facilitate investigations. We really want to democratize development, and will do everything to make it as simple and efficient as possible.
Do you think your project could eventually replace native mobile app languages?
If it is widely adopted, it could replace many things: mobile development, but also IoT development , server-side development, web development… With NectarJS, JavaScript becomes universal and efficient. Anyone can code with anything; computing power is irrelevant since NectarJS servers do the work. NectarJS also reduces energy consumption, thus making computing more environmentally friendly.
It is also possible to allow people with limited means to code: a simple Raspberry allows you to develop for any type of platform with NectarJS.
NectarJS allows a JavaScript developer to be as efficient as a low-level developer. Some benchmark shows that some mathematical operations compiled with NectarJS is faster than C.
NectarJS can also be used in environments where speed is a key success factor (algorithmic trading etc).
Has the project already been very successful?
We are in contact with companies that want to use NectarJS every day. Starting a community from scratch is very complex, and the crowdfunding campaign on KickStarter lets me see the communication issues and developer resistance to change. For many, JavaScript is not a programming language but a scripting language. However, Paypal and other large groups use JavaScript with NodeJS on a daily basis. I am in contact with several well-known developers in the JavaScript community (NativeScript for example), who support the project. A lot of people think it's fake, which is a shame.
NectarJS made the buzz in Japan for example, and was relayed on many news sites in a very short time. I am now looking to do the same in the United States and in Europe.
If the KickStarter project works what would be the next steps?
Finish compiling the ES5 JavaScript standard, and then move on to NodeJS. At the same time, we will very quickly add the missing platforms to the compilation (Mac Os, various Arduinos and development platforms). We will also set up a marketplace for developers to donate or sell code or libraries. The goal of the campaign is to allow the community of developers to choose the next improvements of NectarJS.
In the event that the campaign fails, we have private investors as backup, but the development choices will be made in priority for their needs.
The final word ?
To all those who love JavaScript or who are passionate about technology, robotics or AI, do not hesitate to circulate the information and the crowdfunding campaign: http://kickstarter.com/projects/adrien-thierry/nectarjs-compile-javascript-for-and-from-any-devic
Thank you very much for this Interview Adrien and good luck with your project.
Matthew Breton, CTO of JS-Republic.
[actionbox color=”default” title=”” description=”JS-REPUBLIC is a service company specializing in JavaScript development. We are an approved training center. Find all our technical training on our partner site dedicated to Training” btn_label=”Our training” btn_link=”http://training.ux-republic.com” btn_color=”primary” btn_size=”big” btn_icon=”star” btn_external =”1″]
