What is RelayDock?
RelayDock is a full-lifecycle webhook infrastructure platform engineered for modern backends. It solves both halves of event-driven communication—plus AI-assisted debugging directly inside Cursor and Claude:
Guaranteed Event Delivery
Publish events once via REST API or relaydock-node. RelayDock fans out signed deliveries to subscribed URLs with exponential backoff retries, Dead Letter Queues (DLQ), SSRF IP validation, and circuit breakers.
Permanent URLs + Local SSE
Generate permanent public ingress URLs (/v1/in/:sourceToken) for Stripe, Razorpay, or GitHub. Every payload is stored in Postgres and streamed in real time to localhost via relaydock CLI.
Official MCP Server
Connect Cursor, Claude Desktop, or Windsurf using relaydock-mcp to inspect failed deliveries, read raw webhook payloads, and trigger event replays using natural language.
// Architecture & Internals
How It Works
RelayDock decouples fast HTTP ingestion from asynchronous network dispatch using PostgreSQL row-level locking and zero-polling EventEmitter streams so your application never blocks on slow or failing endpoints.
POST /v1/events validates your project API key, checks Idempotency-Key uniqueness, persists the immutable event in PostgreSQL, and creates per-endpoint delivery records.
Background workers claim due jobs directly in PostgreSQL using atomic row-level locks (PENDING → PROCESSING) so concurrent worker instances never double-deliver an event.
Before opening a socket, the worker resolves DNS to block private/SSRF IPs, verifies circuit breaker health, signs the raw JSON with HMAC-SHA256, and logs latency + status code.
OUTBOUND FLOW:
[Your App / SDK] ──POST /v1/events──▶ [Fastify API] ──▶ [PostgreSQL Delivery Queue]
│ (Row-Level Lock)
▼
[Customer Endpoint] ◀──HMAC Signed HTTP── [Worker: SSRF Check + Circuit Breaker]
INBOUND TUNNEL & MCP FLOW:
[Stripe / Razorpay] ──POST /v1/in/:token──▶ [Ingress API] ──▶ [Postgres InboundEvent]
│
(EventEmitter SSE)
▼
[relaydock CLI] ──▶ http://localhost:3000/webhooks
│
[Cursor / Claude (MCP)] ◀──REST API──▶ [Fastify API] ◀──POST /ack (status, ms)// Quickstart
5-Minute Setup
Choose how you want to interact with RelayDock—direct HTTP API, the official Node.js/TypeScript SDK, the local tunnel CLI, or the MCP server:
# Production API Base URL
export RELAYDOCK_URL="https://relaydockapi-production.up.railway.app"
export RELAYDOCK_API_KEY="rd_live_9f8a7b6c5d4e3f2a1b0c"
# Verify API connectivity and project auth
curl -X GET "$RELAYDOCK_URL/v1/endpoints" \
-H "Authorization: Bearer $RELAYDOCK_API_KEY"// Security Scope
Authentication & Multi-Project Isolation
Every API key in RelayDock is scoped to a single Project (e.g., Production, Staging, or a specific microservice). Keys are hashed with SHA-256 at rest—raw secrets are shown once upon creation in Dashboard → API Keys.
Authorization: Bearer rd_live_9f8a7b6c5d4e3f2a1b0c
Content-Type: application/json
Idempotency-Key: evt_order_2026_00192// Outbound Delivery
Publishing & Inspecting Events
When you publish an event, RelayDock matches all enabled endpoints subscribed to that type (or wildcard *) within your project and queues asynchronous deliveries.
curl -X POST https://relaydockapi-production.up.railway.app/v1/events \
-H "Authorization: Bearer rd_live_9f8a7b6c5d4e3f2a1b0c" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: pay_2026_99182" \
-d '{
"type": "payment.captured",
"data": {
"paymentId": "pay_2026_99182",
"amount": 49900,
"currency": "INR"
}
}'
# Response (202 Accepted):
# {
# "success": true,
# "data": { "eventId": "cmwl7egpj0001botwimtiiiju", "deliveriesQueued": 2 }
# }// Inbound Tunnel Engine
Inbound Webhook Capture & Local Tunneling
Traditional tunneling tools generate random ephemeral URLs that break every time you restart your terminal, and drop payloads if your local server isn't running. RelayDock solves both:
- Permanent Ingress URLs: Configure
https://relaydockapi-production.up.railway.app/v1/in/src_...once inside Stripe, Razorpay, or GitHub webhook settings. - Zero-Polling SSE Push: Incoming requests emit immediately over an internal Node.js
EventEmitterstream to connected CLI listeners without database polling overhead. - Attempt History & 1-Click Replay: Every local forward reports back HTTP status, target URL, and round-trip latency (
ms). Re-send any historical payload from the dashboard while debugging your handler.
# Forward incoming webhooks from your permanent source to localhost:3000
relaydock listen \
--source src_7a40295f38e1f9df256849f0 \
--forward http://localhost:3000/api/webhooks \
--api-key rd_live_9f8a7b6c5d4e3f2a1b0c \
--url https://relaydockapi-production.up.railway.app
# Terminal output:
# ● Connected to "Stripe Production" (src_7a40295f38e1f9df256849f0) — waiting for webhooks...
# POST http://localhost:3000/api/webhooks → 200 OK (18ms) id=cmwl7egpj
# [REPLAY] POST http://localhost:3000/api/webhooks → 200 OK (11ms) id=cmwl7egpjMCP Server (relaydock-mcp)
RelayDock ships an official Model Context Protocol (MCP) server so AI coding assistants like Cursor, Claude Desktop, and Windsurf can query your webhook endpoints, inspect failed deliveries, and replay events without leaving your editor.
{
"mcpServers": {
"relaydock": {
"command": "npx",
"args": ["-y", "relaydock-mcp"],
"env": {
"RELAYDOCK_API_KEY": "rd_live_9f8a7b6c5d4e3f2a1b0c",
"RELAYDOCK_BASE_URL": "https://relaydockapi-production.up.railway.app"
}
}
}
}// relaydock
CLI Command Reference
| Command / Flag | Required | Description |
|---|---|---|
| relaydock guide | — | Displays step-by-step terminal setup instructions. |
| relaydock listen | — | Opens an authenticated SSE tunnel and forwards events locally. |
| --source <token> | Yes | Inbound source token (src_...) from your dashboard. |
| --forward <url> | Yes | Local target URL (e.g., http://localhost:3000/api/webhooks). |
| --api-key <key> | Yes* | Project API key (or set RELAYDOCK_API_KEY env var). |
| --url <baseUrl> | No | RelayDock API server URL (e.g., https://relaydockapi-production.up.railway.app). |
// Cryptographic Authenticity
Verifying Outbound HMAC-SHA256 Signatures
Every outbound request dispatched by RelayDock includes two security headers: X-RelayDock-Timestamp and X-RelayDock-Signature formatted as t=<unix_seconds>,v1=<hex_hmac>.
import { RelayDock } from "relaydock-node";
// Recommended: constant-time verification + 5-minute replay tolerance built in
const isValid = RelayDock.verifySignature({
rawBody, // raw unparsed string/Buffer body
signatureHeader: req.headers["x-relaydock-signature"] as string,
secret: process.env.RELAYDOCK_WEBHOOK_SECRET!,
toleranceSeconds: 300,
});
if (!isValid) {
return res.status(401).json({ error: "Invalid webhook signature" });
}Exponential Backoff & Dead Letter Queue
Any HTTP status outside 200–299, connection timeout, or socket error marks the attempt as failed and schedules a retry using exponential backoff with randomized jitter (baseDelay × 2^attempt + jitter) to avoid thundering herds.
maxRetries, the delivery transitions to DLQ (Dead Letter Queue) so you can inspect the exact response body and trigger a manual replay once your downstream service recovers.Circuit Breakers & SSRF Protection
Per-Endpoint Circuit Breaker
Tracks consecutive failures per endpoint: CLOSED (normal traffic) → OPEN (fast-fails/defers traffic after threshold breaches) → HALF_OPEN (sends a single probe request after cooldown to auto-heal).
SSRF & DNS Rebinding Guard
Every outbound URL is validated and DNS-resolved prior to dispatch. Loopback (127.0.0.0/8), RFC1918 private networks (10/8, 172.16/12, 192.168/16), and link-local cloud metadata IPs (169.254.169.254) are rejected immediately.
API Status Codes
| Status | Meaning | When It Occurs |
|---|---|---|
| 200 / 202 | Accepted / OK | Event persisted & queued, or inbound payload captured. |
| 400 / 422 | Validation Error | Malformed JSON payload, invalid target URL, or SSRF block. |
| 401 / 403 | Unauthorized | Missing/revoked API key or cross-project resource access. |
| 409 | Idempotency Conflict | Duplicate Idempotency-Key already processed for this project. |
| 429 | Rate Limited | Project ingestion rate limit exceeded; retry after backoff. |