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

@nexussdk/flags

v0.0.5

Published

Ultra-lightweight feature flags and remote config client SDK for browsers and edge runtimes

Readme

@nexussdk/flags

Ultra-lightweight, production-grade feature flags and remote config client SDK for browsers and edge runtimes with MurmurHash3 bucketing, ABAC rule evaluation, real-time SSE hot-swapping, and zero-infra local dev server (< 8KB gzipped).

npm version License: MIT Bundle Size


Key Features

Core (all versions):

  • Deterministic Rollout: Pure TypeScript MurmurHash3 32-bit guarantees deterministic 0–100% bucketing matching server-side evaluation.
  • ABAC Rule Engine: Full attribute-based access control — string, number, array operators (IN, CONTAINS, STARTS_WITH), comparison, and semantic versioning rules.
  • Real-Time Streaming (SSE): SSEManager with singleton connection pooling, exponential backoff reconnects, and instant FLAG_UPDATE / FLAG_DELETE live sync.
  • Offline-First & Bootstrap: Instant 0ms boot via bootstrap options (SSR pre-evaluation, local JSON, or boolean dictionary) with background revalidation.
  • Cross-Tab Synchronization: In-memory cache backed by localStorage and BroadcastChannel.
  • Built-in Local Dev Server: nexus-flags-dev CLI with single-file web dashboard and live SSE broadcasting.

v0.0.5 — New Features:

  • 🧹 Stale Flag Detector: StaleFlagDetector scans your active flags and emits [NEXUS_STALE_FLAG] warnings for any flag that has been at 100% rollout longer than your configured threshold (default: 30 days). Eliminates the "flag graveyard" problem.

Installation

pnpm add @nexussdk/flags
# or
npm install @nexussdk/flags

(If using React or Vue, install @nexussdk/sdk instead for built-in hooks like useFeatureFlag and useVariant).


Quickstart (Vanilla JS / TypeScript)

import { NexusFlagsClient } from '@nexussdk/flags';

// 1. Initialize client
const flags = new NexusFlagsClient({
  apiKey: 'pk_live_your_api_key',
  baseUrl: 'https://api.nexus.dev',
  user: {
    id: 'usr_4829',
    country: 'VN',
    plan: 'enterprise',
    appVersion: '2.4.0',
  },
  realtime: true, // Enable SSE live streaming
});

// 2. Synchronous evaluation (0ms from cache / bootstrap)
if (flags.isEnabled('new_checkout_flow', false)) {
  mountNewCheckout();
} else {
  mountLegacyCheckout();
}

// 3. Dynamic variant configurations
const discountRate = flags.getVariant<number>('promo_banner_v2', 'discount_rate', 0);
const layoutTheme = flags.getVariant<string>('checkout_v2', 'theme', 'standard');

// 4. Listen for realtime hot-swap updates
const unsubscribe = flags.onFlagChange('new_checkout_flow', (result) => {
  console.log('Flag updated in realtime:', result.enabled, result.reason);
  if (result.enabled) {
    mountNewCheckout();
  }
});

// 5. Update user identity (e.g. after login)
await flags.identify({
  id: 'usr_9981',
  country: 'SG',
  plan: 'pro',
});

// 6. Reset user on logout
flags.reset();

// 7. Cleanup on unmount
unsubscribe();
flags.destroy();

Configuration Options (NexusFlagsOptions)

| Option | Type | Default | Description | | :--- | :--- | :--- | :--- | | apiKey | string | Env | Public API key (pk_live_... or nxs_dev_...) | | baseUrl | string | https://api.nexus.dev | Ingestion endpoint URL | | user | UserContext | Anonymous UUID | Initial user identity for ABAC rules and rollout bucketing | | bootstrap | Record<string, ...> | undefined | Pre-hydrated flags for 0ms SSR boot or offline JSON mode | | realtime | boolean | true | Enables Server-Sent Events (SSE) stream subscription | | timeoutMs | number | 3000 | Network timeout for background evaluation refresh |


Offline & Bootstrap Mode (Local JSON)

For small projects or offline development, you can completely bypass backend servers by bootstrapping flags from a local JSON file:

import localFlags from './nexus-flags.json';

const flags = new NexusFlagsClient({
  bootstrap: localFlags,
  realtime: false, // Optional: disable network calls completely
});

// Ready immediately without any network calls
const isDarkMode = flags.isEnabled('dark_mode', false);

The bootstrap parameter accepts:

  • Simple boolean flags: { dark_mode: true, beta_ui: false }
  • Standard nexus-flags.json objects created by the dev server
  • Full FlagEvaluationResult maps generated from SSR

Local Dev Server (nexus-flags-dev)

The @nexussdk/flags package includes a standalone local flag management CLI with an embedded Web GUI dashboard:

# Start local flag management server
npx nexus-flags-dev
# or in this monorepo
pnpm --filter @nexussdk/flags flags-server

CLI Options

nexus-flags-dev [options]

Options:
  -p, --port <number>   Port to listen on (default: 4568)
  --host <string>       Host interface to bind (default: localhost)
  -f, --file <path>     Path to JSON flags file (default: ./nexus-flags.json)
  -h, --help            Show help message

Endpoints

| Method | Endpoint | Description | | :--- | :--- | :--- | | GET | / or /gui | Interactive Web GUI Dashboard | | GET | /health | Health status and connected clients count | | GET | /api/v1/flags | List all flags (JSON) | | POST | /api/v1/flags | Create a new flag | | GET | /api/v1/flags/:key | Retrieve a single flag definition | | PATCH | /api/v1/flags/:key | Update flag properties, rollout %, or variants | | POST | /api/v1/flags/:key/toggle | Toggle enabled switch & broadcast to clients | | DELETE | /api/v1/flags/:key | Delete flag & broadcast deletion | | GET | /api/v1/flags/stream | Real-time SSE stream for SDK live hot-swap | | GET | /api/v1/flags/eval | Evaluation snapshot for SDK background refresh | | GET | /api/v1/flags/bootstrap | Pre-load snapshot for SSR bootstrap |

Connecting SDK to Local Dev Server

const client = new NexusFlagsClient({
  apiKey: 'nxs_dev_local',
  baseUrl: 'http://localhost:4568',
  realtime: true, // Whenever you toggle a flag in the GUI, your app updates instantly!
});

Programmatic Dev Server Export

You can also embed the flags dev server programmatically in your test harness or Vite dev server:

import { startFlagsDevServer } from '@nexussdk/flags/dev-server';

const devServer = await startFlagsDevServer({
  port: 4568,
  flagsFile: './test-flags.json',
  seed: true,
});

// Later in teardown:
await devServer.close();

Framework Compatibility Matrix

@nexussdk/flags is completely framework-agnostic with zero runtime dependencies. It supports modern and legacy frontends:

| Framework | Supported Versions | Paradigm | Documentation | | :--- | :--- | :--- | :--- | | React / Next.js | React 16.8 – 19 / Next.js 13 – 16 | Server Components, Hooks, Context | React Integration Guide | | Vue / Nuxt | Vue 2.7 & 3.x / Nuxt 3 & 4 | Composition API, <script setup>, SSR | Vue Integration Guide | | Angular | Angular 14 – 19+ / AngularJS | Signals (@if), Standalone, RxJS | Angular Integration Guide | | Svelte / SvelteKit | Svelte 3 – 5 / SvelteKit 1 & 2 | Runes ($state), Stores (writable) | Svelte Integration Guide | | Vanilla JS / Node.js | Any ES2022+ runtime (Solid, Qwik, Lit) | Direct Class instance | Vanilla JS Guide |


License

MIT © Nexus Platform