With Node.js it is also possible to create low level interfaces (addons) to for example execute libraries written in C, C++.
This can bring a performance advantage (but this is not necessarily always the goal... going from C++ to JavaScript has a significant cost). Sometimes it is also simply because the C/C++ libraries are already very complete and maintained (it would be potentially a waste of time to re-implement everything in JavaScript).
Some examples of NPM packages being native addons :
Moreover, to install these packages, you often need to install various dependencies to be able to compile them. I invite you to consult the installation section of Node-gyp if you were not aware of this. (There is also an option to install Node.js on Windows).
If this is a topic that interests you, I myself did a talk in 2019 to popularize and explain my first steps in creating native addons for my SlimIO project.
However, here is a complementary list of resources:
- Node-addon-api (For those who want to write code in C++).
- Node-gyp (This is the tool that you will use to compile your addon).
- Node.js addons examples
- Prebuildify
Documentation on GYP tool :
Talks on the native Node.js API :
- N-API - Next Generation Node API for Native Modules
- N-API: The Next Generation Node.js API is Ready!
- Next Generation N-API: A Hands-on Workshop
- N-API on JerryScript
Bonus:
Various links to make native addons with Rust rather than C and C++ :
- Node.js N-API for Rust.
- NAPI-RS
- Supercharge Your Node.js With Rust
- Heavy computation in Node.js with Rust - Jean Burellier