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

@bandprotocol/membit

v0.0.1

Published

Official JavaScript library for Membit.

Readme

Membit JavaScript SDK

Membit's JavaScript SDK allows for easy interaction with the Membit API, offering intelligent search and content discovery capabilities directly from your JavaScript and TypeScript programs. Easily integrate smart search functionality into your applications, harnessing the powerful Membit Search API with advanced TypeScript support and automatic type inference.

Installing

npm i @bandprotocol/membit

Membit Cluster Search

Discover trending topics and clusters of related content using the Membit Cluster Search API. Perfect for understanding what's trending and finding relevant content clusters.

Usage

Below is a simple code snippet that shows you how to use Membit Cluster Search:

const { membit } = require("@bandprotocol/membit");

// Step 1. Instantiating your Membit client
const client = membit({ apiKey: "your-api-key" });

// Step 2. Executing a cluster search query
const clusters = await client.cluster_search("artificial intelligence", {
  limit: 3,
});

// Step 3. Printing the cluster results
console.log(clusters);

Membit Cluster Info

Get detailed information about specific content clusters. Use this to dive deeper into topics discovered through cluster search.

Usage

Below is a simple code snippet demonstrating how to use Membit Cluster Info:

const { membit } = require("@bandprotocol/membit");

// Step 1. Instantiating your Membit client
const client = membit({ apiKey: "your-api-key" });

// Step 2. Get detailed cluster information
const clusterInfo = await client.cluster_info("AI Learning Resources", {
  limit: 5,
  format: "json",
});

// Step 3. Printing the cluster details
console.log("Cluster Info:", clusterInfo);

Membit Post Search

Search for individual posts and content across the Membit platform. Perfect for finding specific content and articles.

Usage

Below is a simple code snippet demonstrating how to use Membit Post Search:

const { membit } = require("@bandprotocol/membit");

// Step 1. Instantiating your Membit client
const client = membit({ apiKey: "your-api-key" });

// Step 2. Search for posts
const posts = await client.post_search("machine learning", {
  limit: 10,
  format: "json",
});

// Step 3. Printing the post results
console.log("Found posts:", posts);

TypeScript Benefits

Method Overloads

The SDK uses TypeScript method overloads to provide precise type safety:

// TypeScript automatically infers return types
const jsonData = await client.cluster_search("query"); // Record<string, any>
const textData = await client.cluster_search("query", { format: "llm" }); // string

Format Options

Each method supports two output formats with automatic type inference:

| Format | Return Type | Use Case | TypeScript Type | | -------- | --------------------- | -------------------------------------- | --------------- | | "json" | Record<string, any> | Structured data for further processing | Object | | "llm" | string | Human-readable text for direct display | String |

Configuration Options

import { membit, MembitClientOptions } from "@bandprotocol/membit";

const client = membit({
  apiKey: "your-api-key", // Required (or set MEMBIT_API_KEY env var)
  apiBaseURL: "https://custom.api", // Optional (defaults to Membit API)
});

// All methods support these options (showing defaults)
const result = await client.cluster_search("query", {
  limit: 10, // number (default: 10)
  format: "json", // "json" | "llm" (default: "json")
  timeout: 60, // seconds (default: 60)
});

Default Parameters

All search methods use the following defaults when options are not specified:

  • limit: 10 - Maximum number of results to return
  • format: "json" - Return structured data as objects
  • timeout: 60 - Request timeout in seconds

Environment Variables

You can set your API key using environment variables:

export MEMBIT_API_KEY="your-api-key-here"

The client will automatically use this if no API key is provided in the constructor.

Examples

See the examples/ directory for more detailed usage examples:

  • examples/basic-usage.ts - Complete workflow with realistic API usage

API Methods

| Method | Purpose | Example Usage | | ---------------- | ----------------------- | ------------------------------------------------------------------ | | cluster_search | Search within clusters | client.cluster_search("artificial intelligence", { limit: 5 }) | | cluster_info | Get cluster information | client.cluster_info("AI Learning Resources", { format: "llm" }) | | post_search | Search posts | client.post_search("artificial intelligence", { format: "llm" }) |

License

This project is licensed under the terms of the MIT license.