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

@localblok/feature-flags

v0.1.0

Published

Client-side feature flags, A/B tests and staged rollouts for apps built on localblok.

Downloads

76

Readme

@localblok/feature-flags

Client-side feature flags, A/B tests and staged rollouts.

Flags are evaluated in your app, not on our servers. You download a config once and every read after that is a synchronous local computation: no request in your render path, no spinner while a flag resolves, and no outage on our side that can take down your checkout page.

Install

npm install @localblok/feature-flags

Set up

Copy your client key and base URL from Feature Flags → Install in the dashboard. The client key is public — it ships in your bundle, the same as a Firebase web config — and can do exactly two things: read flag configs and report exposure counts.

A client key belongs to one project, so the key alone says which app's flags to serve. If you run several apps, give each its own project and its own key.

import { createFlagsClient } from "@localblok/feature-flags";

export const flags = createFlagsClient({
  clientKey: "fk_live_...",
  baseUrl: "https://your-deployment.convex.site",
  userId: currentUser?.id,
  attributes: { plan: "pro", country: "US" },
});

Read them anywhere:

if (flags.getBoolean("new_checkout", false)) {
  renderNewCheckout();
}

const cta = flags.getString("cta_text", "Buy now");
const limit = flags.getNumber("upload_limit", 10);
const theme = flags.getJson("theme_config", { accent: "blue" });

Every getter takes the default to use when the flag is missing, archived, or we are unreachable. Make it the behaviour you want when the flag system isn't there at all — that is what your users get during an outage.

React

import { FlagsProvider, useBooleanFlag } from "@localblok/feature-flags/react";
import { flags } from "./flags";

function App() {
  return (
    <FlagsProvider client={flags}>
      <Checkout />
    </FlagsProvider>
  );
}

function Checkout() {
  const isNew = useBooleanFlag("new_checkout", false);
  return isNew ? <NewCheckout /> : <LegacyCheckout />;
}

Also exported: useFlag, useStringFlag, useNumberFlag, useJsonFlag, useVariant, useFlagsClient.

Environments

The SDK sends its hostname and the server picks the matching environment, using the host patterns you configured in the dashboard (localhost → Development, and so on). Override it when you need to:

createFlagsClient({ clientKey, baseUrl, environment: "staging" });

Identifying users

Bucketing is a pure function of the user id, so the same person gets the same variants back on every visit without a round trip. Call identify() after sign-in so a visitor's flags follow their account rather than their device:

flags.identify({ userId: user.id, attributes: { plan: user.plan } });

With no userId, the client generates a stable per-device id and stores it. It does that rather than re-rolling per page load because a treatment that flickers in and out is worse than no test at all.

What reaches your users, and when

| | | | --- | --- | | First paint | Last cached config, synchronously. No await needed. | | Config changes | Picked up on the next poll — every 5 minutes by default. | | Kill switch | Same poll interval. Set pollIntervalMs lower if you need it faster. | | We're unreachable | Last cached config; then the defaults in your code. |

await flags.ready() resolves once a config is in hand — from cache, bootstrap or network. It resolves on failure too, with whatever the client has, so it will not hang your boot sequence.

Exposure reporting

The client counts which variant it served and posts those counts on a timer, which is what draws the rollout chart in the dashboard. Counts only — no user ids leave your app. Turn it off with flushIntervalMs: 0.

Options

| Option | Default | | | --- | --- | --- | | clientKey | — | Required. Your fk_... key. | | baseUrl | — | Required. Your .convex.site origin. | | userId | per-device id | The bucketing unit. | | attributes | {} | Targeting attributes. | | environment | auto-detected | Overrides host matching. | | pollIntervalMs | 300000 | 0 disables polling. | | flushIntervalMs | 30000 | 0 disables exposure reporting. | | bootstrap | — | A config payload from SSR, used before the first fetch. |