nuxt-webhook-validators

A simple nuxt module that works on the edge to easily validate incoming webhooks from different services.
14,588 53
Install
npm install nuxt-webhook-validators
Latest Version:0.2.12
Vue:3
License:MIT
Last Updated:Aug 22, 2026
Links: GitHub  ·  npm
Maintainer: yizack

webhook-validators

Nuxt Webhook Validators

npm version npm downloads License Nuxt Modules

A simple nuxt module that works on the edge to easily validate incoming webhooks from different services.

Features

Requirements

This module only works with a Nuxt server running as it uses server API routes (nuxt build).

This means that you cannot use this module with nuxt generate.

Quick Setup

  1. Add nuxt-webhook-validators in your Nuxt project
npx nuxi@latest module add webhook-validators
  1. Add the module in your nuxt.config.ts
export default defineNuxtConfig({
  modules: [
    'nuxt-webhook-validators'
  ],
})

Server utils

The validator helpers are auto-imported in your server/ directory.

Webhook Validators

All validator helpers are exposed globally and can be used in your server API routes.

The helpers return a boolean value indicating if the webhook request is valid or not.

The config can be defined directly from the runtimeConfig in your nuxt.config.ts:

export default defineNuxtConfig({
  runtimeConfig: {
    webhook: {
      <provider>: {
        <requiredProps>: '',
      }
    }
  }
})

It can also be set using environment variables:

NUXT_WEBHOOK_<PROVIDER>_<REQUIRED_PROPERTY> = ""

Go to playground/.env.example or playground/nuxt.config.ts to see a list of all the available properties needed for each provider.

Supported webhook validators
  • Bitbucket
  • Brevo
  • Cal.com
  • Discord
  • Docusign
  • Dropbox
  • Fourthwall
  • GitHub
  • GitLab
  • Heroku
  • Hygraph
  • Kick
  • MailChannels
  • Meta
  • Mux
  • Netlify
  • Paddle
  • PayPal
  • Polar
  • Resend
  • Shopify
  • Slack
  • Stripe
  • Svix
  • Twitch
  • Vercel

You can add your favorite webhook validator by creating a new file in src/runtime/server/lib/validators/

Examples

Basic

Validate a GitHub webhook in a server API route.

~~/server/api/webhooks/github.post.ts

export default defineEventHandler(async (event) => {
  const isValidWebhook = await isValidGitHubWebhook(event)

  if (!isValidWebhook) {
    throw createError({ status: 401, message: 'Unauthorized: webhook is not valid' })
  }

  // Some logic...

  return { isValidWebhook }
})

Reading the request body

Make sure to read the body after validating the webhook, as most validators rely on a caching/cloning of the raw body to compute the signature and validate the webhook.

export default defineEventHandler(async (event) => {
  const isValidWebhook = await isValidGitHubWebhook(event)

  if (!isValidWebhook) {
    throw createError({ status: 401, message: 'Unauthorized: webhook is not valid' })
  }

  // Make sure to read the body after validating the webhook
  const body = await readBody(event)

  return { isValidWebhook }
})

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Run typecheck
npm run test:types

# Release new version
npm run release

Related Packages

@scayle/storefront-nuxt

Nuxt integration for the SCAYLE Commerce Engine and Storefront API

152,903
nuxt-tsconfig-stub

Stub Nuxt's generated tsconfig.json at installation

70,835 24
kuranuxt

Look at the Nuxt 3 documentation to learn more.

871 0
notform-nuxt

Official notform nuxt module - Vue Forms Without the Friction

6,172 21
nuxt-define

One utility function for module authors to define compiler constants for all bui...

13,412,511

Version History

Version Released Vue License
0.2.12 ^3.0 MIT
0.2.11 ^3.0 MIT
0.2.10 ^3.0 MIT
0.2.9 ^3.0 MIT
0.2.8 ^3.0 MIT