Skip to content

Avinash905/HookLens

Repository files navigation

HookLens

A webhook inspection and debugging tool. Capture, inspect, replay, and debug webhook requests from any provider with live SSE updates and failure analysis.

Tech Stack

  • Next.js 16 (App Router) + TypeScript
  • Prisma + PostgreSQL (Neon)
  • NextAuth v5 with GitHub OAuth
  • TailwindCSS + shadcn/ui
  • Vitest

Getting Started

Prerequisites

  • Node.js 20+
  • A PostgreSQL database (Neon, Supabase, or local)
  • A GitHub OAuth app (Settings → Developer settings → OAuth Apps)

Setup

  1. Clone and install:
npm install
  1. Create .env from .env.example and fill in the values:
cp .env.example .env

Generate secrets:

openssl rand -base64 32
  1. Set up the database:
npx prisma db push
  1. Run the dev server:
npm run dev

Open http://localhost:3000.

Features

  • Webhook capture — Unique URL per endpoint, supports POST/GET/PUT/DELETE/PATCH
  • Signature verification — HMAC-SHA256 verification for GitHub webhooks (x-hub-signature-256 header). Support for other providers (Stripe, Shopify, Slack) is planned
  • Live feed — Real-time request updates via Server-Sent Events
  • Request inspector — View headers, body, query params with JSON formatting
  • cURL export — Copy any captured request as a curl command
  • Failure Lens — Compares failed requests against successful ones to identify root cause
  • Replay — Resend captured requests to any URL, with automatic recovery tracking
  • SSRF protection — Blocks private IPs, cloud metadata endpoints, and link-local addresses
  • Tenant isolation — All data scoped per user, authorization checks on every API route

Testing

npm test          # unit tests (32 tests)
npm run test:load # load test (requires dev server running)
npx tsc --noEmit  # type check
npm run lint      # lint

Project Structure

src/
  app/
    api/           # API routes (endpoints, requests, stream, auth)
    u/[slug]/      # webhook capture route
    dashboard/     # dashboard + endpoint detail pages
  components/      # React components
  lib/             # crypto, ssrf, signature, replay, failure-lens, etc
  types/           # shared TypeScript types
prisma/
  schema.prisma    # User, Endpoint, Request, ReplayLog models
tests/             # vitest test files

License

MIT

Releases

Packages

Contributors

Languages