← All posts

The channel and notification system

Not every part of Dawnshard is a novel idea. Some of it is just well-established patterns applied consistently. The channel system is a good example of that.

What we built

The comms system has a channel contract that any concrete delivery mechanism implements, and a MessageHub that domain code talks to instead of calling providers directly. A channel has a name, accepts a normalised message DSL, and handles translating that into whatever its provider expects. The hub looks up a channel by name and hands it the message.

That is a provider abstraction. It is not an unusual idea. The point is that domain code has no business knowing whether an email goes through SendGrid, SES, or something else, and this is where that boundary lives in Dawnshard.

The contract is defined and the hub is implemented. Concrete provider plugins are the next thing to wire up: the mail channel is stubbed, and a test channel exists for the integration suite. Queued delivery, lifecycle tracking, and retry handling are implemented. The final provider integration is not. We have deliberately held off choosing and paying for a messaging provider this early in development.

The problem it solves

Provider logic that leaks into the service layer is the straightforward failure mode. The service that sends a verification email ends up with the SendGrid SDK call, the template ID, and the retry logic sitting alongside the identity creation code. It works until you need to swap the provider, add a second channel, or understand what was sent and when.

Keeping that concern behind a contract means the domain service states its intent and the comms layer handles delivery. The same way a domain service does not call the database directly.

The deliberate choices

Two send paths exist for different situations. Immediate dispatch fires directly through the channel without persisting a record, which is the right shape for stateless system messages like password resets. Queued dispatch is designed for anything where delivery history matters: it creates a message record first, then processes delivery asynchronously.

The message DSL is normalised rather than channel-specific. A channel translates it into whatever its provider needs. Too thin and channels end up inventing their own conventions. Too coupled to one provider and the abstraction leaks. The current shape is built around email, and it will need to grow as other channel types arrive.

Delivery failures are intentionally isolated. A failed message does not surface back to the operation that triggered it. That boundary was the same conversation that came up with the realtime engine: figuring out exactly where one concern ends and another begins.

What this unlocks

Domain code across Dawnshard now has a consistent place to send outbound communication without coupling to a provider. When the concrete mail plugin is wired up and the delivery worker running, that communication starts flowing without anything upstream changing.

For Plan.Make.Trace, it is the foundation for notifications that workshop owners will actually care about: batch completions, low stock alerts, anything worth pushing out. The contract is there. The plumbing follows.

What's next

The next post covers the ORM assembler: how Dawnshard abstracts database access behind a consistent interface so the application layer stays independent of the specific ORM or database underneath it.

Liked this post? Tap the heart to let us know.

Get early access

Be the first to hear about early access, roadmap updates, and exclusive early adopter pricing.

Join the early access list