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

flaggo

v3.6.0

Published

A minimalist, zero-config, portable feature flag library.

Readme

🚩 flaggo (JavaScript / TypeScript SDK)

Version License: MIT

A minimalist, zero-config, portable feature flag library.


⚠️ Migration Guide (v3.0.0)

Flaggo has moved to a Monorepo structure.

  • If you are using JavaScript or TypeScript, no action is needed other than updating to v3.0.0.
  • If you were relying on the Python, Go, or Rust source files previously included in this package, they have been moved to their own independent packages:

📦 Installation

npm install flaggo

⚡ Quick Start (Edge & Node.js)

import { Flaggo } from "flaggo";

async function main() {
  const flags = await Flaggo.load({
    source: "https://config.example.com/flags.json",
    cacheTTL: 600,            // Cache for 10 minutes
    pollingInterval: 60,      // Optional: Refresh flags every 60s in background
    context: { userId: "user-123" },
    onRefreshError: (err) => console.error("Refresh failed", err)
  });

  if (flags.isEnabled("new-ui")) {
    console.log("New UI is active!");
  }
}

⚛️ React Integration

import { Flaggo, FlaggoProvider, useFlag } from "flaggo/react";

const flaggo = await Flaggo.load({ source: "flags.json" });

function App() {
  return (
    <FlaggoProvider flaggo={flaggo}>
      <MyComponent />
    </FlaggoProvider>
  );
}

function MyComponent() {
  const isEnabled = useFlag("new-feature");
  return isEnabled ? <NewFeature /> : <OldFeature />;
}

✨ Key Features

  • 🎯 Zero-config: Just a JSON file.
  • ⚡ Edge Optimized: Dedicated lightweight build.
  • 🔄 Automatic Polling: Periodic background refresh for long-running apps.
  • ⚛️ React Hooks: Native support for React with useFlag and <Flag />.
  • 🔗 Cross-Language Consistency: Decisions stay identical across all SDKs.
  • 🛡️ Environment-aware: Easily filter flags by environment.

💡 Pro Tips

Master Switch vs. Rules

The enabled property at the root of a flag acts as a Master Switch.

  • If enabled: false, the flag is globally disabled and rules are never evaluated.
  • For a "disabled by default but enabled for specific users" behavior: set enabled: true and use a final "catch-all" rule that returns false.

🗺️ Roadmap

  • [x] Automatic Polling: Background refresh at regular intervals.
  • [x] React & Next.js Hooks: Official useFlag() and <Flag /> components.
  • [x] Browser DevTools: Extension to inspect and override flags.
  • [x] Local Persistence: Cache flags in LocalStorage for instant startup.
  • [x] Array Support in contains: Allow the contains operator to check for values within arrays.

💾 Local Persistence

Enable persistence to cache flags in localStorage or sessionStorage. This allows the SDK to return flags immediately on startup while it fetches updates in the background.

const flaggo = await Flaggo.load({
  source: "https://api.example.com/flags.json",
  persist: true // Defaults to localStorage with auto-generated key
});

// Advanced configuration
const flaggo = await Flaggo.load({
  source: "https://api.example.com/flags.json",
  persist: {
    key: "my_custom_cache_key",
    storage: "sessionStorage", // or "localStorage" (default)
    ttl: 3600 // Override cache timeout for persistence in seconds
  }
});

🛠️ DevTools & Overrides

Flaggo includes built-in support for debugging and testing via local overrides.

1. Enable DevTools

Enable enableDevTools to expose your Flaggo instance to the global window.__FLAGGO__ object. This allows browser extensions and console debugging.

const flaggo = await Flaggo.load({
  source: "flags.json",
  enableDevTools: true
});

2. Manual Overrides

You can force a flag to be enabled/disabled or return a specific variant for the current session. Overrides take precedence over all other rules.

// Force enable a flag
flaggo.setOverride("new-feature", true);

// Force a specific variant
flaggo.setOverride("header-style", "modern");

// Remove an override
flaggo.removeOverride("new-feature");

Overrides trigger a refresh of all subscribed components (e.g., React hooks will re-render automatically).

For full documentation and other SDKs, visit the main repository.