Skip to content
/ webhook Public

Secure, Multi-Tenant Webhook System, in-memory, redis or kafka with exponential backoff

Notifications You must be signed in to change notification settings

ronixa/webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌐 Webhook: A Secure Multi-Tenant Webhook System

GitHub Release

Welcome to the Webhook repository! This project provides a secure, multi-tenant webhook system that can operate using in-memory storage, Redis, or Kafka. It features exponential backoff for retry strategies, ensuring reliable message delivery in distributed systems.

Visit the Releases section for downloads.

Table of Contents

Features

  • Multi-Tenant Support: Handle multiple clients with ease.
  • Storage Options: Choose between in-memory, Redis, or Kafka.
  • Exponential Backoff: Retry failed webhooks intelligently.
  • Encryption: Secure your data with RSA encryption.
  • Partitioning: Efficiently manage message distribution with Kafka.
  • Monitoring: Integrate with Grafana for real-time metrics.

Getting Started

To get started with the Webhook system, follow the instructions below. You will need Deno installed on your machine. If you haven't done so, please visit the Deno website for installation instructions.

Prerequisites

  • Deno (version 1.0 or higher)
  • Redis or Kafka (if using these as storage options)

Installation

Clone the repository to your local machine:

git clone https://github.com/ronixa/webhook.git
cd webhook

Install the necessary dependencies:

deno run --allow-net --allow-read --allow-write --allow-env --unstable main.ts

Usage

To start the Webhook system, run the following command:

deno run --allow-net --allow-read --allow-write --allow-env --unstable main.ts

You can now send webhooks to the system. Here’s an example of how to send a webhook using curl:

curl -X POST http://localhost:8000/webhook \
-H "Content-Type: application/json" \
-d '{"event": "user_signup", "data": {"user_id": "12345"}}'

Webhook Payload Structure

The webhook payload should be in JSON format. Here’s a sample structure:

{
  "event": "event_name",
  "data": {
    "key1": "value1",
    "key2": "value2"
  }
}

Configuration

You can configure the Webhook system using environment variables. Here are the available options:

  • WEBHOOK_PORT: The port on which the webhook server will listen (default: 8000).
  • STORAGE_TYPE: The storage type to use (memory, redis, or kafka).
  • REDIS_URL: The URL for the Redis server (required if using Redis).
  • KAFKA_BROKER: The address of the Kafka broker (required if using Kafka).
  • ENCRYPTION_KEY: The RSA key for encrypting webhook data.

Example Configuration

Create a .env file in the root directory with the following content:

WEBHOOK_PORT=8000
STORAGE_TYPE=redis
REDIS_URL=redis://localhost:6379

Architecture

The Webhook system follows a microservices architecture. Here’s a high-level overview:

  1. Webhook Receiver: Listens for incoming webhook requests.
  2. Message Queue: Uses Redis or Kafka for message queuing.
  3. Worker: Processes the queued messages and sends them to the appropriate endpoint.
  4. Monitoring: Integrates with Grafana for real-time monitoring.

Component Diagram

Component Diagram

Monitoring

Integrate with Grafana to visualize the performance of your webhook system. You can set up dashboards to monitor:

  • Incoming webhook requests
  • Processing times
  • Success and failure rates

To set up monitoring, ensure you have Grafana installed and connect it to your data source.

Contributing

We welcome contributions! To contribute to the Webhook project:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Make your changes and commit them.
  4. Push your branch and create a pull request.

Please ensure that your code adheres to the project's coding standards.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or support, feel free to reach out:

Thank you for checking out the Webhook project! We hope you find it useful for your applications.

Visit the Releases section for downloads.