Use a module in Node
Node 25 or later.
mkdir use-node && cd use-node && npm init -y > /dev/null && npm i @publicdomainrelay/atlibs@0.5.0 > /dev/null
Save as main.mjs, then node main.mjs:
import { loadModule, runModule } from "@publicdomainrelay/atlibs/run-module/index.js";
import { createNodeContext, hostCall } from "@publicdomainrelay/atlibs/server/index.js";
const did = "did:plc:ocnuqjlzgohypj3zoznermms";
const ctx = createNodeContext({ id: "demo", stateDir: ".state" });
const hello = await loadModule(ctx, "bobvmbuilder.bsky.social/hello");
const { result, error } = await runModule(ctx, hello, "count", { did, collection: "com.fedfork.exec.wasm.module" }, hostCall({ ctx }));
console.log(JSON.stringify(error ?? result));
{"collection":"com.fedfork.exec.wasm.module","records":…}
A local build instead of a published one:
localModule(new URL("hello.wasm", import.meta.url), new URL("hello.json", import.meta.url), fileFetch)
(fileFetch from server/index.js; atlibs add writes both files to modules/).
Servers, sign-in, Hono: Node servers, examples/node-hono.