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

kirak-react

v0.2.0

Published

React hooks for the kirak client - KirakProvider, useSession, useUser, useApi, useMutation.

Readme

kirak-react

Part of the kirak-sdk monorepo. Not using React? Use kirak directly - it works the same in any JS framework (Vue, Svelte, Angular, Next.js, plain JS) and Node.

React hooks for the kirak client - session state, the current user, and data fetching/mutations, all reacting automatically to sign in/out. One package for both web React and React Native - see React Native below.

Install

npm install kirak kirak-react

Setup

import { createClient } from "kirak";
import { KirakProvider } from "kirak-react";

const kirak = createClient("https://my-app.kirak.io");

function App() {
  return (
    <KirakProvider client={kirak}>
      <YourApp />
    </KirakProvider>
  );
}

useSession()

The current session, kept live - updates on sign in/out/refresh with no re-fetch needed.

const { session, loading } = useSession();
if (loading) return <Spinner />;
if (!session) return <SignInForm />;

useUser()

The current user, re-fetched automatically whenever the session changes.

const { user, error, loading, refetch } = useUser();

useApi()

Auto-fetching wrapper over kirak.api() - fetches on mount, and again whenever operation or the contents of params change.

const { data: posts, error, loading, refetch } = useApi<Post[]>("posts.fetch", {
  status: "published",
});

Pass { skip: true } to hold off fetching (e.g. while a required param isn't ready yet):

const { data } = useApi(`posts.fetch`, { id }, { skip: !id });

useMutation()

For a call you trigger yourself - a form submit, a button click - rather than one that runs automatically on mount.

const [createPost, { loading, error }] = useMutation<{ id: number }>("posts.create");

async function onSubmit() {
  const { data, error } = await createPost({ data: { title, body } });
}

useKirak()

The raw client from the nearest <KirakProvider>, for anything the hooks above don't cover

  • e.g. calling kirak.api("auth.login", ...) directly from a form handler.
const kirak = useKirak();
await kirak.api("auth.login", { email, password });

React Native

No separate package needed - install the same kirak + kirak-react and use the same hooks. The hooks are built entirely on React's core APIs (useState, useEffect, useContext, Context.Provider), which behave identically under React Native's renderer as they do under react-dom on web - none of them touch a DOM or browser API. This has been verified directly: kirak-react's hooks are exercised in tests under react-test-renderer, React's own official non-DOM renderer that uses the same reconciler React Native attaches to.

The one platform difference is storage: web falls back to localStorage for session persistence, which does not exist in React Native. Pass AsyncStorage instead, no adapter required - its real published type signature is an exact structural match for kirak's AuthStore interface:

import AsyncStorage from "@react-native-async-storage/async-storage";
import { createClient } from "kirak";

const kirak = createClient("https://my-app.kirak.io", {
  auth: { storage: AsyncStorage },
});

This has been verified with a test using a store whose methods are genuinely async, shaped exactly like AsyncStorage's real interface (not just the synchronous in-memory store used in most other tests).

Status

Working, tested against a fake client (unit tests, no real network) and against a live backend (integration tests), including a dedicated pass proving the hooks run correctly under a non-DOM renderer for React Native. Not yet published to npm. A typed query builder on the kirak package itself is still to come; useApi/useMutation will keep working the same way once it exists, since api() stays a permanent part of kirak's surface.

License

MIT