Notes on embedding NodeJS

Aug 22, 2016 00:00 · 190 words · 1 minute read nodejs interoperability

After writing a CPython + Go (cgo) project, I spent the weekend planning a similar thing with NodeJS.

Some notes about this experiment:

  • V8 seems to be very well documented, but the NodeJS documentation for this purpose isn’t enough (and some of the NodeJS docs point to V8 embedder’s guide): V8 != NodeJS
  • Native Abstractions stuff seems to be more oriented to “call C++ from NodeJS” situations (and my use case requires the opposite).
  • Most of the projects that embed NodeJS keep their own forks of it, see Electron or plnode.
  • I discovered jxcore, it has a nice API but the company stopped the development.
  • It would be very useful to have an embedding API like the one offered by CPython or Ruby, I ended up hacking the entry point functions!
  • Be prepared to deal with the libuv API, it’s the safest way of interacting with NodeJS.
  • A related talk, from NodeSummit.
  • node-chimera is a PhantomJS alternative, the browser part is powered by Qt and it features a very clear interaction with the NodeJS environment. I think this project is a good starting point for research.
  • A post about buffers.