YodaOS: A modern OS for Node.js community

Yorkie Neil
4 min readFeb 11, 2019

Hello, We’d like to announce that the YodaOS is open source now. It holds the Rokid’s technical resource on artificial intelligence and voice user interface fields for past 4 years, and select the Node.js as the first-class programming language, all is open to community.

YodaOS Architecture

The architecture of YodaOS is similar to Android, it also consists of Linux kernel, system services and application framework from bottom up. However YodaOS owns the following differences:

  • Developer can directly use Node.js to create native application / skill.
  • An AIAL(artificial intelligence abstract layer) is provided, developer could use the APIs like voice trigger, speech recognization, face detection in Node.js.

YodaOS supports the following except for the Node.js core APIs:

  • Built-in voice trigger and speech recognization API, it’s called the voice interface system that easy to use(develop).
  • Built-in APIs includes: volume control, power manager, bluetooth, multimedia player, LED effects and OTA service.
  • To IoT developers, we provide a built-in WebSocket and MQTT implementation as client-side.

YodaOS could run some of NPM packages, developers could use packages at YodaOS by your need, however we don’t recommend those packages looks too heavy, in considering that YodaOS must support those low-and-medium-end device, sometimes we have to take account of memory and performance.

In some cases, we have to use some packages, those are implemented heavily(namely too many dependencies), A generic answer is N-API at YodaOS. We could use N-API to bridge the C/C++ libraries with the same function, and ensure they own the same API.

Besides, developers could port any C/C++ library to JavaScript land by N-API. In other words, the N-API to YodaOS is similar as JNI to Android.

Why Node.js

In previous section, YodaOS tends to embrace the Node.js and Node.js developers, the most important reason is that Node.js gets more pop and be ripeness from the lightweight Web Server defined by Ryan Dahl, to today’s express, koajs, fastify and egg framework in past 10 years.

Based on the Node.js runtime, derived from grunt and gulp at the building field, nowadays we have webpack, parcel and others. There are such many outstanding projects are born everyday at Node.js community. Node.js is leveraging the imagination of every developer. Rookies can find anything that they want. Even in the community, there is a long-standing famous sayings:

“any application that can be written in JavaScript, will eventually be written in JavaScript” — — Atwood’s Law

Of course, the above is just an interesting introduction. What YodaOS wants to do is to enable Node.js developers to enter the voice interaction and embedded world with a lower threshold even zero.

Node.js and ShadowNode

Although YodaOS is similar to Android, the problem solved and the target device are not the same. For nowadays cheaper mobile phones, Android developers hardly have to worry about performance. However, for smart speaker, IoT edge and other embedded devices, hardware resources are usually very scarce. In this case, the OS solves the problem of “saving resources and better experience to develop”.

For the low-and-medium-end products (128MB — 256MB), we created ShadowNode to solve this problem. It is a Node.js runtime developed by Rokid based on Samsung IoT.js. It has more fast speed to bootstrap and lower resource usage, compared to IoT.js, it:

  • provides better error stack and perf tools
  • support for N-API-based cross-runtime module execution
  • performance optimization for specific chips, such as AmLogic A113 and Kamino18

With the ABI compatibility features of N-API, we have achieved runtime compatibility with the OS upper framework and applications. For example, developers can choose to run YodaOS on more advanced devices. At this time, memory and flash are no longer bottlenecks. Developers only need to use the official Node.js runtime to get optimized execution by v8 without any changes.

Summary

With YodaOS, we want to fill the gaps in embedded development for the Node.js community. It allows us to return to the familiar “front-end” development with this intimate language.

Go https://github.com/yodaos-project/yodaos to join us if you are interested.

--

--