api-design

  • A 202 with a status URL beats a request that waits

    An operation that takes ninety seconds does not fit in a request, and holding the connection open converts every timeout in the chain into a failure mode. The…

  • The dotnet service that finally moved behind the same gateway

    One service in a different language, with its own auth, its own log format and its own deploy. The language was the least interesting difference.

  • A webhook must return before it does the work

    A webhook is a notification with a sender that has a timeout and a retry policy you do not control. Doing the work inline means the provider’s timeout…

  • Verifying a signature needs the raw body

    A signature is computed over the exact bytes sent, and a framework that parses JSON into an array has already thrown those bytes away. Round-tripping through a decoder…

  • A runbook link in the alert annotation

    A person woken at three in the morning should not be searching a wiki, and an alert without a runbook link is a decision deferred to somebody asleep.…

  • A read model that is allowed to be wrong for four seconds

    A report query with eleven joins, run on every dashboard load. One model cannot be shaped for both writing and reading past a certain size.

  • Log lines that a machine can read

    A grep that needed three regular expressions and a sort. A log line written for a person to read at leisure is not a record you can query.

  • Recording a real response, including the ugly ones

    Hand-written fixtures encode what you believe the provider returns, and providers return things nobody believes. The 502 with an HTML body is the one that reaches production, because…

  • An OpenAPI document that is the test suite’s source of truth

    3.1 lands in February with real JSON Schema. Generating docs from code fixes half the problem; making the document the contract fixes the other half.

  • Vite’s proxy for the API in development

    The dev server runs on a different port from the API, which is a cross-origin request, and proxying is simpler than configuring CORS for development only. changeOrigin rewrites…