Show HN: PgHook – Docker image that streams PostgreSQL row changes to webhooks
github.comI needed real-time updates in a web UI whenever PostgreSQL table rows change, so I built PgHook. It's a 23 MB Docker image (10.1 MB compressed), .NET9 AOT-compiled, that streams logical replication events and sends them to a configurable webhook.
In my setup, the webhook converts events to SignalR messages that push updates to the UI.
I know about Debezium but I needed something minimal, and I like playing with csharp.
Congrats on the launch! I'm biased, but you should probably consider changing the webhooks to follow https://www.standardwebhooks.com/ for greater compatibility and library support.
I’ve added optional support for standard webhooks headers and the signature scheme in the latest version.
Thanks for checking it out! At this point I was focused on solving a specific problem, but improving compatibility is definitely worth looking into.
Have you found a chance to look into the LISTEN/NOTIFY? You don't have to rely on logical replication slots, which may be a win.
Yes, but (as far as I understand) LISTEN/NOTIFY would require adding triggers to the tables I need to track. Also, if the PgHook container is down, NOTIFY events would be lost — for UI updates that’s not critical, but it’s a limitation.
I’ve been experimenting with logical replication [1] for a while, and it felt like a simpler fit here.
[1] https://github.com/PgOutput2Json/PgOutput2Json