clerk-webhooks

Verify Clerk webhook signatures and sync user lifecycle events to a backend.

Updated Apr 7, 2026
One-click install
npx skills add https://github.com/koushik-hait/xigenis-landingpage-v1 --skill clerk-webhooks-koushik-hait
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clerk-webhooks
Source: https://github.com/koushik-hait/xigenis-landingpage-v1/tree/main/.agents/skills/clerk-webhooks
Command: npx skills add https://github.com/koushik-hait/xigenis-landingpage-v1 --skill clerk-webhooks-koushik-hait

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of reliably syncing Clerk authentication and organization changes into your application in real time, without breaking requests due to missing signature verification or protected webhook routes.

Core Features & Use Cases

  • Clerk webhook signature verification: Ensures every webhook handler validates signatures using verifyWebhook(req) backed by CLERK_WEBHOOK_SECRET to prevent spoofed requests.
  • Event-driven data syncing: Handles common events such as user.created/updated/deleted and organizationMembership.created/deleted to keep your database consistent.
  • Production-ready handler patterns: Provides complete copy-paste-ready Next.js App Router handlers (and includes notes for making routes public and using Express raw body when needed).

Quick Start

Create app/api/webhooks/route.ts with a POST handler that calls verifyWebhook(req) and maps user.created into a Prisma create operation for your users table.

Frequently Asked Questions about clerk-webhooks

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify Clerk webhook signatures in Next.js App Router?

To verify Clerk webhook signatures in Next.js App Router, call verifyWebhook(req) inside your POST handler using the CLERK_WEBHOOK_SECRET environment variable. This validates incoming requests to prevent spoofed payloads before parsing event data.

Why does my Clerk webhook return an error in Next.js?

Clerk webhooks return errors when routes are protected by Clerk middleware or lack signature verification. You must make webhook routes public by excluding them from Clerk middleware and mandatorily call verifyWebhook(req) using CLERK_WEBHOOK_SECRET to validate incoming requests.

How do I sync Clerk user events to a Prisma database?

To sync Clerk user events to a Prisma database, create a Next.js App Router POST handler that verifies the webhook signature, then maps user.created, user.updated, and user.deleted event payloads directly to Prisma create, update, and delete operations for real-time database consistency.

Can I use Clerk webhooks with Express instead of Next.js App Router?

Yes, you can use Clerk webhooks with Express instead of Next.js App Router. The implementation requires parsing the raw request body for signature verification via verifyWebhook(req) and applying the same event mapping logic for user and organization lifecycle events.

What Clerk lifecycle events should I handle for database sync?

For database sync, you should handle Clerk lifecycle events including user.created, user.updated, user.deleted, organizationMembership.created, and organizationMembership.deleted to keep your backend records consistent with authentication and organization membership changes.

Do I need to exclude Clerk webhooks from authentication middleware?

Yes, you must exclude Clerk webhooks from authentication middleware. Webhook routes must be public so external Clerk servers can reach them, relying entirely on verifyWebhook(req) and CLERK_WEBHOOK_SECRET for request authenticity instead of session-based authentication.