Desktop application development with NW.js

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Desktop Application Development with NW.js

NW.js (formerly node-webkit) is a framework for desktop applications combining Node.js and Chromium in a single process. Unlike Electron with separated main and renderer, in NW.js Node.js API is available directly in the DOM context. This simplifies some scenarios but creates other security issues.

Key Difference from Electron

In Electron: renderer → IPC → main → Node.js API. In NW.js: renderer directly calls require('fs'), require('path'), etc.

// In NW.js this works directly in browser code
const fs = require('fs');
const os = require('os');

document.getElementById('hostname').textContent = os.hostname();
fs.readFile('/etc/hosts', 'utf8', (err, data) => {
  document.getElementById('hosts').textContent = data;
});

For small utility applications this is indeed more convenient. For complex applications — harder to reason about security.

Creating a Project

npm init -y
npm install nw --save-dev  # or nw-builder for production builds
{
  "name": "my-nw-app",
  "main": "index.html",
  "window": {
    "title": "My Application",
    "width": 1200,
    "height": 800,
    "min_width": 800,
    "min_height": 600,
    "icon": "icons/icon.png",
    "frame": true,
    "resizable": true
  },
  "nodejs": true,
  "node-remote": "",
  "chromium-args": "--enable-features=WebRTC-H264WithOpenH264FFmpeg"
}

The main field in package.json is the entry point — here it's an HTML file, not JS.

Project Structure

my-app/
├── package.json     # NW.js configuration
├── index.html       # main window
├── js/
│   ├── app.js       # app logic
│   └── native.js    # Node.js integration
├── css/
│   └── style.css
└── icons/
    └── icon.png

Example: File Browser

<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>File Browser</title>
  <link rel="stylesheet" href="css/style.css">
</head>
<body>
  <div id="toolbar">
    <button id="btn-open">Open Folder</button>
    <span id="current-path"></span>
  </div>
  <div id="file-list"></div>
  <script src="js/app.js"></script>
</body>
</html>
// js/app.js — Node.js API directly in renderer
const fs = require('fs');
const path = require('path');
const { dialog } = nw;

let currentPath = require('os').homedir();

function renderFiles(dirPath) {
  document.getElementById('current-path').textContent = dirPath;
  const list = document.getElementById('file-list');
  list.innerHTML = '';

  try {
    const entries = fs.readdirSync(dirPath, { withFileTypes: true });
    entries.forEach(entry => {
      const item = document.createElement('div');
      item.className = `file-item ${entry.isDirectory() ? 'dir' : 'file'}`;
      item.textContent = entry.name;
      list.appendChild(item);
    });
  } catch (err) {
    list.innerHTML = `<div class="error">${err.message}</div>`;
  }
}

document.getElementById('btn-open').addEventListener('click', () => {
  const input = document.createElement('input');
  input.type = 'file';
  input.setAttribute('nwdirectory', ''); // NW.js extension for folder selection
  input.addEventListener('change', () => {
    currentPath = input.value;
    renderFiles(currentPath);
  });
  input.click();
});

renderFiles(currentPath);

Distribution Build

npm install nw-builder --save-dev
// build.js
const NwBuilder = require('nw-builder');

const nw = new NwBuilder({
  files: ['./src/**/**', './package.json'],
  version: '0.89.0',
  platforms: ['win64', 'osx64', 'linux64'],
  buildDir: './release',
  macIcns: './icons/icon.icns',
  winIco: './icons/icon.ico'
});

nw.build().then(() => {
  console.log('Build complete');
}).catch(console.error);

NW.js Versions: Normal vs SDK

NW.js available in two versions:

  • Normal — for production, no DevTools by default, smaller size
  • SDK — with DevTools, for development and debugging

When NW.js Makes Sense

Consider NW.js for: porting existing web applications without rearchitecting, quick internal tools where security model is less critical, projects where team previously worked with node-webkit.

For new production applications, Electron or Tauri have more active communities, better documentation, and more predictable security models.