8 minute read

NodeOS: The JavaScript Based Operating System

Danny is a PHP developer with a proven knack for coding efficiently and solving problems rapidly.

I am sure most programmers have heard of Node.js, but what about NodeOS? Yes, NodeOS, an operating system written in Node.js. Well, kind of. NodeOS uses the Linux kernel for most performance critical stuff like, for example, hardware interactions, but for everything else it uses Node.js. NodeOS development started two years ago and was created by people who shared a simple, but intriguing, idea: “Is it possible to create an operating system using only Node.js?”

Darwin’s evolution chart

Is it possible to create an operating system using only Node.js?

What is the big deal?

First of all, think about the progress Node.js has made in the short time it’s been around. Now, think about the same thing happening with an operating system. Then, let’s add some cool stuff to it.

Per-user independent and isolated root filesystem

NodeOS introduced an interesting paradigm: If all users have an isolated filesystem, it gives them a simple filesystem hierarchy to work with. Since their “home folder” is, in fact, the root of their own filesystem hierarchy, they can install packages globally without requiring special permissions and not need to configure anything since they are installed in their home directory by default. Also, it provides a good deal of security; if a hacker finds a way to get inside a particular account in the operating system, the only partition that s/he can access is the partition of that user. The end result is hacker cannot compromise the whole system.

Node.js and NPM

If you think about it, an operating system that uses Node.js means that any package available in NPM is, at the same time, also a NodeOS package. At the time of writing, there are 210,735 packages; since the number of NPM packages grows every minute, it would not be strange if, in a few years, NodeOS has a million applications.

It is based on the Linux kernel

This might not seem like a big deal, but Linux is the most-used server operating system. Since NodeOS is based on the Linux kernel, you could run every application written for other Linux distributions with minimal changes.

The downsides

As much as I would like a finished NodeOS, it is not there, yet. It’s still missing many key functions for a server operating system. For example, the whole BASH toolset is missing, including ps, tail, nano and grep. Furthermore, you cannot run it as a desktop operating system since it has no GUI. Sure, you can implement some of the missing features fairly easily using a bit of JavaScript, but the fact all the mentioned features are not available by default, is not good.

So, how can I try out NodeOS?

Using Docker

The easiest and quickest way to try out NodeOS is by using the following:

  1. A computer with either Mac OSX or Linux. It might work with Windows, but I did not try it.
  2. Docker.

Once you installed Docker, running an instance of NodeOS is easy. All you need to do is execute the following command, and Docker does all the magic:

sudo docker run -t -i nodeos/nodeos

The easiest and quickest way to try out NodeOS is by using Docker

The easiest and quickest way to try out NodeOS is by using Docker.

When you run the aforementioned command, Docker automatically downloads the disk image for NodeOS from a repository and performs the installation of NodeOS inside a virtual machine. Once the installation is completed, it opens an SSH session to the NodeOS shell.

Without docker

There are some reasons why you would want to avoid using Docker, and one being the latest NodeOS version. At the time of writing, the last change to the Docker image of NodeOS was performed two months ago, while the development version was updated six days ago. So, if you want to use the latest version you should definitely get the source code. That’s not too difficult, but it takes a long time. You will need:

  1. A computer with Linux. You can compile it on OS X, but it will take longer since it has to make a cross compilation. The same goes for Windows.
  2. The Linux build utilities (make, g++, gcc, autoconf).
  3. Qemu.
  4. Time. Seriously, a lot.

Once you have everything, you can proceed with the source code compilation:

  1. Download the project source code: bash git clone [email protected]:NodeOS/NodeOS.git.
  2. Compile it by running following commands: cd NodeOS and npm install.
  3. I am going to quote, word by word, the official documentation: “Pick some microwave popcorn and go to see a movie. No, really, do it.”. Yes, it will take that much time, so do something interesting in the meantime.
  4. Run bash npm start to run NodeOS inside Qemu.

Is it working?

Once the installation is completed, we can check if it is working by executing inside the NodeOS shell the command ls. An output like this should show up:

[ 'etc', 'lib', 'lib64', 'root', 'bin', 'sys', 'usr', 'share', 'proc' ]

If it does, it means some basic commands are working. But, what if we want to display the network card’s IP address? Under Linux, there’s a command called ifconfig that does just that; let’s try it:

command not found: ifconfig

It looks like the command ifconfig is missing. That is because NodeOS does not have a default ifconfig command. Now, what? Well, it is simple; NodeOS has an integrated package manager (like apt or yum), called npkg, which is based on Node’s NPM and is easy to use. Installing ifconfig is as simple as running the following command:

npkg install bin-ifconfig

If all went well, the command ifconfig should now be available in the shell. If we try to execute it again, an output like this shows up (I put a random MAC address and IP address for obvious reasons):

  ether 01:23:45:67:89:ab 
  inet6 f0cd::ef01:0203:0405:181%en1 prefixlen 64 scopeid 0x5 
  inet netmask 0xffffff00 broadcast
  nd6 options=1<PERFORMNUD>
  media: autoselect
  status: active

If your output looks kind of like that, then it is working. You’ve successfully installed your first NodeOS application: ifconfig.

It is working. However, what do we do now with the OS?

What is the point of having an operating system written in Node.js if you can do the same things (or even fewer things) that you can do on Ubuntu or any other Linux distribution? Well, the whole point is everything is developed by using nothing more than Node.js. It also means we can develop our applications using nothing more than Node.js. For example, NodeOS does not have a default implementation for the command man, which is used on Linux to display manual pages of other commands. Fear not, implementing it is easy. How, I hear you ask? Simple.

Building a NodeOS application with Node.js

First, let’s install a text editor called Hipster so we can create and edit files by executing the following command: npm install -g [email protected]. This file editor is simple, and definitely not something I would use as an editor for anything else, but it is good enough in this case. Creating files with Hipster is really simple, just run hip filename, like hip package.json; to save press Ctrl + s and to exit press Ctrl + q. For this example I am going to use a code developed by one of the main NodeOS developers, I have not actually implemented it, myself. The original code for our example can be found in the node-bin-man Git repository.

Let’s get back to creating our first NodeOS application. As with every Node.js application (or NPM package), we start by creating a package.json file, as in the following example:

  "name": "bin-man",
  "version": "0.0.1",
  "description": "Format and display manual pages",
  "bin": {
    "man": "man.js"
  "repository": "",
  "author": "groundwater",
  "license": "MIT",
  "dependencies": {
    "blessed": "~0.0.22"

The parameters name, version, author, repository, license, and description are self-explanatory. The bin collection is a JSON key/value object containing the command name and an associated JavaScript file. In our example, the man command is associated with the file man.js. The collection, dependencies, contains a list of NPM packages that are needed to use this application. In our example, the author of the code included Blessed, a curses-like library with a high-level terminal interface API for Node.js.

Now let’s go to the main part, the actual code.

#!/usr/bin/env node

This part is called “shebang”. It is not actually required by NodeOS, but it tells an operating system how to execute the following code. In our case, it tells the interpreter that everything needs to be executed with the command /usr/bin/env node.

var fs = require('fs');
var blessed = require('blessed');

Just like in Node.js, the function require() loads the selected package into memory and saves it to the specified variable.

var arg = process.argv[2] || 'bin-man';

The standard behavior of a man command is to tell a manual about itself if no other command is specified. Our code example is doing the same: If no argument is specified for the second parameter (the first being man itself), it defaults to bin-man.

var path = process.env.HOME + "/lib/node_modules/" + arg + "/";

  var readme = fs.readFileSync(path, 'utf-8');
  console.log('No for Package ',arg);

At this point, the program checks if a readme file exists for the given application. In NodeOS, the installation path of every application is the home directory (or /) followed by the directory lib/node_modules. If the file exists, it saves its content inside the variable readme. Otherwise, it shows an error and exits the process.

// Create a screen object.
var screen = blessed.screen();

var box ={
  content: readme,
  scrollable: true,

// Append our box to the screen.

Blessed has a really simple API; showing the content of a file is as easy as telling it to create a box and loading the content.

screen.key(['escape', 'q', 'C-c'], function(ch, key) {
  return process.exit(0);

Now, let’s create a way to exit the man application. We combine the keys escape, q or the emacs-style combination C-c to exit the process.

screen.key(['space','f','j','n'], function(ch, key) {

screen.key(['down'], function(ch, key) {

screen.key(['up'], function(ch, key) {

screen.key(['b','k','p'], function(ch, key) {

We use the directional keys to scroll up or down one row and the keys space, f, j or n to scroll down a page (as many lines as there are on the screen). Use b, k or p to do the reverse.


Finally, we tell the application to focus on the box we created and render the whole thing. Let’s put those files in the directory /lib/node_modules/bin-man and let’s add a simple, something like this:

# Man

Author: @groundwater

## Install

npkg install bin-man

## Usage

Usage: man PKGNAME

Display a packages file

We are almost done with our first custom application for NodeOS. Only one last small step remains; we need to create a config file since it is a requirement for NodeOS applications. It is as simple as creating a file in the path /etc/bin-man/config.json with the following content: {}, an empty JSON object. Now, we can try our new application. Running man inside the NodeOS shell should show the readme file we created earlier.


As you can see with our simple code example, implementing anything in NodeOS is an easy task, you only need to know Node.js.

NodeOS has plenty of potential, and I think it could become a great operating system once additional features are implemented. It still needs work, but as a result of the popularity of the whole Node.js-based ecosystem, I would not be surprised if it quickly becomes a popular operating system quickly. What do you think about it? Let me know in the comments.


Eric Link
I could see this changing the Linux OS by opening it up to a much broader group of contributors. Much like Drupal did for content management.
The phase 'Just because you can doesn't mean you should!' comes to mind. Some people just have way to much spare time......!
Jesús Leganés Combarro
Thank you for your post, by far the best that I've read! :-D The pictures are really cool, too :-) Can I be able to put them on our media repository ( We would obviously give credits to you or whoever is the author... :-D
Nazar Hussain
When I tried "npkg install [email protected]" it showing me error [Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE]... Can you suggest solution to it?
I agree! Now any JS dev can contribute to the OS and it's CLI tools.
people who watch TV have too much spare time, this is some interesting stuff actually!
I am sorry, but NodeOS seems like completely dispensable to me. Well, the author himself also sees this, but the arguments for NodeOS (like "It also means we can develop our applications using nothing more than Node.js") are weak at best. You can already do this with a standard GNU/Linux system. The whole point of reinventing the wheel, just so that is written in Node is, seems quite useless. And I also think it is a nearly impossible task to recreate a complete ecosystem once again. And for what gain? I don't see any.
Luboš Volkov
Hello, Toptal is author of those images :)
Jesús Leganés Combarro
Npkg is deprecated, use npm directly. Yes, we need to update the docs, but we don't have time, pull-requests are welcome :-)
Jesús Leganés Combarro
Cool! Is it just enough to give them credit for the images? :-)
Danny Morabito
Thank you for reading this post, I'll change that very soon!
Jesús Leganés Combarro
Hi Danny! If you update the post, please put that the easiest way to test NodeOS is by using any of the pre-generated QEmu and ISO images that can be found on the GitHub releases tab, since Docker images are outdated. Once this is done, the article will be perfect ;-)
Honestly the picture depicts of someone who haven't had slight notion of how powerful and fast Unix n Linux are.I started to feel toptal is not at the same level it was 2-3 years back. A kid knows javascript and thinks it should overwrite all systems , that just made my day.
Kids these days!
Marko Vuksanovic
Agreed, one of those completely useless arguments.
Grzegorz Pawlik
I somehow fail to see (and this article didn't explain) how NodeOS is an OS. Is it? It looks more like linux with node envs set up. I mean - this part about separate filesystems is cool and worth expanding - how do they achieve that? And since it's Node.js OS - the only servers I can run there would be written in Javascript? So no nginx. redis, no postgreSQL. It doesn't feel like OS it feels like Node container.
Jay Vercellone
I think (hope) that its evolution should focus more on replacing the Linux kernel (the actual OS here) with Node.js code. Otherwise, it's just an application layer on top of an OS, which doesn't provide much. Let's see!!
Francis Kim
I'm gonna give this a shot tomorrow, thanks for the write up.
Dusan Jovanovic
Whatever is this it has an educational value. When finished go to next level. Please.
John DeRosa
"NodeOS uses the Linux kernel for most performance critical stuff like, for example, hardware interactions" LOLOLOLOLOL
Altiano Gerung
It is based on linux so.. you can have those things actually.
I can shed a little light on the subject for you. By being built off Linux, we mean NodeOS uses the linux Kernel, so NodeOS is a new os in the same way Android is. "I mean - this part about separate filesystems is cool and worth expanding - how do they achieve that?" During initialization of the system, the hard-drive is mounted. When a user authenticates, the system performs something of a chroot into their directory locking the user and everything to follow in that container. "And since it's Node.js OS - the only servers I can run there would be written in Javascript?" Fortunately that's not true. Inspecting NodeJS we realize it's simply a standalone V8. V8 is a c program. So if the OS can handle V8, the system is also capable of handling any programs in C, and other languages can be installed as you would on any other linux based distro. C is the default execution environment in most os's but JS is the default in NodeOS. This does not impede it from running C programs, I've tested it myself :) I hope that answers your questions! If you need more detailed answers, swing by the repository and we'll be happy to chuck more at you.
This is an interesting idea! The issue with this is that V8, the interpreter used in NodeJS and Google Chrome, which I'm sure you're familiar with, is as much a program as any other piece of software, and is built off the kernel. To replace the kernel we'd need to create our own interpreter to even run the js kernel, or have JS compiled to machine code. Fortunately I have been experimenting and trying to develop a js-like language to be compiled to machine code. It'll be a low-level edition of JS and a cool project. You'll find more on it on the NodeOS repo when I get started.
writing Kernel in JavaScript?! :| do you know what an operating system is?
Jay Vercellone
Any theoretical reason behind your question?
first of all, a java script code is really slower than the worst C code someone would write. second, to have an Operating system, you need to write some code to communicate with hardware directly. so there will be some machine dependent code that is often written in assembly language. after that you need to manage processes, memory, etc... and there will be no standard library to help you. so you need to write your own tools. when you use a high level language like Javascript, the interpreter is doing all this stuff for you. actually its the OS that does most of the hard work. to be able to launch lava script you need interpreter which needs a modern operating system. if you write something like java script engine from scratch that gives you machine codes, you need to write it using assembly or C. there should be some changes to language itself and I think the result will be a language like C.
I really recommend you to read a book about operating systems in general. something like:
Jay Vercellone
That's exactly what I meant when I said that the evolution of this sort of "OS" should focus on. At this point in time it's impossible to write a kernel using plain JS (as it's also de case with C, which is also a high-level language). My point here is that eventually all software execution is reduced to assembly language being executed by the CPU. The fact that C is the language of preference among virtually every OS doesn't mean there's a theoretical reason why we couldn't use any other language. C has more constructs to easily deal with memory, yes. But JS could have that in the future too. JS at this point is not (and I think it's not pretending to be) a low-level language suited to write an OS on its own, or at least not with a comparable momentum to the one we can observe in front-end/browser-based technology being developed currently (e.g. React, Angular, etc.). With that being said, I think that these kinds of projects (i.e. NodeOS) are only pet projects which the sole purpose of showing the capabilities of the node.js technology (IMHO, pure marketing). Nothing more, nothing less.
Jay Vercellone
Thank you for your suggestion. I've read the Stallings book on Operating Systems 3 times already, and have experience in embedded systems development and digital design. I'm not talking out of my ass here.
Kosicka Viktoria
node os runing on linux which is writen in I right? btw kernel isn't OS ......
Kosicka Viktoria
kernel or linux isnt OS
Richard Eng
I don't see the point in creating NodeOS other than as a proof of concept. Who's going to use it? Where is it going to be used? It may find some kind of weird little niche, but otherwise it'll be widely ignored. NodeOS cannot compete with the main Linux distros, such as Linux Mint, Ubuntu, openSUSE, Fedora, and elementary. Nobody will ever use NodeOS as a server OS to replace Linux/Unix. NodeOS will never replace Android nor iOS, so in what other smartphones will it find purchase?
tim filippone
Isn't that what a kernel should do? Are you suggesting it should be written in JS?
comments powered by Disqus