Skip to content
sultanxdevPublic

About

Webhook reliability infrastructure for durable event delivery, retries, idempotency, failure recovery, replay, and delivery observability.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Zyvan

Webhook reliability infrastructure for durable event delivery, retries, failure recovery, replay, and delivery observability.

Zyvan sits between an application and its webhook destinations.

It accepts events, persists them, processes delivery asynchronously, retries transient failures, records delivery attempts, and provides recovery paths when destinations remain unavailable.

Core workflow

Receive → Persist → Queue → Deliver → Retry → Recover → Replay

Why Zyvan?

Webhook delivery becomes difficult when a destination:

  • Times out
  • Returns 5xx responses
  • Goes offline
  • Recovers after an outage
  • Receives duplicate events
  • Processes events slower than they are produced

A reliable webhook system needs durable state, idempotency, retries, failure recovery, replay, delivery history, and secure outbound requests.

Zyvan is being built to provide that reliability layer.

How It Works

Application → Zyvan API → Persist → Queue → Delivery Worker → Destination

When delivery keeps failing:

Failure → Retry → Retry → Dead Letter → Replay

Architecture

Client
  ↓
Express API (/v1/*, /openapi.json, /sandbox/*)
  ↓
PostgreSQL (Transactional Outbox + Prisma)
  ↓
RabbitMQ (Direct + Exponential TTL/DLX Delay Queues)
  ↓
Delivery Worker (Rate Limit, Concurrency, Circuit Breaker, HMAC)
  ↓
Webhook Destination

PostgreSQL acts as the durable source of event state, while asynchronous workers handle delivery processing.

Core Reliability Model

Durable Ingestion

Accepted events are persisted before asynchronous delivery processing so worker failures do not make event state unrecoverable.

Idempotency

The system treats duplicate processing as an expected distributed-systems problem and uses idempotency to make retries safer.

Retries

Transient failures are retried with controlled backoff and jitter rather than immediately repeating requests.

Dead-Letter Recovery

Events that continue to fail are separated from the normal delivery path so they can be inspected and replayed after the destination problem is fixed.

Delivery History

Delivery attempts record enough information to understand what happened during an event's lifecycle.

Multi-Tenant Architecture

Zyvan is designed as a multi-tenant platform.

Organization → Projects → Destinations → Events → Deliveries → Attempts

Tenant boundaries are enforced by the backend across organization-owned resources.

The platform also models tenant-aware rate and concurrency controls.

Security

Outbound destinations are treated as a security boundary.

Zyvan includes:

  • Authentication
  • Authorization
  • Project API keys
  • Tenant isolation
  • HMAC signing
  • SSRF protection
  • Secret protection
  • Audit logging

Event Lifecycle

Received → Persisted → Queued → Delivering → Delivered

Failure path:

Delivering → Retrying → Dead Letter → Replay

Dashboard

The web application is designed around operational visibility:

  • Projects
  • Destinations
  • Events
  • Deliveries
  • Attempts
  • Failures
  • Replay
  • Usage
  • Settings

The goal is to make webhook failures understandable and recoverable without manually reconstructing them from application logs.

API

Core resources include:

/v1/events
/v1/projects
/v1/tenants
/v1/destinations

The public API handles event ingestion and platform configuration while workers handle asynchronous delivery.

Tech Stack

Layer Technology
Frontend Next.js, React
Language TypeScript
API Node.js, express.js
Database PostgreSQL
ORM Prisma
Queue RabbitMQ
Supporting Infrastructure Redis
UI Tailwind CSS, shadcn/ui
Deployment Docker

Project Structure

zyvan/
├── apps/
│   ├── api/            # Express API gateway, Better Auth, OpenAPI, Prometheus metrics
│   ├── worker/         # RabbitMQ delivery workers, TTL/DLX retries, retention, metrics
│   ├── web/            # Next.js Console Dashboard & Marketing site (proxies /docs)
│   └── docs/           # Next.js MDX Docs Portal, API Playground, Signature Debugger & Sandbox UI
├── packages/
│   ├── auth/           # Better Auth config, RBAC permissions, onboarding, audit logging
│   ├── cli/            # @zyvan/cli (login, trigger, dlq list/replay, listen)
│   ├── config/         # Zod-validated runtime configuration
│   ├── crypto/         # AES-256-GCM encryption, HMAC-SHA256 signing, SSRF HTTP client
│   ├── db/             # Prisma schema, SQL migrations, seed script, singleton client
│   ├── email/          # Resend / SMTP / dev-log transactional email sender
│   ├── logger/         # Structured Pino logging
│   ├── queue/          # RabbitMQ retry tiers & backoff calculators
│   ├── sdk/            # Official @zyvan/sdk TypeScript/Node client & webhook verifier
│   ├── types/          # Shared TypeScript interfaces
│   └── validation/     # Shared Zod request/response schemas
├── infra/
│   └── monitoring/     # Prometheus scrape config & Grafana dashboard JSON
├── tests/
│   └── e2e-pipeline.test.ts
└── .github/workflows/  # CI pipeline (Postgres + Redis + RabbitMQ + build + E2E)

Local Development

Requirements

  • Node.js 22+
  • pnpm 10+
  • Docker & Docker Compose (for PostgreSQL 16, Redis 7, RabbitMQ 3)

Installation & Live Boot

git clone https://github.com/sultanxdev/zyvan.git
cd zyvan
cp .env.example .env
pnpm install

# 1. Start PostgreSQL, Redis, and RabbitMQ
pnpm docker:up

# 2. Build shared workspace packages & generate Prisma Client
pnpm build:packages
pnpm db:generate

# 3. Run SQL migrations & seed demo org / project / tenant / API key
pnpm db:migrate
pnpm db:seed

# 4. Run services in separate terminals (or dev workflow)
pnpm dev:api     # http://localhost:4000 (API + /openapi.json + /metrics)
pnpm dev:worker  # Worker + :4001/metrics
pnpm dev:web     # http://localhost:3000 (Console + proxied /docs)
pnpm dev:docs    # http://localhost:3001/docs (Docs Portal + Interactive Tools)
  • Seeded Demo Account: founder@zyvan.dev / ZyvanDemo2026! (plus admin@zyvan.dev & viewer@zyvan.dev, configured via packages/db/prisma/seed.ts).
  • Interactive Tools: Visit http://localhost:3000/docs/tools/signature-debugger, http://localhost:3000/docs/tools/webhook-inbox, or http://localhost:4000/openapi.json.
  • Real-World End-to-End Test (with Postgres, Redis, RabbitMQ, API, and Worker running + ALLOW_TEST_LOCALHOST_WEBHOOKS=true):
    RUN_E2E=true ZYVAN_API_URL=http://localhost:4000 pnpm exec vitest run tests/e2e-pipeline.test.ts

Reliability Testing

Important scenarios include:

  • Duplicate events
  • Destination failures
  • Worker crashes
  • Queue backlogs
  • Retry recovery
  • Dead-letter handling
  • Replay
  • Tenant isolation
  • Unsafe destinations

The focus is on system behavior when dependencies fail, not only on the successful request path.

Design Principles

  1. PostgreSQL is the durable source of event state.
  2. Delivery is asynchronous.
  3. Retries use controlled backoff.
  4. Failed events remain recoverable.
  5. Tenant boundaries are enforced by the backend.
  6. Security is part of the delivery pipeline.

Project Status

Active Development

Send the event. Zyvan handles what happens next.

About

Webhook reliability infrastructure for durable event delivery, retries, idempotency, failure recovery, replay, and delivery observability.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages