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

@baobabtech/behave

v0.2.1

Published

Behave usage analytics: a server client, a Next.js relay and a browser client. No queue.

Readme

@baobabtech/behave

The client for Behave, Baobab Tech's usage analytics: a server client, a Next.js relay for browser events, and a browser client. No queue, no batching, no retries, no runtime dependency.

npm i @baobabtech/behave

Quickstart (Next.js)

// a route handler or server action
import { trackFor } from "@baobabtech/behave/next";
trackFor(session.user, "export.downloaded", { format: "csv" }, { messageId: `export:${exportId}` });

// app/api/usage/route.ts: the relay browsers post to
import { createUsageRoute } from "@baobabtech/behave/next";
export const POST = createUsageRoute({
  allowedEvents: ["search.performed"],
  getUser: async () => (await getSession())?.user,
  properties: { "search.performed": { results: "number", area: "string" } },
});

// a client component
import { createUsageClient } from "@baobabtech/behave/client";
const { reportUsage } = createUsageClient<"search.performed">();
reportUsage("search.performed", { results: 12, area: "library" });

Check the key and the first events:

import { behave } from "@baobabtech/behave";
console.log(await behave.me());           // which app and key this is
console.log(await behave.ingestHealth()); // accepted, rejected, dropped, unregistered, last 24h

Entry points

| Import | What | |---|---| | @baobabtech/behave | behave and createBehave: track, identify, group, forget, report, metrics, metric, me, ingestHealth | | @baobabtech/behave/next | trackFor, createNextBehave, createUsageRoute, memoryRateLimit. Needs next 15.1 or later | | @baobabtech/behave/client | createUsageClient, for the browser. Posts to the app's relay, never to Behave |

track, identify and group never throw; failures go to onError. The reads and forget throw. trackFor runs in after(); outside a request, where after() throws, it sends at once.

A user (BehaveUser) is a string id or any object with a string id, so trackFor and getUser take Better Auth's session.user, or any app's user row, as it is.

Environment

| Variable | What | |---|---| | BEHAVE_KEY | <app-slug>:<secret>, a write key. Server only, never NEXT_PUBLIC_. Unset, nothing is sent; /next says so once per process in production (VERCEL_ENV=production, or NODE_ENV=production off Vercel) and stays silent elsewhere | | BEHAVE_READ_KEY | A read key, for report, metrics, metric, ingestHealth. Falls back to BEHAVE_KEY | | BEHAVE_RELEASE | The app version stamped on every event. /next falls back to the first 7 characters of VERCEL_GIT_COMMIT_SHA | | BEHAVE_ORIGIN | Behave's origin. Defaults to https://behave.baobabtech.app |

Docs

MIT licensed.