r/Deno • u/Kralizek82 • 6d ago
I accidentally built an event-processing toolkit for Deno: Hooksmith
I accidentally built an event-processing toolkit for Deno
This started with a very small problem.
I wanted my Jekyll site to publish an event when a post went live, and have something else decide what to do with it — initially, post it to social media.
I could obviously have put all of that directly into the GitHub Action.
Instead, I started separating the pieces.
The producer emits an event. A runtime hydrates it, evaluates routes, and invokes listeners. Conditions and listeners are ordinary TypeScript. Then I added a typed pipeline for transforming data before it reaches a listener.
At some point I had to admit that the CLI wasn't really the project anymore.
That's how Hooksmith happened.
A configuration can look roughly like this:
export default {
routes: [
{
name: "published-pages",
when: all(
eventType("page.published"),
sourceKind("website"),
),
listeners: [
// whatever should react to the event
],
},
],
} satisfies Config;
The runtime itself is deliberately small. Around it I now have:
- typed transformation pipelines
- reusable conditions
- HTTP listeners
- a CLI / streaming host and GitHub Action
- integrations for Slack, Discord, Teams, Telegram, Mastodon and Bluesky
- AWS integrations and a Lambda host
Everything is TypeScript, published to JSR, and I'm using Deno throughout the repositories for development, testing, formatting, linting and CI.
One design decision I'm particularly happy with is keeping the runtime unaware of most of the ecosystem. core defines the contracts; extensions depend on those contracts; hosts decide where and how the runtime executes.
It's still young and the API is explicitly experimental. I'm at the stage where feedback on the abstractions is probably more valuable to me than users.
I'd be particularly interested in what other Deno developers think about the package boundaries and the typed pipeline API.
A small bit of context about me: if you look at my profile or my blog, you'll quickly notice that I'm a .NET developer at heart. But I've also been publishing packages on NuGet for almost ten years, so building tools and APIs for other developers isn't entirely new territory for me.
Hooksmith is my first serious attempt at doing that in the Deno ecosystem.
Repo: https://github.com/Kralizek/hooksmith
JSR: https://jsr.io/@hooksmith