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

result-rpc

v0.5.0

Published

Typed RPC for React: errors accumulate along the call path and discharge along the component tree

Downloads

706

Readme


Coding agent? Start at https://result-rpc.com/skill.md.

Package already installed? Read node_modules/result-rpc/skills/result-rpc/SKILL.md.

result-rpc is an RPC layer for React with one closed, wire-safe failure union per operation. Results are better-result 3.0's errors-as-values runtime — result-rpc adds the RPC boundary: only declared, serializable tagged errors cross the wire. Procedures return expected failures as tagged values; unexpected exceptions remain defects and cross the server boundary only as a sanitized server/internal failure.

The client adds the failures that originate along its part of the call path: offline, network, timeout, protocol, decode, and stale-client failures. React shells then claim the failures owned by higher-level UI behavior and subtract them from the unions visible below.

const query = useResultQuery(client.doc.byId, { id: "doc_123" });

if (query.state === "failure") {
  // DocNotFound | Unauthorized | ServerInternal | Offline | NetworkFailure |
  // Timeout | HttpFailure | ProtocolViolation | DecodeFailure | Stale
  query.error;
}

The same operation under authentication and transport shells exposes only the failure this component still owns:

const query = AuthShell.useQuery(client.doc.byId, { id: "doc_123" });

if (query.state === "failure") {
  // DocNotFound
  query.error;
}

Nothing was removed from the operation. The mounted shell chain owns the other tags and provides the corresponding behavior: a login dialog, offline banner, redirect, retry surface, or error-boundary escalation.

Install

npm install result-rpc

Also available through pnpm add result-rpc, yarn add result-rpc, or bun add result-rpc.

Requirements: Node.js 20.19.5 or newer and TypeScript 5.4 or newer. The React bindings require React 18.3 or newer. Published declarations are tested with TypeScript 5.4, 5.9, and 7.0.

Build the smallest complete app →

What it provides

  • Runtime contracts with codecs for inputs, outputs, tagged errors, and rich wire values.
  • Server middleware and layers whose errors become part of each affected procedure's union.
  • Direct browser and server clients that resolve Result<T, ExactUnion>.
  • A Result-native query runtime with caching, retries, pagination, optimistic updates, invalidation, entities, SSR, and hydration.
  • React shells that own classes of failure and narrow procedure unions by tree position.
  • Structured observability for declared failures and private server defects.

The package keeps runtime boundaries explicit:

| Import | Purpose | | -------------------- | ----------------------------------------------------------- | | result-rpc | Isomorphic contracts, codecs, Results, errors, and models | | result-rpc/server | Server implementations, handlers, and direct server clients | | result-rpc/client | Browser clients and transports | | result-rpc/query | React-free query runtime, including SSR work | | result-rpc/react | Providers, hooks, shells, and hydration boundaries | | result-rpc/testing | Wire-parity test clients |

Database error handling is not an entry point — it lives in db-result, a driver-agnostic Result boundary built on better-result. Fold its db/* tags into declared domain errors at the handler boundary; the procedure contract guards the lane.

Browser code imports the shared contract, never the implemented server router. That boundary keeps handlers, database drivers, secrets, and server-only error graphs out of client bundles.

Documentation

The ticket demo exercises optimistic updates, pagination, invalidation, entity patching, offline behavior, and layered error ownership.

The target architecture, the invariants it holds itself to, and the research behind them ship with the package: ARCHITECTURE.md and DESIGN.md.

Status

0.5.0 is published with npm provenance. The project is pre-1.0, so its API may still change between minor releases. CHANGELOG.md records what changed; RELEASING.md documents the release and verification process.

MIT