Architecture
Why your store needs a fulfilment abstraction layer
2026-10-08 · 6 min read
Symptom: change a supplier, rewrite half your code
Most auto-delivery sites do this: the order function directly fetches one vendor's API and splices the response into the page. The problems show up fast —
- Copy, stock semantics, and checkout order are tangled; touch one and everything moves.
- One upstream schema change and the page breaks.
- Want to compare two vendors? You pile it into if/else spaghetti.
The right cut: five things
Whatever the upstream looks like, it only needs to give your system five capabilities:
- Pull catalog: what's in stock, at what price, how much is left.
- Check stock: confirm before ordering.
- Create order: with an idempotency key.
- Query order: fallback for async results.
- Callback: the primary path for async results.
Abstract those five into an interface; everything else (paths, field names, signing, how out-of-stock is expressed) becomes a config item.
Payoff
- Add a supplier = add one env file; zero business-code changes.
- If the upstream dies, degrade to a cached catalog; no blank page.
- Route between vendors: cheapest, most in stock, fastest-responding wins.