A webhook platform. One side registers the URLs it wants notified; the other side POSTs events to Hookshot's ingest endpoint. Hookshot authenticates the sender with an API key, records the event exactly once, and keeps it against the receiving account.
This repo holds two apps:
| Path | Stack | What it is |
|---|---|---|
hookshotbackend/ |
Node.js + Express + MongoDB (Mongoose) | The API and event store |
hookshotfrontend/ |
React 18 + Vite + Tailwind | The dashboard for managing it |
-
A developer signs up and gets an API key (
hk_live_…), shown in Settings. -
They register endpoints — the URLs they own that should receive events.
-
Their other services POST events to
/api/events, authenticating with the API key and anIdempotency-Keyheader:curl -X POST http://localhost:5001/api/events \ -H 'Content-Type: application/json' \ -H "X-Hookshot-Key: $API_KEY" \ -H 'Idempotency-Key: order-1-invoice-8821' \ -d '{"type":"invoice.paid","data":{"invoiceId":"inv_8821"}}'
A fresh key returns 201 and a new event. Replaying the same key returns 200 with the original event instead of creating a duplicate.
-
The dashboard lists endpoints and the 50 most recent events.
Delivery is not built yet. Events are recorded and their target endpoints are snapshotted onto the event; nothing is actually POSTed outbound. That is the next phase — see
hookshotbackend/README.md→ Known limitations.
- Session cookie (httpOnly JWT, 7 days) — the dashboard. Manages endpoints, events, account, and settings.
- API key (
X-Hookshot-Key) — server-to-server callers. OpensPOST /api/eventsand nothing else, so a leaked key can't read event history.
Auth (signup / login / logout / password change / account deletion), endpoint CRUD scoped to the owner, idempotent event ingestion, fixed-window rate limiting (login and event ingest), and an in-memory cache-aside layer for a user's active endpoints. Deleted accounts are revoked immediately, for both the session token and the API key.
The full route table, status codes, design notes, and the accepted limitations
live in hookshotbackend/README.md.
Requirements: Node.js 18+ and a MongoDB instance (local mongod, Docker, or
Atlas).
Backend:
cd hookshotbackend
npm install
cp .env.example .env # then edit — MONGO_URI, JWT_SECRET, PORT, CLIENT_ORIGIN
npm run dev # http://localhost:5001Frontend (separate terminal):
cd hookshotfrontend
npm install
npm run dev # http://localhost:5173, proxies /api → localhost:5001The Vite dev server proxies /api to the backend so both run same-origin, which
is what lets the httpOnly session cookie work in development.
The backend ships seven suites (~530 assertions) that run against a live server and a real MongoDB:
cd hookshotbackend
npm run dev:test # terminal 1 — relaxed rate limits
npm test # terminal 2 — runs all seven- Assignment: FS Node Task 3 — Make Your API Safe (Hookshot).
- The backend dependency set is intentionally small: express, mongoose, bcryptjs, jsonwebtoken, dotenv, cors.