Node.js for Embedded Systems
C C++ Other
Switch branches/tags
Nothing to show
Clone or download

README.md

mininode - Node.js for Embedded Systems

MIT LicensedBuild StatusFuck it! Ship it!

This is libuv, http-parser, mbedtls, libslz, and lowzip held together with duktape. The goal here is to produce an implementation of the Node.js 6.9.2 API with a full-fledged Javascript interpreter in a single binary with no runtime dependencies other than a standard C library.

This aims to implement the Node.js standard library entirely in C.

This is very early in development. Any feedback is very welcome!

NOTE: PRE-ALPHA QUALITY!

I've posted this for early feedback and to receive input during the development process, but this is not close to being usable. I intend to borrow a lot of code from Dukluv and track the upstream Duktape development process, but any thoughts (in, say, the form of issues) would be appreciated!

Notes on Compatibility

While this aspires to be compatible with the Node 6.9.2 API, it does not aspire to be tit-for-tat compatible with every nuance of the V8 Node.js runtime. Since the standard library is written in C (as opposed to Javascript), it may not be possible to (for example) access the prototypes of built-in modules unless this has been explicitly implemented. Remote debugging in Chrome is challenging, but I don't want to completely rule out the possibility.

So, while I'd like for the overall development experience to be very similar, code which is heavily dependent on the features and internal behavior of the mainline Node.js runtime will likely need to be ported.

Build Instructions

This uses GNU make and it is currently being developed on MacOS X and Linux, other systems are not yet supported but this should also work on Illumos/Solaris and *BSD (possibly with minimal porting effort).

Either gcc or clang should work, just set the CC environment variable.

From a MacOS X system:

git clone https://github.com/mininode/mininode.git
cd mininode
git submodule init
git submodule update
make defconfig
make
make install
make uninstall

For use on embedded systems, musl libc and Linux are recommended (in general).

Developing with Vagrant

The included Vagrantfile runs the Alpine Linux edge release and is meant for Virtualbox 5 on MacOS hosts. It mounts the mininode sources at /mininode via NFS. It will update to the latest edge release on the first boot.

Note that this assumes you've done git submodule init and git submodule update on the host system.

vagrant up
vagrant ssh
cd /mininode
make defconfig
make
make install

What's the point?

This is intended aid in rapid development of small embedded clients, with realistic requirements of ~75mhz and 2MB RAM although less might be workable. Since this will likely never approach the performance of V8 as a javascript interpreter, you will almost certainly want to continue using mainstream Node.js for servers unless you are prepared to write the bulk of your hot path in C using duktape.

Signed Tags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