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

@rpc-bastion/core

v0.4.1

Published

Endpoint pool, health model, and composable resilience RPC transports for Solana Kit.

Downloads

635

Readme

@rpc-bastion/core

The resilience layer as a stack of composable web3.js v2.0 (@solana/kit) RPC transports. An endpoint pool with a health + circuit-breaker model, plus higher-order transports you compose to taste — and one-call presets when you don't want to.

Composition

import { createSolanaRpcFromTransport } from '@solana/kit';
import {
  createEndpointPool, withLoadBalancer, withCircuitBreaker,
  withFailover, withRetry, withMetrics, createEventBus,
} from '@rpc-bastion/core';

const pool = createEndpointPool([
  { url: 'https://rpc-1.example.com' },
  { url: 'https://rpc-2.example.com', weight: 2 },
]);
const bus = createEventBus();

const transport = withMetrics(
  withRetry(
    withFailover(
      withCircuitBreaker(withLoadBalancer(pool, { strategy: 'health-weighted' })),
      { maxFailovers: 2 },
    ),
    { maxAttempts: 3, backoff: 'exponential-jitter' },
  ),
  bus,
);

const rpc = createSolanaRpcFromTransport(transport); // a standard Kit RPC

Or the preset: createResilientRpc(endpoints, { bus, strategy, breaker, retry }).

Layers

| Export | What it does | |---|---| | createEndpointPool | Health model (latency EWMA, sliding error rate, slot lag) + per-endpoint circuit breaker + probes | | createHttpTransport | Per-endpoint Kit transport with timing, error tagging & classification | | withLoadBalancer | health-weighted / round-robin / lowest-latency / sticky selection | | withFailover | Re-issue to the next-best endpoint on transport failures (never on app errors) | | withCircuitBreaker | Per-endpoint breaker (pool-backed) or a standalone single circuit | | withRetry | Exponential full-jitter backoff, Retry-After, retry budget | | withTimeout | Per-request deadline with abort propagation | | withHedging | Fire a backup to another endpoint after delayMs; first response wins | | withRateLimitGuard | Client-side token bucket + concurrency cap, per endpoint | | withMetrics | Installs the event bus so the whole stack emits telemetry | | createResilientTransport / createResilientRpc | The recommended stack in one call |

Design

  • No classes — factory functions, plain objects, closures.
  • Every layer is a Kit RpcTransport (a function), so it composes with your own.
  • Injectable clock/rng make timing and selection deterministic in tests.
  • Typed errors with a discriminant code; transport failures classified into network / timeout / rate-limit / server / parse (classifyError).
  • Structured events instead of logging (createEventBus); see @rpc-bastion/observability.

Application (JSON-RPC) errors are never retried or failed over — they arrive as resolved { error } responses and reach your caller untouched.