Skip to content

Deep Dive: NW.js + Playwright #4

@chhot2u

Description

@chhot2u

NW.js + Playwright — Deep Dive Analysis

Overview

NW.js (formerly node-webkit) merges Node.js and Chromium into a single runtime. Unlike Electron, Node.js APIs are available directly in the browser context. Combined with Playwright for automation.


Architecture

┌──────────────────────────────────┐
│     NW.js Unified Runtime        │
│  ┌────────────────────────────┐  │
│  │  Node.js + DOM (merged)    │  │
│  │  - Direct require() in DOM │  │
│  │  - No IPC needed           │  │
│  ├────────────────────────────┤  │
│  │  Playwright Engine         │  │
│  │  - Shared process space    │  │
│  │  - 100 BrowserContexts    │  │
│  ├────────────────────────────┤  │
│  │  Dashboard UI              │  │
│  │  - React/Vue               │  │
│  │  - Direct Node.js access   │  │
│  └────────────────────────────┘  │
└──────────────────────────────────┘

Key Dependencies

{
  "nw": "^0.93.x",
  "playwright-core": "^1.49.x",
  "bullmq": "^5.x",
  "better-sqlite3": "^11.x",
  "react": "^19.x"
}

Strengths

  • Unified runtime: No IPC between main/renderer — simpler code
  • Direct Node.js in DOM: require('playwright') directly in browser context
  • Source protection: nwjc compiler for code protection
  • Familiar: Very similar to Electron but simpler model
  • Playwright integration: Same API, same capabilities

Weaknesses

  • Declining community: Smaller ecosystem than Electron
  • Heavy bundle: ~200MB (same Chromium overhead)
  • RAM hungry: ~3GB for 100 tasks
  • Fewer tools: No equivalent of electron-builder maturity
  • Security concerns: Merged context means less isolation
  • Slower updates: Chromium updates lag behind Electron

Resource Estimates (100 tasks)

Resource Estimate
RAM ~3 GB
CPU 4-8 cores
Disk ~400MB installed
Startup ~3s

When to Choose This Stack

✅ Want simpler code without IPC complexity
✅ Migrating from an existing NW.js app
✅ Need direct Node.js access in UI context

❌ Avoid if: starting fresh (Electron is better supported), need minimal bundle, or need strong security isolation


Verdict: 5.55/10

Simpler programming model but declining ecosystem and no clear advantage over Electron.

References issue #1 for full comparison

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions