Tag

#api design

6 articles tagged #api design. See all tags →

Webhooks vs Polling: The Four Problems Push Hands You
Tech9 min

Webhooks vs Polling: The Four Problems Push Hands You

Polling a resource once a minute costs 1,440 requests a day, almost all of them empty. A webhook fixes that by inverting the call, and in exchange hands you signature verification, duplicate events, out-of-order events, and retry storms. Here is what each one actually costs.

webhooksapi-designbackend
An Idempotency Key Promises One Execution, Not Eventual Success
Tech9 min

An Idempotency Key Promises One Execution, Not Eventual Success

The design detail that surprises people: Stripe caches the result of the first request under a key even when that result was a 500, and replays the failure to every retry. That is correct, and once you see why, the rest of the design follows, including where most homegrown implementations go wrong.

api designidempotencyreliability
Rate Limiting: The Algorithm Is the Easy Part
Tech9 min

Rate Limiting: The Algorithm Is the Easy Part

Everyone compares token bucket to sliding window and stops there. The decisions that actually determine whether a rate limiter works are what you key it on, whether your Retry-After header is quietly scheduling a thundering herd, and whether a client that gets a 429 can safely retry at all.

api designrate limitingbackend
OAuth Is Not a Login System. And as of 2.1 There Is Only One Flow.
Tech9 min

OAuth Is Not a Login System. And as of 2.1 There Is Only One Flow.

Two things would prevent most OAuth bugs. OAuth answers what a caller may access, not who they are, so using it to log people in is a category error. And the flow chart everyone agonized over has collapsed: authorization code plus PKCE, for every client type, no exceptions.

oauthoidcauthentication
If Your JWT Needs a Denylist, You Have Rebuilt Sessions With Extra Steps
Tech9 min

If Your JWT Needs a Denylist, You Have Rebuilt Sessions With Extra Steps

JWTs are the default choice for new apps and usually the wrong one. The reason is revocation: there is no row to delete. And the standard fix, a server-side denylist, reintroduces the database lookup that was the entire point of going stateless.

authenticationjwtsessions