https://github.com/davidtaing/go-webhook-server
Golang Webhook Server - Receive Webhooks, Handle Events Idempotently, and then Offload Processing to a Job Sink or a Queue
https://github.com/davidtaing/go-webhook-server
golang sqlite
Last synced: 2 months ago
JSON representation
Golang Webhook Server - Receive Webhooks, Handle Events Idempotently, and then Offload Processing to a Job Sink or a Queue
- Host: GitHub
- URL: https://github.com/davidtaing/go-webhook-server
- Owner: davidtaing
- License: other
- Created: 2024-02-05T12:05:16.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T07:31:14.000Z (over 2 years ago)
- Last Synced: 2025-09-23T23:56:31.199Z (9 months ago)
- Topics: golang, sqlite
- Language: Go
- Homepage:
- Size: 58.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Webhook Server
[](https://wakatime.com/badge/user/bfa5a500-7b93-4deb-a695-4567ab9e77a8/project/018d7932-9a15-4a60-bb32-cbc13a35a2a9)
Build a webhook server that...
- receives webhooks
- handles duplicated webhooks
- idempotentally handles webhook retries - TODO
- offloads webhook processing to background jobs - TODO
- allow for failure and resumability for background jobs - TODO
## Goals
- Build a portfolio piece.
- Spend at least 100 hours on this project.
- Improve at one of my weaker languages (either golang or elixir). Felt that golang had a better market for me as an early career.
- Be technically challenging.
## Technology
- golang
- sqlite
- go-migrate
- hand rolled SQL (no ORMs for this project)
- [spf13/cobra](https://github.com/spf13/cobra)
## Acknowlegdements
Shouting out some resources that I've used whilst building this.
**GopherCon 2019: Mat Ryer - How I Write HTTP Web Services after Eight Years**
https://www.youtube.com/watch?v=rWBSMsLG8po
**GopherCon 2017: Mitchell Hashimoto - Advanced Testing with Go**
https://www.youtube.com/watch?v=8hQG7QlcLBk
## Project Structure
The application can be broken down into multiple sub-applications:
- `server`: The main application, the Webhook server. Accessed via the `server` CLI command.
- `sender-cli`: CLI app to send test webhook events to the server. Accessed via the `send` CLI command.
- `migrations-cli`: Applies schema changes to the database. It can be accessed via the `migrate-up` and `migrate-down` CLI commands.
### Packages
- `database`: Database utils such as opening a db connection.
- `logger`: Structured logging via uber-go/zap.
- `migration`: Applies database migrations. Used by the migrate-up & migrate-down CLI commands.
- `models`: Defines the struct types for the data models used in the database.
- `repository`: Implements CRUD operations for persisting data to the database.
- `sender`: Send a webhook event to the Webhook server. Used by the `send` CLI command.
- `server`: Webhook server. This is the main application in this project.