Prerequisites:
- Node.js (version 18 or higher)
- Git
- A webhook provider account (Stripe, GitHub, etc.) for testing
Local Development Setup
Clone the Repository
First, clone the Unhook repository and install dependencies:
git clone https://github.com/unhook-sh/unhook.git
cd unhook
npm install
Start the Development Server
Run the development server locally:
This will start:
- The CLI webhook service on port 3000
- The web dashboard on port 3001
- The webhook processing service on port 3002
Project Structure
unhook/
├── packages/
│ ├── cli/ # Command line interface
│ ├── core/ # Core webhook processing logic
│ ├── dashboard/ # Web dashboard (Next.js)
│ └── shared/ # Shared utilities and types
├── examples/ # Example integrations
└── docs/ # Documentation
Development Workflow
Running Tests
Tests are powered by Vitest and executed with bun test
. Run the test suite with:
# Run all tests
bun test
# Run tests in watch mode
bun test --watch
# Run tests for a specific package
bun test packages/cli
We use ESLint and Prettier to maintain code quality:
# Run linter
npm run lint
# Fix linting issues
npm run lint:fix
# Format code
npm run format
Building Locally
To build all packages:
To build a specific package:
npm run build --workspace=@unhook/cli
Running Examples
We provide example integrations in the examples/
directory. To run an example:
# Navigate to an example
cd examples/stripe-webhook
# Install dependencies
npm install
# Start the example
npm run dev
Debugging
CLI Debugging
Run the CLI with debug logging:
# Using npm
npm run dev:cli -- --debug
# Direct binary
./packages/cli/bin/run --debug
Dashboard Debugging
The dashboard includes React Developer Tools and runs in development mode by default:
# Start dashboard in development mode
npm run dev:dashboard
Common Issues
Error: Port already in use
If port 3000, 3001, or 3002 is already in use, you can specify different ports:
# For CLI
npm run dev:cli -- --port 4000
# For dashboard
PORT=4001 npm run dev:dashboard
# For webhook service
WEBHOOK_PORT=4002 npm run dev:service
During development, you can use test API keys:
# Test mode
npm run dev:cli -- --webhook-id t_test_123
Contributing
We welcome contributions! Here’s how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Run tests:
bun test
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to your branch:
git push origin feature/amazing-feature
- Open a Pull Request
Contribution Guidelines
- Follow the existing code style
- Add tests for new features
- Update documentation for changes
- Keep commits focused and atomic
- Write clear commit messages
Next Steps
Responses are generated using AI and may contain mistakes.