dhook 1.0.0
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
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
- GitHub: @alisheraxmedov
- Email: alisheraxmedov4x4@gmail.com
Made with β€οΈ in Uzbekistan πΊπΏ