dhook 1.0.0 copy "dhook: ^1.0.0" to clipboard
dhook: ^1.0.0 copied to clipboard

A lightweight webhook relay service to forward webhooks from cloud to your local development environment in real-time. Alternative to smee.io with self-hosted server support.

πŸͺ DHOOK #

Webhook Relay Service & CLI Tool

Dart pub.flutter-io.cn License: MIT Docker

Forward webhooks from the cloud to your local development environment in real-time


πŸ“– What is DHOOK? #

DHOOK is a lightweight webhook relay service that allows you to receive webhooks (from GitHub, Stripe, PayMe, etc.) on your local machine during development.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   GitHub    │──────▢  DHOOK Server   │──────▢  Your Laptop    β”‚
β”‚   Stripe    β”‚ POST  β”‚  (Your Server)  β”‚  WS   β”‚  localhost:8000 β”‚
β”‚   PayMe     β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜             β–²                          β”‚
                            β”‚                          β”‚
                     Webhook sent here         CLI Agent receives
                                               and forwards locally

πŸš€ Quick Start #

Installation #

# Install globally via pub.flutter-io.cn
dart pub global activate dhook

# Or install from source
dart pub global activate --source git https://github.com/alisheraxmedov/dhook.git

1. Deploy on Your Server #

# SSH to your server
ssh user@your-server.com

# Clone repository
git clone https://github.com/alisheraxmedov/dhook.git
cd dhook

# Configure environment
cp .env.example .env
# Edit .env with your server IP

# Run with Docker
docker-compose up -d

2. CLI Agent (on your machine) #

# Set environment variables
export DHOOK_SERVER=ws://your-server.com:3000/ws/my-channel
export DHOOK_TARGET=http://localhost:8000

# Run the client
dhook client \
  --server $DHOOK_SERVER \
  --target $DHOOK_TARGET

3. Configure Your Webhook #

Point your webhook to:

http://your-server.com:3000/webhook/my-channel

🐳 Docker Deployment #

# Build and run
docker-compose up -d

# Check logs
docker-compose logs -f

# Stop
docker-compose down

πŸ› οΈ Usage #

Server Commands #

# Start relay server on default port 3000
dhook server

# Start on custom port
dhook server --port 8080

Client Commands #

# Connect to relay and forward to localhost
dhook client \
  --server ws://your-server.com:3000/ws/my-channel \
  --target http://localhost:8000

API Endpoints #

Endpoint Method Description
/ GET Health check
/new GET Generate new channel ID
/ws/<channel> WS WebSocket connection for CLI
/webhook/<channel> ANY Receive webhooks

πŸ“¦ Programmatic Usage #

import 'package:dhook/dhook.dart';

// Start a relay server
final server = RelayServer(port: 3000);
await server.start();

// Start a CLI agent
final agent = CliAgent(
  serverUrl: 'ws://your-server.com:3000/ws/my-channel',
  targetUrl: 'http://localhost:8000',
);
await agent.start();

βš™οΈ Configuration #

Copy .env.example to .env and configure:

# Server IP address or domain
DHOOK_SERVER_HOST=your-server-ip

# Server port (default: 3000)
DHOOK_SERVER_PORT=3000

πŸ—οΈ Architecture #

dhook/
β”œβ”€β”€ bin/
β”‚   └── dhook.dart          # CLI entry point
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ dhook.dart          # Library exports
β”‚   └── src/
β”‚       β”œβ”€β”€ client/
β”‚       β”‚   └── cli_agent.dart      # WebSocket client
β”‚       β”œβ”€β”€ server/
β”‚       β”‚   └── relay_server.dart   # HTTP/WebSocket server
β”‚       β”œβ”€β”€ models/
β”‚       β”‚   └── webhook_payload.dart
β”‚       └── utils/
β”‚           └── logger.dart
β”œβ”€β”€ Dockerfile
└── docker-compose.yml

πŸ“„ License #

MIT License - see LICENSE for details.

πŸ‘€ Author #

Alisher Axmedov


Made with ❀️ in Uzbekistan πŸ‡ΊπŸ‡Ώ

3
likes
0
points
34
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight webhook relay service to forward webhooks from cloud to your local development environment in real-time. Alternative to smee.io with self-hosted server support.

Repository (GitHub)
View/report issues

Topics

#webhook #cli #development #relay #proxy

License

unknown (license)

Dependencies

args, http, path, shelf, shelf_router, shelf_web_socket, uuid, web_socket_channel

More

Packages that depend on dhook