npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@huglo/module-sdk

v1.2.3

Published

TypeScript SDK for Huglo federation modules

Readme

@huglo/module-sdk

Build a Huglo module — define scopes, start an HTTP server, call other modules.

Requirements: Node 20+, TypeScript, ESM.

Install

npm install @huglo/module-sdk

Quick start

import { Module, loadKeyPair } from "@huglo/module-sdk";
import { z } from "zod";

const module = new Module({
  id: "trovi",
  name: "Trovi Invoicing",
  description: "Create and read invoices",
  version: "1.2.0",
  keyPair: loadKeyPair(),
});

module.scope("invoices:write", {
  description: "Create an invoice",
  input: z.object({
    vendor: z.string(),
    amount: z.number().int(),
    currency: z.string().length(3),
  }),
  output: z.object({
    id: z.string(),
    vendor: z.string(),
    amount: z.number().int(),
    currency: z.string(),
  }),
  handler: async (ctx) => {
    if (ctx.dryRun) {
      return {
        id: "preview",
        vendor: ctx.input.vendor,
        amount: ctx.input.amount,
        currency: ctx.input.currency,
      };
    }
    return {
      id: "inv-001",
      vendor: ctx.input.vendor,
      amount: ctx.input.amount,
      currency: ctx.input.currency,
    };
  },
});

await module.listen(3000);

Save as index.ts, then:

npx @huglo/module-sdk generate-keypair --out ./private.pem
export MODULE_PRIVATE_KEY_PATH=./private.pem   # or add to .env
npx tsx index.ts

loadKeyPair() reads MODULE_PRIVATE_KEY (PEM string) or MODULE_PRIVATE_KEY_PATH (file path).

Register with Huglo

  1. Register your module's endpoint URL in the Huglo UI.
  2. Set MODULE_CHALLENGE, MODULE_ENDPOINT, and key env vars (see below).
  3. Restart the module — the SDK serves GET /.well-known/huglo-challenge.
  4. Click Verify in the Huglo UI.

Common next steps

Call another module

const result = await module.call({
  target: "trovi",
  scope: "invoices:write",
  input: { vendor: "Acme", amount: 500, currency: "USD" },
  grant: someSignedGrant,
});

Protected scopes require a grant from the user. See docs/ai/HUGLO_SPECIFICATION.md for the grant protocol.

Open scope (no grant)

module.scope("status:read", {
  open: true,
  description: "Module status",
  input: z.object({}),
  output: z.object({ status: z.string() }),
  handler: async () => ({ status: "ok" }),
});

Environment variables

| Variable | Required | Description | |----------|----------|-------------| | MODULE_PRIVATE_KEY or MODULE_PRIVATE_KEY_PATH | Yes | Ed25519 private key (PEM or path to PEM file) | | MODULE_CHALLENGE | For registration | Challenge token from Huglo UI | | MODULE_ENDPOINT | For registration | Public base URL registered in Huglo | | HUGLO_DIRECTORY_URL | No | Huglo directory URL (default: https://account.huglo.com) | | HUGLO_OAUTH_* | No | OAuth settings when using module.config() |

Learn more

License

MIT