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

@botparty/react

v0.0.78

Published

React hooks and headless components for BotParty auth + payments

Readme

@botparty/react

React hooks and headless components for BotParty auth + payments. Zero framework dependency — works with any React 18/19 app.

Next.js? Use @botparty/nextjs instead — it wraps this package with SSR support, middleware, and auto route handlers.

Install

npm install @botparty/react

Quick Start

Wrap your app with <BotPartyProvider>:

import { BotPartyProvider } from '@botparty/react';

function App() {
  return (
    <BotPartyProvider>
      <MyApp />
    </BotPartyProvider>
  );
}

Import default styles (optional — all components work headless):

import '@botparty/react/styles.css';

Hooks

useAuth()

const {
  isLoaded, isSignedIn, type, userId, namespaceId, keyId,
  email, name, picture, hasLinkedUser, signIn, signOut,
} = useAuth();

| Field | Type | Description | |-----------------|-----------------------------|------------------------------------| | isLoaded | boolean | Context finished loading | | isSignedIn | boolean | User is authenticated | | type | 'human' \| 'bot' \| null | Human OAuth or bot namespace JWT | | userId | string \| null | User ID | | namespaceId | string \| null | Namespace slug (bots) | | keyId | string \| null | Bot signing key ID | | email | string \| null | User email | | name | string \| null | Display name | | picture | string \| null | Avatar URL | | hasLinkedUser | boolean | Bot namespace linked to a human | | signIn() | (returnUrl?) => void | Redirect to login | | signOut() | () => Promise<void> | Sign out and redirect to / |

useUser()

const { user, isLoaded } = useUser();
// user: { userId, email?, name?, picture?, namespaceId? }

useWallet()

const { isLoaded, balance, currency, refetch } = useWallet();

useLedger()

const { isLoaded, entries, hasMore, loadMore, refetch } = useLedger({ autoLoad: true });

Components

Conditional Rendering

import { SignedIn, SignedOut, HasLinkedUser } from '@botparty/react';

<SignedIn>Welcome back!</SignedIn>
<SignedOut>Please sign in</SignedOut>
<HasLinkedUser>Human-linked account</HasLinkedUser>

Identity

import { UserButton, NamespaceBadge } from '@botparty/react';

<UserButton />                         // Avatar + dropdown (email, namespace, sign-out)
<UserButton afterSignOutUrl="/bye" />
<NamespaceBadge />                     // @brave-hawk-a3f2

Payments

import { WalletBalance, TransactionList, TopUpButton, SpendingControls } from '@botparty/react';

<WalletBalance />                      // "$12.50"
<WalletBalance format="full" />        // "$12.50 USD"
<TransactionList limit={10} />         // Scrollable ledger
<TopUpButton amounts={[5_000_000, 10_000_000, 25_000_000]} />  // Add credits → Stripe
<SpendingControls />                   // Spending policy editor

Styling

All components use data-botparty-* attributes. Import the default stylesheet or write your own:

[data-botparty-user-button-trigger] {
  /* your styles */
}

Override CSS custom properties for theming:

:root {
  --bp-accent: #8b5cf6;
  --bp-radius: 12px;
  --bp-bg: #1a1a1a;
  --bp-fg: #fafafa;
}

asChild Pattern

Components that support asChild replace their wrapper with your element (Radix-style):

<NamespaceBadge asChild>
  <code className="my-badge" />
</NamespaceBadge>

Provider Props

| Prop | Type | Default | Description | |----------------|--------------------|--------------------------|--------------------------------| | initialState | InitialAuthState | — | SSR-hydrated auth state | | basePath | string | "/api/botparty" | Base path for auth API routes |

Types

All types are exported:

import type {
  AuthState, AuthType, BotPartyUser, InitialAuthState,
  WalletState, LedgerEntry,
  SpendingPolicyType, SpendingPolicy,
} from '@botparty/react';