Simple project to inspect webhooks, organized as a monorepo with two applications:
api(Fastify + Drizzle ORM + PostgreSQL): exposes endpoints to list, fetch, delete, and capture webhooks, and can generate a TypeScript handler from payloads using AI (Gemini via theaiSDK).web(React + Vite + TanStack Router/Query + Tailwind): UI to explore captured webhooks and generate the handler.
- Node.js 20+ and
pnpm(workspace) - Docker (to run PostgreSQL via
docker-compose) - Google Generative AI API key (
GOOGLE_GENERATIVE_AI_API_KEY) for the handler generation route
- Install dependencies at the monorepo root:
pnpm install
- Configure the database:
- Copy
api/.env.exampletoapi/.envand adjust variables (DATABASE_URL,GOOGLE_GENERATIVE_AI_API_KEY,PORTif desired). - Start PostgreSQL: inside
api/rundocker compose up -d. - Run migrations:
pnpm -C api db:migrate(optional:pnpm -C api db:seed).
- Copy
- Start the API (Fastify):
pnpm -C api dev- API runs at
http://localhost:3333and docs athttp://localhost:3333/docs.
- Start the front-end (Vite):
pnpm -C web dev
GET /api/webhooks— paginated list of webhooksGET /api/webhooks/:id— webhook detailsDELETE /api/webhooks/:id— delete a webhookPOST /api/generate— generate a TypeScript handler from selected webhooks (requiresGOOGLE_GENERATIVE_AI_API_KEY)ANY /capture/*— capture endpoint (persists the request)GET /docs— interactive reference (Swagger + Scalar)
Send a sample webhook to be stored:
curl -X POST \
http://localhost:3333/capture/test \
-H 'Content-Type: application/json' \
-d '{"event":"order.created","data":{"id":123,"total":199.9}}'Then open the web UI to see the saved item in the list and its details.
sequenceDiagram
autonumber
actor S as External Service
participant A as API (Fastify)
participant DB as PostgreSQL (Drizzle)
participant W as Web (React)
S->>A: ANY /capture/* (webhook payload)
A->>DB: Insert record (method, headers, body, etc.)
A-->>S: 201 { id }
W->>A: GET /api/webhooks (list)
A-->>W: 200 { webhooks[], nextCursor }
W->>A: GET /api/webhooks/:id (details)
A-->>W: 200 { webhook }
W->>A: POST /api/generate { webhookIds[] }
A->>A: Build prompt with bodies
A->>Gemini: generateText
A-->>W: 201 { code }
- API (
api/package.json):pnpm -C api dev— start dev serverpnpm -C api db:migrate— apply migrationspnpm -C api db:generate— generate migrations (Drizzle Kit)pnpm -C api db:studio— open Drizzle Studiopnpm -C api db:seed— seed data (optional)
- Web (
web/package.json):pnpm -C web dev— start Vite dev serverpnpm -C web build— production buildpnpm -C web preview— preview the build
api/— capture, listing, and handler generation servicessrc/routes/*— routes (/api/webhooks,/capture/*,/api/generate)src/db/*— Drizzle (schema, migrations)docker-compose.yml— local PostgreSQL
web/— React app to inspect webhookssrc/components/*— UI (list, details, code block)src/routes/*— front-end routes (/,/webhooks/$id)
GOOGLE_GENERATIVE_AI_API_KEYis required for handler generation (POST /api/generate).- Adjust API
PORT/host in.envif needed (defaults to 3333).