Why Electron for Hardware-Connected Software?
When a customer needs a desktop application that controls a custom hardware device, the choice of platform matters enormously. Native development (Swift/Objective-C for macOS, C++/WinForms for Windows) delivers raw performance but doubles development effort and maintenance burden. Web browsers cannot access serial ports, USB HID devices, or Bluetooth Classic without native bridges.
Electron sits in the sweet spot: web technologies (HTML, CSS, JavaScript/TypeScript) wrapped in a Chromium + Node.js shell with full access to native OS APIs.
Hardware Communication Patterns in Electron
Serial Port Communication
The `serialport` npm package provides a clean API for RS-232/RS-485 serial devices. Industrial equipment, laboratory instruments, and custom embedded systems commonly communicate over serial.
import { SerialPort } from 'serialport'
const port = new SerialPort({ path: '/dev/ttyUSB0', baudRate: 9600 })
port.on('data', (data) => console.log('Received:', data))
port.write('COMMAND
')USB HID
Point-of-sale terminals, medical peripherals, and custom controllers use USB HID. The `node-hid` library handles enumeration and communication.
Bluetooth Low Energy (BLE)
Wearables, IoT sensors, and industrial monitoring devices use BLE. The `@abandonware/noble` library provides a Node.js BLE central role implementation.
MQTT for IoT
Factory floor equipment and environmental sensors often use MQTT. Electron apps can connect directly to MQTT brokers (Mosquitto, AWS IoT Core) using the `mqtt` npm package.
Security Considerations
Hardware-connected Electron apps require careful security architecture:
- Context isolation: Renderer processes should never have direct access to `serialport` or HID APIs — use IPC bridges
- Code signing: Required for distribution on both macOS and Windows; hardware drivers often require signed applications
- Auto-updates: Hardware firmware and application version compatibility must be managed carefully
The Electron Performance Myth
A common concern: "Electron apps are heavy and slow." In 2025, this needs nuance:
- Memory footprint has improved significantly with Electron 30+
- Vite-based build tooling produces lean bundles
- For hardware-connected applications where a browser alternative doesn't exist, Electron's "overhead" is the cost of cross-platform development — and it's worth it
NGrid's Desktop & Hardware Work
We have built Electron applications for industrial IoT dashboards, medical device configuration tools, and point-of-sale systems. The common thread: businesses that had previously paid for separate Windows and macOS development now maintain a single codebase for both platforms, with direct hardware access where needed.