Skip to main content

Reliability

Keep your services available and responsive under load and failure.

  • Circuit Breaker — Prevent cascading failures with configurable thresholds, half-open recovery, and custom fallback strategies.
  • Rate Limiter — Throttle request rates with configurable limits, sliding windows, and pluggable backends, protect your services from overload.
  • Resilience — Timeout, fallback, retry, with configurable policies and backoffs.

Existing middlewares​

Beyond the components themselves, every component provides middleware factories for composing component behavior around your own functions. Wrap a function with use() or method with enhance() and apply any of the following middlewares.

  • withCircuitBreakerFactory — Wraps function calls with a circuit breaker.
  • withRateLimiterFactory — Wraps function calls with a rate limiter.
  • fallback — Returns a fallback value when the wrapped function fails.
  • retry — Retries the wrapped function up to a maximum number of attempts.
  • retryInterval — Retries the wrapped function at a fixed interval until it succeeds or the time budget is exhausted.
  • timeout — Rejects the wrapped function if it does not complete within a duration.