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

@runku/react

v0.5.4

Published

React and Next.js bindings for the Runku TypeScript client

Readme

@runku/react

React and Next.js bindings for @runku/client. The package provides typed Function references, Realtime Query hooks, Mutation and Action hooks, file transfer helpers, and request-local server utilities with hydration.

Install the exact frontend SDK pair together:

pnpm add @runku/[email protected] @runku/[email protected]

Version 0.5.0 uses Public Protocol v1 and ships with the coordinated CLI runtime Function-reference generation.

Generated Function references

runku build writes two runtime/type pairs below runku/_generated:

  • api.js and api.d.ts: browser-safe public Functions. Functions with auth: "service" are excluded.
  • server.js and server.d.ts: every externally callable public Function, including service-only Functions. Keep imports from this module in server-only files.

Internal Functions are callable only by trusted nested Function calls and are never emitted into either external tree. Function names separated by . or / become nested properties, so a Function named tasks.list is addressed as api.tasks.list. Authentication is part of the reference type; browser hooks reject an auth: "service" reference even if one is imported from the wrong module.

"use client";

import { useMutation, useQuery } from "@runku/react";
import { api } from "../runku/_generated/api.js";

export function Tasks() {
  const tasks = useQuery(api.tasks.list, { board: "today" });
  const createTask = useMutation(api.tasks.create);
  // Arguments and results are inferred from the generated reference.
  return null;
}

Provider and identity isolation

Create one stable RunkuClient, then provide a non-secret identityKey that changes whenever the effective user, guest, or service identity changes. Changing it closes the old Realtime connection and drops the old cache.

<RunkuProvider client={client} identityKey={session.user.id}>
  {children}
</RunkuProvider>

useQuery shares one Realtime subscription per canonical Function/arguments/target key. Its hydrated value is marked isStale until Realtime confirms the current state. useMutation keeps a stable Operation ID within the underlying client's retry cycle. useAction is never automatically retried. useUploadFile and useDownloadFile consume short-lived grants returned by storage Actions; the grant itself is authority and must not be logged or persisted.

The provider supports the development effect replay performed by React Strict Mode. Cleanup closes the current Realtime transport; if React subscribes the same mounted store again, the provider opens a fresh transport while retaining only that identity's cached Query snapshots.

Next.js server usage

Create the facade per request. It exposes every operation available to browser code plus preloadQuery and dehydrate.

import "server-only";
import { createRunkuReactServer } from "@runku/react/server";
import { serverApi } from "../runku/_generated/server.js";

const runku = createRunkuReactServer(serverClient, session.user.id);
const result = await runku.preloadQuery(serverApi.tasks.list, { board: "today" });
await runku.mutation(serverApi.tasks.create, { title: "Review" });
await runku.action(serverApi.tasks.export, null);
const state = runku.dehydrate();

Pass state through a RunkuHydrationBoundary surrounding RunkuProvider. Hydration uses Runku Wire Value v1 rather than JavaScript class instances, so timestamps, IDs, bytes, and 64-bit integers cross the React Server Component boundary losslessly.

The server facade also delegates uploadFile, downloadFile, and realtime. Use Realtime only in a long-lived server process with an injected WebSocket factory, not as a request-scoped Server Component subscription. It does not make Action effects retry-safe: callers remain responsible for Action idempotency. The current SDK supports Runku Application File grants. Native S3 multipart operations and a generic object-storage presigner are not part of this package.