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

@avocet/sdk

v1.0.1

Published

JavaScript SDK for fetching feature flags from Avocet

Readme

avocet-sdk

JavaScript SDK for fetching feature flags from Avocet, an open-source feature flagging and software experimentation platform.

Setup

  1. From the Avocet dashboard, create an SDK connection to generate an API key, or select an existing one.
  2. Install the package: npm install @avocet/sdk.
  3. Initialize the SDK in the application in which you wish to add feature flags:
import { AvocetClient } from '@avocet/sdk';
import { Span } from '@opentelemetry/api'; // we use OpenTelemetry as an example, but other providers work

const avocetClient = AvocetClient.start({
  apiKey: '', // replace with API key from an SDK connection
  apiUrl: '', // public endpoint of the flagging API
  attributeAssignmentCb: (attributes: Record<string, string>, span: Span) => {
    span.setAttributes(attributes);
  }, // an optional callback defining how to save flag attributes onto telemetry data
  autoRefresh: true, // if true, periodically fetches data for all flags in the environment
  refreshIntervalInSeconds: 300, // defaults to 300 seconds (5 minutes)
  useStale: true, // defaults to true. If set to true, cached flag data will be retained when refreshing
  clientProps: {
    // client properties will be formatted and included in the attributes argument to the assignment callback
    id: 'my-user-id'
  }
});

export default avocetClient;

Usage

  1. Define flags in the Avocet dashboard.
  2. Use them to guide control flow, either with synchronous checks:
import avocetClient from './feature-flagging.ts';

if (avocetClient.get('my-boolean-flag') === true) {
  // feature logic
} else {
  // fallback logic
}

or asynchronous checks, fetching the most up-to-date value of the flag:

const flagValue = await avocetClient.getLive('my-number-flag');
if (flagValue === 2) {
  // logic for first version of the feature
} else if (flagValue === 1) {
  // logic for second version of the feature
} else {
  // fallback logic
}

If the SDK was initialized with an attribute assignment callback, you have the option to pass telemetry data into .get, which triggers the callback:

if (avocetClient.get('my-boolean-flag', currentSpan) === true) {
  // feature logic
} else {
  // fallback logic
}

Enable or disable flag refreshing:

avocetClient.startPolling();
avocetClient.stopPolling();

Instead of using the attribute assignment callback, you can get attribute data directly:

const { value, attributes } = avocetClient.getWithAttributes('my-string-flag');