Skip to article
← BACK TO DISPATCH

One Endpoint, Four Clients, Zero Coordination Tax

The first version had four endpoints.

One for the middleware that pushed raw EDI text over HTTP. One for the web client that Base64-encoded everything into JSON. One for the platform-to-platform integration that handed over stored file references. One for the batch tool that sent arrays of records at once.

Four endpoints meant four contracts. Every new client had to be told which one to call, configured correctly, kept in sync with whatever changed downstream. That was coordination overhead every time something new needed to connect.

What kept catching me was that the endpoint logic was nearly identical across all four. The difference lived entirely at the intake layer, in how the payload arrived. Everything after that was the same pipeline.

If the variation is only at the surface, why is it shaping the architecture?

Then I flipped it. Run detection inside the endpoint, not in front of it. The public contract is a fixed chain: URL parameter, then recognized JSON key, then body shape or prefix, then raw text as the default. An explicit parameter can declare a validated mode. Recognized JSON keys distinguish encoded payloads from stored-file references. A recognized array shape selects the batch path. Raw EDI reaches the parser through its expected body signature, while an unmatched body takes the documented plain-text fallback. The exact ambiguity rules stay internal, but the order and accepted shapes do not. One check wins, and the same pipeline picks up from there.

That is where I almost fooled myself. Detecting a format is a trust decision, not a convenience. The order you check signals in is the whole design, because the first match wins, and a raw body that happens to look structured will lie to you. The ordering is not arbitrary. It is the contract. The fallback is not safety either: whatever matches nothing still gets parsed as plain text, so the default is a deliberate choice. Get it wrong and you have not removed the coordination tax, you have hidden it.

Four clients, one endpoint, and no endpoint-selection burden on the client side. Each accepted shape still has a documented contract and validation rules. When a fifth type appears, you register it in the chain, choose its precedence, and regression-test every shape it could shadow. Existing clients need no endpoint change only if their payloads remain unambiguous under the revised order.

The heterogeneous part was never in the data. It was always at the intake layer, before the pipeline even started. Push the decision to the boundary, make the priority explicit, and everything behind it stays uniform. Most format problems are boundary problems. They just look like schema problems until you stop treating them that way.

Get the next dispatch when it drops.

SUBSCRIBE FOR THE NEXT DROP MORE ARTICLES