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

@meridianjs/plugin-webhook

v1.0.0

Published

Meridian plugin: receive and store incoming webhooks from external services

Readme

@meridianjs/plugin-webhook

Webhook receiver plugin for MeridianJS. Exposes POST /webhooks/:provider — one URL per external service — stores each event as a WebhookEvent record, and emits webhook.received on the event bus.

The framework does not verify signatures. Every platform uses a different signing scheme. The raw headers and body are forwarded to subscribers so each one can run the correct verification for its provider.

Installation

npm install @meridianjs/plugin-webhook

Configuration

// meridian.config.ts
export default defineConfig({
  plugins: [
    { resolve: "@meridianjs/meridian" },
    { resolve: "@meridianjs/plugin-webhook" },
  ],
})

Endpoint

POST /webhooks/:provider

| Service | URL | |---------|-----| | GitHub | https://your-app.com/webhooks/github | | Stripe | https://your-app.com/webhooks/stripe | | Slack | https://your-app.com/webhooks/slack | | Shopify | https://your-app.com/webhooks/shopify |

Event payload

The complete, unmodified request is forwarded to subscribers:

interface WebhookReceivedData {
  id: string
  provider: string
  event_type: string
  payload: Record<string, unknown>  // parsed JSON body
  rawBody: string | null            // unparsed body string (required for HMAC verification)
  headers: Record<string, string>   // all request headers, exactly as received
}

Handling events with signature verification

Create one subscriber per provider. Filter on provider, verify the signature using your platform's scheme, then act on the payload.

// src/subscribers/on-github-webhook.ts — HMAC-SHA256 of raw body
import { createHmac, timingSafeEqual } from "node:crypto"
import type { SubscriberArgs, SubscriberConfig } from "@meridianjs/types"

function verify(secret: string, rawBody: string, sig: string): boolean {
  const expected = "sha256=" + createHmac("sha256", secret).update(rawBody).digest("hex")
  try { return timingSafeEqual(Buffer.from(expected), Buffer.from(sig)) } catch { return false }
}

export default async function handler({ event, container }: SubscriberArgs<any>) {
  const { provider, event_type, payload, rawBody, headers } = event.data
  if (provider !== "github") return

  if (!verify(process.env.GITHUB_WEBHOOK_SECRET!, rawBody, headers["x-hub-signature-256"] ?? "")) {
    ;(container.resolve("logger") as any).warn("[webhook] GitHub: invalid signature")
    return
  }

  if (event_type === "push") {
    // parse commit messages for issue identifiers and create comments ...
  }
}

export const config: SubscriberConfig = { event: "webhook.received" }
// src/subscribers/on-stripe-webhook.ts — timestamp + HMAC, replay-attack protection
import { createHmac, timingSafeEqual } from "node:crypto"
import type { SubscriberArgs, SubscriberConfig } from "@meridianjs/types"

function verify(secret: string, rawBody: string, sigHeader: string): boolean {
  const parts = Object.fromEntries(sigHeader.split(",").map(p => p.split("=")))
  if (!parts["t"] || !parts["v1"]) return false
  if (Math.abs(Date.now() / 1000 - Number(parts["t"])) > 300) return false  // 5-min window
  const expected = createHmac("sha256", secret).update(`${parts["t"]}.${rawBody}`).digest("hex")
  try { return timingSafeEqual(Buffer.from(expected), Buffer.from(parts["v1"])) } catch { return false }
}

export default async function handler({ event, container }: SubscriberArgs<any>) {
  const { provider, event_type, payload, rawBody, headers } = event.data
  if (provider !== "stripe") return

  if (!verify(process.env.STRIPE_WEBHOOK_SECRET!, rawBody, headers["stripe-signature"] ?? "")) {
    ;(container.resolve("logger") as any).warn("[webhook] Stripe: invalid signature")
    return
  }

  if (event_type === "checkout.session.completed") {
    // provision subscription ...
  }
}

export const config: SubscriberConfig = { event: "webhook.received" }

Service: webhookModuleService

const svc = container.resolve("webhookModuleService") as any

const [events] = await svc.listAndCountWebhookEvents({ provider: "github" })
const event    = await svc.retrieveWebhookEvent(id)

License

MIT