node-machine-id
Cross-platform unique machine ID discovery for Node.js, no admin rights required
Repository Health
Technical Analysis
node-machine-id is a small Node.js library that returns a unique, hardware-independent identifier for the machine it runs on, reading the OS’s own native UUID rather than deriving one from hardware components that can change. On Windows it reads the MachineGuid registry key, on macOS it reads IOPlatformUUID from the I/O Kit registry, and on Linux it reads /var/lib/dbus/machine-id (or /etc/machine-id), all without requiring elevated privileges or native bindings.
The returned ID stays stable across reboots and most OS updates, which makes it useful for software licensing, trial-period enforcement, installation tracking, and per-device analytics in both Node.js and Electron/NW.js desktop applications.
What You Get
- A cross-platform (Windows, macOS, Linux, FreeBSD) unique machine identifier with no native bindings or compiled addons
- Both async (machineId) and sync (machineIdSync) APIs
- An option to return the raw platform UUID or a SHA-256 hash of it (original vs. default)
- No elevated/admin rights required to read the identifier on any supported platform
Common Use Cases
- Enforcing software license or trial-period restrictions tied to a specific machine
- Tagging installation/analytics events with a stable per-device ID instead of a random one generated at first run
- Generating a per-device key for Electron or NW.js desktop apps that need to identify “this computer” without hardware fingerprinting
Under The Hood
Architecture - The entire library is a single module (index.js) built around a lookup table of shell commands keyed by process.platform — ioreg on darwin, REG.exe QUERY on win32 (with a mixed/native architecture check for 32-bit Node on 64-bit Windows), reading /var/lib/dbus/machine-id or /etc/machine-id on linux, and kenv/sysctl on freebsd. Both machineId (via Node’s exec) and machineIdSync (via execSync) run the matching command, then an expose() function parses the platform-specific output format down to a bare lowercase UUID string.
Tech Stack - Written in Flow-annotated ES2015+ JavaScript, transpiled with Babel and bundled with Webpack 1.x for the published dist/index.js. It has zero runtime dependencies — it relies entirely on Node’s built-in child_process and crypto modules plus whatever OS command is available on the host (ioreg, REG.exe, cat, kenv/sysctl).
Code Quality - The implementation is compact (under 90 lines) with a small Mocha test suite in tests/index.js covering both the sync and async paths. There’s no input validation beyond what the shelled-out commands naturally provide, and error handling for the async path is a single rejected promise wrapping the command’s stderr/stack.
API Design - The API is about as minimal as it gets: two functions, one boolean argument (original) controlling whether the ID is returned raw or hashed. There’s no configuration object, no classes, and adoption is a single import {machineId} from 'node-machine-id' — trivial to use, though the coarse error surface (one generic Error per platform-command failure) limits diagnosability across the different OS command failure modes.
Used by 9 apps in this directory
Amical
Note Taking · AI Assistants
Local-first AI dictation that understands your active app — private, offline, and built for speed.
Cline
AI Code Assistants
An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.
Codebuff
AI Code Assistants
An open-source AI coding assistant that coordinates specialized agents to edit your codebase from natural language — including Freebuff, a free, ad-supported version powered entirely by open-source models like DeepSeek and Kimi.
Continue
Developer Tools · AI Development · AI Code Assistants
Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.
Directus
CMS · Low Code Platforms
Connect any SQL database and get instant REST and GraphQL APIs, a visual management Studio, and a native MCP server for AI agents — free for most organizations.
LobeHub
AI Assistants · Productivity · Automation
Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.
OmniRoute
AI Agents
A free, open-source AI gateway connecting Claude Code, Codex, Cursor, Cline, and Copilot to 237 AI providers (90+ free) through one endpoint, with automatic fallback and token-compression to stretch free-tier limits further.
strapi
CMS
Open-source headless CMS that auto-generates REST and GraphQL APIs from your content models, with a fully customizable admin panel you control.
SurfSense
Search · AI Assistants
The open-source, unlimited NotebookLM alternative with real-time collaboration, a desktop app, and no vendor lock-in.