Microsoft Introduces dynwinrt: A New Way to Bring Native Windows APIs to Node.js (No C++ Required)
Microsoft has released a public preview of dynamic Windows Runtime API projections, enabling Node.js and Electron developers to access native Windows APIs without C++ bridges.
Microsoft's new toolchain bridges the gap between JavaScript applications and native Windows Runtime APIs.
- Microsoft has launched a public preview of dynamic Windows Runtime (WinRT) projections for the Node.js environment.
- The toolchain allows Electron and Node.js developers to call native Windows APIs, including on-device AI and notifications, directly from JavaScript or TypeScript.
- It eliminates the need for manual C++ or C# wrappers, app-specific native addons, or complex node-gyp configurations.
Direct Access to Native Windows APIs
Microsoft has announced the public preview of a new dynamic Windows Runtime (WinRT) projection for Node.js. This development aims to simplify how developers building Windows desktop applications with JavaScript and TypeScript interact with the operating system's native features. Traditionally, accessing WinRT APIs—such as those for on-device AI, system notifications, or advanced file management—required developers to build bridges using C++ or C#. This process often involved manual translation of WinRT types, management of asynchronous behaviors, and the maintenance of wrapper code for every exposed API.
According to the official #ifdef Windows blog, the new projection allows an Electron app or a standard Node.js process to call supported WinRT APIs directly. By using a single npm package, the associated tooling generates JavaScript wrappers and TypeScript declarations for specific Windows features. This approach removes the requirement for app-specific native addons and complex build tools like node-gyp.
The Shift to Dynamic Projections
While the Windows Runtime already supports static language projections for languages such as C++, C#, Rust (windows-rs), and Python (PyWinRT), this new projection introduces a different model for the Node.js runtime. Unlike static projections that require a native binding for each specific API, the Node.js projection generates JavaScript wrappers. A shared runtime is then responsible for dispatching these calls at execution time.
The system relies on Windows metadata (.winmd files). Because it is metadata-driven, developers can add compatible APIs by rerunning the generation tool against the updated metadata rather than rebuilding the entire project. This enables a more agile workflow where updates to Windows API patterns can be integrated without waiting for hand-authored wrappers to be updated by third parties or Microsoft itself.
Key Capabilities and Supported APIs
The projection supports a wide array of non-UI APIs, providing JavaScript developers with capabilities previously reserved for native languages. One of the primary focus areas is on-device AI. The projection enables access to text generation, summarization, rewriting, and image description features. It also allows for the integration of Windows ML models and execution provider catalogs.
Beyond AI, the projection facilitates the use of system and device-level functions. These include rich notifications (using AppNotificationBuilder), file and folder pickers, storage management, image decoding, and access to the system clipboard. It also extends to low-level system APIs for networking, sensors, globalization, and cryptography. Notably, the same metadata-driven workflow can be used to project custom WinRT components, allowing developers to expose their own native Windows logic to JavaScript.
The Technical Architecture
The projection is distributed via three primary npm packages, coordinated by a central command-line interface. The core package is @microsoft/winappcli, which handles the manifest, SDK metadata, and projection generation. The second package, @microsoft/dynwinrt-codegen, is responsible for reading the .winmd metadata and emitting the corresponding JavaScript wrappers and TypeScript (.d.ts) declarations. The final component, @microsoft/dynwinrt, serves as the prebuilt x64 and arm64 runtime that executes the actual API calls.
Setup for an existing project involves a straightforward initialization process. By running npx winapp init, the tool creates a manifest and generates the necessary bindings under a hidden directory. This process also updates the project's package.json to include a mapping for these generated entry points, ensuring that imports remain consistent regardless of the source file's location.
Workflow for Modern Desktop Apps
For Electron developers, Microsoft provides specific guides for integrating these native features. One common use case highlighted is the implementation of rich Windows notifications. While Electron has a built-in notification API, the native Windows App SDK notifications offer additional functionality such as progress bars, user inputs, and custom actions. By importing the generated bindings, a JavaScript developer can construct and show a native notification using syntax familiar to web developers.
Another significant implementation is the use of Phi Silica, a local language model available on Copilot+ PCs. The projection allows developers to call APIs like LanguageModel and TextSummarizer directly from the main process of an Electron application. This enables local, privacy-focused AI features without the latency or cost associated with cloud-based inference.
Future Development and Availability
Currently in public preview, the toolchain is designed to work with both x64 and arm64 architectures. Microsoft has also released the Electron on Windows Gallery, an open-source project that demonstrates these JavaScript projections in real-world scenarios, including interactive samples and documentation. As the preview progresses, the ability to project a wider range of Windows APIs and custom components is expected to streamline the development of high-performance desktop applications that leverage the full capability of the Windows operating system while maintaining the developer productivity of the JavaScript ecosystem.
Enjoyed this?
Get more posts like this delivered to your inbox.
Datalab Launches Marker 2.0: An Open-Source PDF-to-Markdown Tool Built for RAG Pipeline
Next →Microsoft Announces v2.0 of Official MCP C# SDK: Stateless by Default & Interactive via MRTR
Related Articles
Microsoft Announces v2.0 of Official MCP C# SDK: Stateless by Default & Interactive via MRTR
4 min read
Anthropic Releases MCP 2026-07-28 with Stateless Core and Extensions
5 min read