Application, BrowserWindow, and Webview.
1
Install WebviewJS
Add the package to your project:Make sure you have Node.js 24 or later and that your platform dependencies are satisfied. See the Installation guide for per-platform setup instructions.
2
Create your first window
Create a file called Run it:A native window opens and loads
app.mjs and add the following:app.mjs
https://example.com. Close the window to exit.Always store
BrowserWindow and Webview instances in variables that live as long as you need them. If you let these references be garbage-collected, the native handles become unreachable and their event listeners stop firing.3
Load local HTML
Instead of navigating to a URL, pass an Use the
html string to render content directly without a web server:html option for self-contained pages, prototypes, or any scenario where you want to serve content without a protocol handler or HTTP server.4
Handle window events
The Without the
Application instance is a typed EventEmitter. Listen for lifecycle events to react to user actions:application-close-requested handler calling app.exit(), the process stays alive after the last window closes because the event pump timer keeps Node running.5
Add IPC — page to Node
The page can send messages to your Node.js code using Click the button in the window — “ping” appears in your terminal and the page updates to show “Node replied: pong”.
window.ipc.postMessage(). Listen with webview.onIpcMessage():Going further: expose async functions
For a cleaner request/response pattern, usewebview.expose() to publish an entire namespace of Node.js functions directly to the page. Every exposed function automatically becomes a Promise in the browser context:
SerializationError.
Event Loop
Understand how the non-blocking pump works and how to control it.
IPC Messaging
Deep-dive into page ↔ Node communication patterns.
API Reference — Application
Full reference for the Application class, events, and options.
Build Executables
Compile your app into a distributable single-file binary.