ScriptsMay 9, 2026·3 min read

NW.js — Build Desktop Apps with Web Technologies

NW.js lets you call Node.js modules directly from the DOM, enabling desktop application development using HTML, CSS, and JavaScript without a separate backend process.

Introduction

NW.js (formerly node-webkit) merges the Chromium rendering engine with Node.js into a single runtime. It allows developers to build cross-platform desktop applications using standard web technologies while having full access to the Node.js API from within the browser context.

What NW.js Does

  • Runs HTML/CSS/JS as native desktop applications on Windows, macOS, and Linux
  • Provides direct access to Node.js APIs from the DOM without IPC
  • Supports Chrome DevTools for debugging desktop apps
  • Enables packaging apps into standalone executables
  • Offers both normal and mixed-context modes for flexible architecture

Architecture Overview

NW.js integrates Chromium and Node.js at the event-loop level, sharing a single V8 instance. Unlike Electron which separates main and renderer processes, NW.js merges both contexts so that Node.js modules can be called directly from the DOM. The framework patches Chromium to inject Node.js bindings into each window context, giving web pages native capabilities without message passing.

Self-Hosting & Configuration

  • Install via npm (npm install nw) or download pre-built binaries from the releases page
  • Configure through package.json with fields like main, window, and node-remote
  • Set window.width, window.height, window.toolbar to control the app window
  • Use nw-builder or nw-packager to create distributable binaries for each platform
  • Enable node-remote to grant Node.js access to specific remote pages

Key Features

  • Single context: call require() and use fs, http, or any Node module directly in the browser
  • Chromium-based: supports modern web standards, WebGL, WebRTC, and CSS3
  • Source protection: compile JavaScript to V8 snapshots to protect intellectual property
  • Transparent windows, kiosk mode, and system tray support for native look and feel
  • Supports Chrome extensions and DevTools out of the box

Comparison with Similar Tools

  • Electron — separates main/renderer processes with IPC; NW.js merges them into one context
  • Tauri — uses the OS webview and Rust backend for smaller binaries; NW.js ships full Chromium
  • Neutralinojs — lightweight alternative with smaller footprint but fewer Node.js APIs
  • CEF (Chromium Embedded Framework) — C/C++ focused; NW.js targets JavaScript developers

FAQ

Q: How does NW.js differ from Electron? A: NW.js runs Node.js and Chromium in the same context, so you can call require() directly from a <script> tag. Electron uses separate processes that communicate via IPC.

Q: Can I protect my source code? A: Yes. NW.js supports compiling JavaScript files into V8 snapshots, which are not easily reverse-engineered.

Q: What platforms are supported? A: Windows (32/64-bit), macOS (x64/arm64), and Linux (32/64-bit).

Q: Is NW.js still actively maintained? A: Yes. It tracks upstream Chromium releases and publishes regular updates that follow the latest stable Chrome version.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets