npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@revealui/resilience

v0.2.4

Published

Resilience infrastructure for RevealUI - circuit breaker, retry, bulkhead patterns

Readme

@revealui/resilience

Resilience infrastructure for RevealUI applications. Implements circuit breaker, retry with exponential backoff, and bulkhead patterns for fault-tolerant service communication.

When to Use This

  • You're calling external APIs (Stripe, Supabase, AI providers) and need fault tolerance
  • You want automatic retry with backoff for transient failures
  • You need circuit breakers to prevent cascading failures across services

If your code only talks to the local database via Drizzle, you don't need this - Drizzle handles connection pooling internally.

Installation

pnpm add @revealui/resilience

Zero runtime dependencies.

API Reference

Circuit Breaker

| Export | Type | Purpose | |--------|------|---------| | CircuitBreaker | Class | Basic circuit breaker (closed/open/half-open states) | | AdaptiveCircuitBreaker | Class | Self-tuning thresholds based on error rate | | Bulkhead | Class | Concurrency limiter to isolate resource pools | | CircuitBreakerRegistry | Class | Named registry for managing multiple breakers | | CircuitBreak | Decorator | Apply circuit breaker to class methods | | createCircuitBreakerMiddleware | Function | Hono middleware for route-level protection | | fetchWithCircuitBreaker | Function | Fetch wrapper with automatic circuit breaking | | withCircuitBreaker | Function | Wrap any async function with a circuit breaker | | createResilientFunction | Function | Combine circuit breaker + retry in one wrapper | | ResilientOperation | Class | Composable resilience pipeline |

Retry

| Export | Type | Purpose | |--------|------|---------| | retry | Function | Retry an async operation with configurable policy | | retryBatch | Function | Retry multiple operations with shared policy | | retryIf | Function | Retry only when predicate matches the error | | retryUntil | Function | Retry until success condition is met | | retryWithFallback | Function | Retry with fallback value on exhaustion | | ExponentialBackoff | Class | Configurable backoff calculator | | RetryPolicies | Object | Pre-built policies (aggressive, conservative, network) | | RetryPolicyBuilder | Class | Fluent API for building custom retry policies | | Retryable | Decorator | Apply retry to class methods | | RetryableOperation | Class | Stateful retry with event hooks | | createRetryMiddleware | Function | Hono middleware for automatic request retry | | fetchWithRetry | Function | Fetch wrapper with retry |

Configuration

| Export | Type | Purpose | |--------|------|---------| | configureResilienceLogger | Function | Set custom logger (defaults to console) | | globalRetryConfig | Object | Global retry defaults |

Usage

import { retry, CircuitBreaker, RetryPolicies } from '@revealui/resilience';

// Simple retry
const result = await retry(() => fetch('https://api.stripe.com/...'), {
  maxRetries: 3,
  baseDelay: 1000,
});

// Circuit breaker for external service
const breaker = new CircuitBreaker({ failureThreshold: 5, resetTimeout: 30000 });
const data = await breaker.execute(() => callExternalAPI());

JOSHUA Alignment

  • Hermetic: Isolates failure domains - one service's outage doesn't cascade to others
  • Adaptive: Self-tuning circuit breakers adjust thresholds based on observed error rates
  • Orthogonal: Resilience patterns are composable and independent of business logic

Related Packages

  • @revealui/core - Uses resilience patterns for CMS API calls
  • apps/api - Applies circuit breakers to external service routes