Skip to content

Installation

Nodus ships as the npm package @kortexya/nodus. It is ESM-first and also provides a standalone bundle you can drop into a page with a <script> tag.

Install from npm

Terminal window
npm install --save @kortexya/nodus

Import the library

import { Nodus } from '@kortexya/nodus';
const nodus = new Nodus({ container: document.getElementById('graph') });

The default export is the same Nodus class:

import Nodus from '@kortexya/nodus';

Script tag (global build)

Drop the prebuilt bundle into a page; Nodus is exposed as a global.

<script src="path/to/nodus.umd.cjs"></script>
<script>
const nodus = new Nodus({ container: 'graph-container' });
</script>

ES module from a CDN / static host

<script type="module">
import { Nodus } from '/path/to/@kortexya/nodus/nodus.src.bundle.js';
const nodus = new Nodus({ container: 'graph-container' });
</script>

WebAssembly loads automatically

Nodus’s Rust core is compiled to WebAssembly. You do not call an init function — importing the package eagerly initializes the WASM core (via top-level await), so new Nodus(...) is synchronous and ready to use as soon as the module has loaded.

Requirements

RequirementNotes
Module formatES modules (a <script> global build is also provided)
WebAssemblyRequired — included in every modern browser
WebGPUOptional — enables the GPU renderer; Nodus falls back to Canvas 2D otherwise
A container elementAn HTMLElement (or its id) with a non-zero size

WebGPU is not required: when it is unavailable Nodus automatically uses the Canvas 2D renderer. See The Rendering Pipeline for how the renderer is selected.

What’s included

The package exposes:

  • Nodus — the main class (also the default export).
  • isWebGpuSupported() — a runtime WebGPU capability check.
  • Element wrappersNode, Edge, NodeList, EdgeList.
  • Helpers & typesBoundingBox, Transformation, StyleRule, StyleClass, NonObjectPropertyWatcher, ObjectPropertyWatcher.
  • RenderersWasmGraphRenderer, WasmRendererAdapter.
  • Namespacesgeometry, parse, hypergraph.
  • Layout factoriesforceFactory, forceLinkFactory, gridFactory, hierarchicalFactory, radialFactory, concentricFactory, sequentialFactory.
  • Backend activationenableWasmBackend, configureBackends, useWasm.

Verify your installation

import { Nodus, isWebGpuSupported } from '@kortexya/nodus';
const nodus = new Nodus({ container: document.getElementById('graph') });
console.log('WebGPU available:', isWebGpuSupported());
await nodus.setGraph({
nodes: [{ id: '1' }, { id: '2' }],
edges: [{ source: '1', target: '2' }],
});
await nodus.layouts.force({ duration: 0 });
await nodus.view.locateGraph();

If you see two connected nodes centered in your container, you’re ready to go. Continue with the Quick Start.