npm.io
2.186.2 • Published 20m ago

node-opcua

Licence
MIT
Version
2.186.2
Deps
50
Size
31 kB
Vulns
0
Weekly
0
Stars
1.7K

node-opcua

NPM version NPM downloads Node.js CI Coverage Status

The most complete OPC UA stack for Node.js — build industrial-grade OPC UA servers and clients in TypeScript.

Why node-opcua?

  • Full OPC UA stack — server, client, discovery, aggregation, and GDS
  • Production-grade security — X.509 certificates, encrypted channels, user authentication
  • Cross-platform — Windows, Linux, macOS, and browser (via WebSocket)
  • 120+ packages — modular architecture, use only what you need
  • Battle-tested — 12+ years of development, 1,600+ GitHub stars, 3,000+ tests
  • Well documented — NodeOPCUA by Example book + API reference

Quick Start

Requirements: Node.js 20 or later

npm install node-opcua
Create an OPC UA Server
import { OPCUAServer, DataType, Variant } from "node-opcua";

const server = new OPCUAServer({ port: 4840 });
await server.initialize();

const addressSpace = server.engine.addressSpace;
if (!addressSpace) throw new Error("AddressSpace not initialized");

const namespace = addressSpace.getOwnNamespace();
namespace.addVariable({
    browseName: "Temperature",
    componentOf: addressSpace.rootFolder.objects,
    dataType: DataType.Double,
    value: { get: () => new Variant({ dataType: DataType.Double, value: 22.5 }) },
});

await server.start();
console.log("Server started at", server.getEndpointUrl());
Connect as an OPC UA Client
import { OPCUAClient, AttributeIds } from "node-opcua";

const client = OPCUAClient.create({ endpointMustExist: false });
await client.connect("opc.tcp://localhost:4840");

const session = await client.createSession();
const value = await session.read({ nodeId: "ns=1;s=Temperature", attributeId: AttributeIds.Value });
console.log("Temperature =", value.value.value);

await session.close();
await client.disconnect();

Professional Support

Community (MIT) Professional
Full documentation + extended docs
Bug fixes Best effort Priority SLA
CVE security advisories After disclosure Early access — patch before public disclosure
Certifiable version —
Dedicated consulting —
Custom development —

Professional Support

Or contact Sterfive for dedicated consulting and enterprise needs.

Documentation

Value-Added Extensions

Source-available companion modules available to NodeOPCUA subscription members (additional fee):

Module Description
node-opcua-pub-sub OPC UA PubSub over MQTT (Part 14) — Industry 4.0 ready
aggregator Combine and monitor hundreds of servers and millions of variables
node-opcua-optimized-client High-performance OPC UA client for demanding workloads
node-opcua-gds Global Discovery Server — certificate lifecycle at scale (Part 12)
node-opcua-modeler-ex Programmatic OPC UA modeler

Visit support.sterfive.com for access and pricing.

Ecosystem

AI-Powered Modeling with MCP

node-opcua-modeler-mcp-server — an MCP server that gives AI agents access to the OPC UA companion specification type system. Discover types, resolve namespace dependencies, and look up engineering units.

npx node-opcua-modeler-mcp-server
OPC UA Modeler

OPC UA Modeler — write your information model in YAML, get standard NodeSet2.xml: create, validate, and generate OPC UA information models with full companion spec support. Online editor · Documentation

Sponsors

If you rely on node-opcua in production, please consider sponsoring the project. Your support funds long-term maintenance, new features, and representation at the OPC Foundation.

License

MIT — Copyright (c) 2014-2026 Etienne Rossignon / Sterfive SAS

See LICENSE for details.

Keywords