← All posts

Extending Dawnshard

Everything described in the last several posts covers Dawnshard's foundation. This post covers how applications built on it actually extend it, and why that extension mechanism matters for what gets to stay in the core.

Two kinds of addition

Dawnshard distinguishes between plugins and extensions. Plugins are concrete implementations of a contract the core already defines: the ORM adapter, the realtime transport, the messaging channel. Extensions are new service domains: models, services, and routes that a downstream application contributes alongside the core ones.

Neither requires modifying the core. Plugins are declared in configuration and loaded before services start, so the correct adapter is in place before anything depends on it. Extension service directories are added to the same scan paths the core uses, so extension domains are discovered and registered by the same startup process that handles core ones.

From the core's perspective, an extension domain is indistinguishable from a core domain. It goes through the same model registration, the same service build, the same access engine setup. The core does not know it exists.

Extending behaviour, not just adding it

Extension services extend the base service and participate in the normal Dawnshard lifecycle. They get RBAC, dependency injection, business rule evaluation, and the full operation set for free. Where the default behaviour is not right for the domain, the internal methods are override points: the public surface stays consistent while the implementation underneath it changes.

Configuration can also merge associations and includes into core models at startup. This is how an extension domain establishes a relationship with a core model without either one importing the other. The merge happens at registration time, before routes are mounted. The result is that a batch in Plan.Make.Trace relates to a profile in the core without the profile model having any knowledge of batches in its source.

Plugin extension points

The plugin architecture is not limited to the concrete implementations that exist today. The contracts define boundaries for any infrastructure concern that should remain swappable. Payment processing is a clear example: the contract defines the boundary, with Stripe as the likely concrete implementation. That plugin does not exist yet, but the shape for where it belongs is already established.

The concrete implementations that do exist are Sequelize for persistence, Socket.IO for realtime transport, and the mail channel adapter. In each case the concrete choice sits behind the contract and does not leak into the core. Replacing one is a job scoped to the plugin.

What stays in the core

The extension mechanism enforces a useful discipline. If a capability has to be in the core to work, it belongs there. If it can be expressed as a service domain or a plugin implementation, it does not.

That boundary is what lets Dawnshard stay general. Plan.Make.Trace adds soap manufacturing domains as extensions. Another product built on the same foundation would add its own. Neither contaminates the core, and neither inherits the other's domain assumptions.

What's next

That closes out the Dawnshard foundation. The next post starts on Plan.Make.Trace itself: the product domain, and what building on this foundation actually looks like in practice.

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