node-api-dotnet is a JavaScript (Node.js) library that provides high-performance, in-process interoperability with .NET applications. It enables seamless bi-directional communication, allowing JavaScript applications to load .NET assemblies and invoke .NET APIs, and conversely, enabling .NET applications to interact with JavaScript packages and APIs. The package is currently in 'Public Preview' (version 0.9.19), indicating active development with potential for minor breaking API changes in future releases. It differentiates itself by leveraging Node-API (N-API), ensuring broad compatibility across Node.js versions without recompilation and support for other Node-API compatible JavaScript runtimes. Key features include TypeScript type-definition generation for .NET APIs, robust async/await support for .NET Tasks and JavaScript Promises, and efficient handling of data streams, providing a more integrated and performant alternative to inter-process communication solutions for mixed-language applications.
Verified import paths — ran on the pinned version, not inferred.
The module exports an object containing .NET namespaces as properties. For ESM, use a namespace import (`* as`) to access the full structure. For CommonJS, use `const dotnet = require('node-api-dotnet');`
Specific .NET types like `System.Console` are exposed as nested properties of the main `node-api-dotnet` module export, not as direct named exports from the top-level module.
While `node-api-dotnet` ships with TypeScript type definitions, use `import type` when only referencing types to ensure the import is optimized away during compilation and doesn't cause runtime errors if the symbol is not a live runtime export.
Demonstrates importing the .NET interop module, calling a static .NET method, accessing a static property, and instantiating/using a .NET class (StringBuilder) from JavaScript with TypeScript.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.