Transform At The Edge
Transform at the edge is one of Klok's most important design rules. It means raw system formats are translated as close as possible to the system boundary.
Why It Matters
Raw system payloads are unstable and private. A class X model may be sent over the broker, but every consumer that reads it becomes coupled to the source system, and a small vendor change can break unrelated downstream flows. Data that other systems or domains read should therefore be transformed at the edge.
By transforming at the edge:
- The broker carries stable contracts.
- Consumers do not need source system knowledge.
- Data ownership is clear.
- Schema evolution can be managed.
- Impact analysis becomes meaningful.
Onramp Rule
An onramp accepts Class X data from a source system and publishes Class B or C data to the broker when the data is to be shared.
Offramp Rule
An offramp consumes Class B or C data from the broker and transforms it to target Class X at the last moment.
Channel Adapter Rule
A channel adapter converts the protocol only and puts the payload on the broker as received. It does not break the rule when the transformation still happens at the edge, only one leg later: the adapter receives with minimal handling so that no call is lost, and a processing route or the egress of the same flow maps the payload. Nobody outside that flow reads the Class X topic. The reason is written in the solution document. See Ingress, egress, onramp and channel adapter.
Legitimate Exceptions
Sometimes reality forces exceptions: urgent raw transport, huge payloads, old systems, or unclear formats. In those cases, label the exception as tactical debt, make the wrapper explicit, and plan review.
A tactical raw wrapper should never masquerade as a stable domain model.