A Rust library for creating native Node.js modules with idiomatic Rust code and automatic FFI generation.
node-bindgen is a Rust library that enables developers to create native Node.js modules by writing idiomatic Rust code. It automatically generates the necessary FFI (Foreign Function Interface) wrappers, handling type conversions, async operations, and class bindings, eliminating the need for manual boilerplate. This allows for high-performance extensions to Node.js with Rust's safety and concurrency features.
Rust developers who want to extend Node.js with native modules for performance-critical tasks, and Node.js developers seeking to integrate Rust libraries or write high-performance addons.
It drastically reduces the complexity of creating native Node.js modules in Rust by automating FFI code generation, providing type safety, and supporting modern features like async/await and JavaScript class bindings out of the box.
Easy way to write Node.js module using Rust
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Generates FFI wrappers automatically from Rust code, eliminating manual C bindings and reducing integration errors.
Node.js arguments are checked based on Rust types, preventing runtime type mismatches and enhancing reliability.
Async Rust functions map directly to Node.js promises, enabling non-blocking I/O without extra glue code.
Rust structs and enums can be exposed as JavaScript classes with methods, getters, and automatic serialization.
Requires configuring Cargo.toml, installing nj-cli, and managing build dependencies, adding complexity compared to pure JavaScript modules.
On Windows with Electron, a C++ compiler is needed for win_delay_load_hook.cc, introducing an extra toolchain requirement and potential setup issues.
Demands proficiency in Rust, which can be a steep learning curve for teams accustomed only to JavaScript or TypeScript.