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

@partython/brain-react

v1.0.0

Published

Drop-in React chat widget for the Partython AI brain. Pairs with @partython/brain.

Downloads

164

Readme

@partython/brain-react

Drop-in React chat widget for the Partython AI brain.

npm install @partython/brain-react

Quick start

import { ChatWidget } from '@partython/brain-react';

export default function App() {
  return (
    <>
      {/* your app */}
      <ChatWidget apiKey="pk_live_..." />
    </>
  );
}

That's it. The widget renders a floating launcher button. Clicking opens a chat panel that talks to https://brain.partython.com/api/v1/respond using the API key, persists conversation history in localStorage, and auto-generates a stable channel_user_id per visitor.

Props

| Prop | Type | Default | Description | |------------------|-----------------------------------|-------------------------------------|--------------------------------------------------------------| | apiKey | string (required) | — | Your pk_live_... key | | baseUrl | string | https://brain.partython.com | Override for self-hosted | | channelUserId | string | auto-generated, persisted | Stable conversation participant id | | theme | 'light' \| 'dark' | 'light' | Color scheme | | position | 'bottom-right' \| 'bottom-left' \| 'top-right' \| 'top-left' | 'bottom-right' | Launcher placement on screen | | title | string | 'Chat with us' | Header text | | welcomeMessage | string | 'Hi! How can I help today?' | First assistant turn | | placeholder | string | 'Type a message...' | Input placeholder | | primaryColor | string | '#6366F1' | Hex color for launcher / user bubble / send button |

Headless hook

If you'd rather build your own UI:

import { useBrain } from '@partython/brain-react';

function CustomChat() {
  const { send } = useBrain({ apiKey: 'pk_live_...' });

  const onClick = async () => {
    const result = await send("I need a 5-year-old's birthday party kit");
    console.log(result.response);
  };

  return <button onClick={onClick}>Ask</button>;
}

send returns the brain's full response: { response, assistant_name, request_id, metadata }. Throws on non-2xx errors with .status and .body attached.

Persistence

The widget stores up to 50 most-recent messages in localStorage under a key scoped to (apiKey, channelUserId). Conversation survives reloads and tab restores. Clearing browser storage resets it.

Server-side rendering

The widget guards every localStorage and window access. SSR builds (Next.js, Remix, Astro) won't crash — first hydration just starts a fresh session.

Accessibility

  • Launcher: aria-label="Open chat"
  • Panel: role="dialog" with aria-label
  • Close button: aria-label="Close"
  • Input: aria-label="Message input"
  • Send: aria-label="Send"
  • Enter submits, Shift+Enter inserts newline

License

MIT