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

@hostwebhook/node

v1.0.3

Published

Official HostWebhook SDK — verify signatures, parse headers, and send webhooks

Readme

@hostwebhook/node

Early Access — This SDK is in early access. The API may change between versions. We'd love your feedback — report an issue if you run into anything.

Official Node.js SDK for HostWebhook — verify webhook signatures and send webhooks through the platform.

Install

npm install @hostwebhook/node

Requires Node.js 18+.

Verify Webhook Signatures

HostWebhook signs every delivery with HMAC-SHA256. Use these helpers to verify authenticity and prevent replay attacks.

Express

import express from 'express';
import { expressMiddleware } from '@hostwebhook/node';

const app = express();

app.post('/webhooks',
  express.raw({ type: 'application/json' }),
  expressMiddleware(process.env.SIGNING_SECRET!),
  (req, res) => {
    const payload = JSON.parse(req.body.toString());
    // process payload...
    res.json({ received: true });
  },
);

Important: Use express.raw() so req.body is a Buffer, not parsed JSON.

NestJS

import { Controller, Post, UseGuards, Req } from '@nestjs/common';
import { createNestGuard } from '@hostwebhook/node';

const WebhookGuard = createNestGuard(process.env.SIGNING_SECRET!);

@Controller('webhooks')
export class WebhooksController {
  @Post()
  @UseGuards(WebhookGuard)
  handle(@Req() req: Request) {
    return { received: true };
  }
}

Fastify

import Fastify from 'fastify';
import { fastifyHook } from '@hostwebhook/node';

const app = Fastify();
app.addContentTypeParser('application/json', { parseAs: 'buffer' }, (req, body, done) => done(null, body));

app.post('/webhooks', {
  preHandler: fastifyHook(process.env.SIGNING_SECRET!),
}, (req, reply) => {
  reply.send({ received: true });
});

Manual Verification

import { verify, VerificationError } from '@hostwebhook/node';

try {
  verify(rawBody, request.headers, secret);
  // signature valid
} catch (err) {
  if (err instanceof VerificationError) {
    // invalid — reject the request
  }
}

Options: verify(payload, headers, secret, { maxAgeSec: 300 }) — default 300s (5 min). Set 0 to disable replay protection.

Send Webhooks

Send webhook payloads through HostWebhook for reliable delivery with retries and monitoring.

Class-based

import { HostWebhook } from '@hostwebhook/node';

const hw = new HostWebhook({ token: 'your_ingress_token' });

const { eventId } = await hw.send({ event: 'order.created', orderId: '123' });

Batch

const results = await hw.sendBatch([
  { event: 'user.signup', userId: '1' },
  { event: 'user.signup', userId: '2' },
]);

Standalone Function

import { send } from '@hostwebhook/node';

const { eventId } = await send(
  { token: 'your_ingress_token' },
  { event: 'test', data: 'hello' },
);

Configuration

| Option | Type | Default | Description | |--------|------|---------|-------------| | token | string | required | Endpoint ingress token | | baseUrl | string | https://api.hostwebhook.com | API base URL | | signingSecret | string | — | Signs outgoing requests with HMAC-SHA256 | | defaultHeaders | Record<string, string> | — | Headers added to every request | | timeoutMs | number | 10000 | Request timeout in ms |

Error Handling

import { SendError, VerificationError } from '@hostwebhook/node';

// Send errors
try {
  await hw.send(payload);
} catch (err) {
  if (err instanceof SendError) {
    console.log(err.statusCode, err.responseBody);
  }
}

// Verification errors
try {
  verify(body, headers, secret);
} catch (err) {
  if (err instanceof VerificationError) {
    console.log(err.message);
  }
}

Signature Format

X-HostWebhook-Signature: t=<timestamp_ms>,v1=<hmac_hex>

HMAC computed as: HMAC-SHA256(secret, "${timestamp}.${rawBody}")

Support

Found a bug or have a feature request? Report an issue on our website.

Privacy

Your webhook data is yours. HostWebhook is built with privacy as a core principle:

  • Your payloads stay between you and your endpoints — we never sell, share, or use your data for training.
  • Encryption in transit — all traffic between the SDK, the platform, and your endpoints is sent over TLS.
  • Minimal data retention — event payloads are stored only for delivery and debugging, and are automatically purged based on your plan's retention window.

License

MIT