Node.js software licensing

Node.js license key validation for desktop apps, CLIs, and developer tools.

Add product-scoped license checks to Electron main processes, Node.js command-line tools, and paid developer utilities with the GrebKey Node SDK. The SDK supplies a machine fingerprint, local validation cache, and configurable offline grace.

Where the Node.js SDK fits

Electron main processes

Validate from the Node.js side of a desktop app before unlocking paid behavior.

Commercial Node.js CLIs

Check a product-scoped key before running paid commands or workflows.

Paid developer tools

Use the same SDK path in Node.js utilities, local services, and plugin hosts.

First validation path

  1. Create a GrebKey product and generate a license key for it.
  2. Set GREBKEY_API_URL, GREBKEY_PRODUCT_ID, and GREBKEY_LICENSE_KEY outside your source code.
  3. Call client.validate() from a Node.js process when your application starts.
  4. Allow paid behavior only when the result is valid and this machine is activated.

Runnable Node.js quickstart

This public quickstart covers environment configuration, SDK validation, and the valid plus machine-activated decision. Save it as first-validation.mjs, provide the three environment variables, and run it where you installed grebkey.

npm install grebkey

import { GrebKeyClient } from "grebkey";

const apiUrl = process.env.GREBKEY_API_URL;
const productId = process.env.GREBKEY_PRODUCT_ID;
const licenseKey = process.env.GREBKEY_LICENSE_KEY;

if (apiUrl == null || productId == null || licenseKey == null) {
  console.error("Set GREBKEY_API_URL, GREBKEY_PRODUCT_ID, and GREBKEY_LICENSE_KEY.");
  process.exitCode = 1;
} else {
  const client = new GrebKeyClient({ apiUrl, productId });

  try {
    const result = await client.validate(licenseKey);

    if (result.valid !== true || result.machine_activated !== true) {
      console.error(`Not licensed: ${result.reason ?? "machine_not_activated"}`);
      process.exitCode = 1;
    } else {
      console.log("Licensed!");
    }
  } catch {
    console.error("License validation could not be completed.");
    process.exitCode = 1;
  }
}

node first-validation.mjs

Activation, cache, and offline boundaries

  • Validation checks this machine but does not activate it.
  • Activation can require a gk_live_ API key and belongs in trusted server-side code. Never ship a GrebKey API key inside distributed software.
  • A cached result may be reused during a network failure while it is inside the configured grace period.
  • The from_cache result tells you that cache was used, but it does not distinguish a fresh cache hit from offline-grace fallback.

Continue your integration