Failure-aware retry ownership for distributed Node.js services.
RetryOrigin helps distributed services communicate retry decisions so upstream services can avoid repeating recovery attempts already exhausted downstream.
Version: 0.1.0
Development status: Early development. APIs and protocol may change before the first stable release.
- Typed retry ownership metadata.
- Versioned HTTP header protocol.
- Metadata validation and parsing.
- Explicit trusted-source evaluation.
- Native Node.js HTTP adapter.
- Native Fetch adapter.
- Zero required runtime dependencies.
- Node.js 24 or newer.
Install using npm:
npm install retryorigin
import { evaluateRetry, parseMetadata } from "retryorigin";
const result = parseMetadata({
"retryorigin-version": "1",
"retryorigin-owner": "payment-service",
"retryorigin-decision": "exhausted",
"retryorigin-operation": "charge-payment",
});
const metadata = result.valid ? result.metadata : null;
const decision = evaluateRetry(metadata, {
trusted: true,
operation: "charge-payment",
});
if (decision === "suppress") {
console.log("Do not repeat this operation automatically.");
}
Only set trusted to true after your application has established that the metadata came from an authenticated, trusted internal service.
Never trust arbitrary client-provided RetryOrigin headers.
- exhausted: The owner exhausted its retry responsibility.
- not-retryable: The owner determined the operation must not be retried.
- retryable: The failure may be retried by an explicitly authorized policy.
RetryOrigin does not provide exactly-once execution, automatic deduplication, distributed transactions, or guaranteed delivery.
It does not determine whether a request is safe to retry. Applications must implement appropriate idempotency and authentication safeguards.
Run these commands from the project directory:
npm install
npm test
npm run typecheck
npm run build
npm run demo:failure
MIT