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

@ops-ai/nuxt-toggly

v1.2.0

Published

Feature flags for Nuxt 3 and 4 - composables, components, directives, and server utilities

Readme

@ops-ai/nuxt-toggly

Feature flags for Nuxt 3 and 4 — composables, components, directives, and server utilities

Install

npm install @ops-ai/nuxt-toggly

Documentation

License

MIT — see also the repository LICENSE.

Issues

Use the structured issue templates.

Initial targeting context

Initial groups and claims are forwarded from module version 1.1.2 onward. Supply known context before initialization to avoid fetching once anonymously and again after setting targeting. Module options are public application defaults, visible to the browser. Do not put secrets or request-specific authenticated user data here.

// nuxt.config.ts — public defaults for a demo application
export default defineNuxtConfig({
  modules: ['@ops-ai/nuxt-toggly'],
  toggly: {
    appKey: 'your-app-key',
    environment: 'Production',
    identity: 'demo-user', // Stable identifier for this demo user.
    groups: ['beta'], // Membership used by targeting rules.
    claims: { plan: 'pro' }, // String attributes used by targeting rules.
    persistFeatures: false, // Avoid hydrating an old user's persisted flags.
  },
})

For authenticated applications, use request-local server evaluation context and a client instance initialized with the signed-in user's known context. Never rebind the shared server client for each incoming request. Empty groups ([]) and claims ({}) are forwarded unchanged. Existing persisted feature snapshots are not scoped to targeting context; this module fix does not change that cache behavior.

Nuxt 3 and 4

Register the same module in nuxt.config.ts on both generations. Nuxt 3 uses app.vue; Nuxt 4 uses app/app.vue by default. The module registers its own runtime plugins, components and imports independently of that directory layout. Keep the Node version required by your Nuxt release: current Nuxt 4.5 requires Node 22.19+, 24.11+, or 26+. The SDK's Node 18 declaration is retained for older compatible Nuxt releases; it does not override the host framework's engines.

<script setup lang="ts">
const { isEnabled } = useFeatureFlag('NewDashboard')
const toggly = useToggly()
</script>

<template>
  <Feature feature-key="NewDashboard"><p>New dashboard</p></Feature>
  <Feature :feature-keys="['NewDashboard', 'Reports']" requirement="any">
    <p>At least one feature is enabled</p>
  </Feature>
  <button @click="toggly.refresh()">Refresh features</button>
</template>

Server helpers such as isEventFeatureOn(event, key) are auto-imported into Nitro routes. autoImport: false, globalComponents: false, and globalDirectives: false retain their existing opt-out behavior.

With ssr: true (the default), each render evaluates the shared server's immutable definitions using that request's context, and provides a separate Vue instance. Only evaluated booleans and the request identity enter the hydration payload. The browser applies that snapshot to the core client and Vue state together, then initializes its remote client after mounting. Public isFeatureOn and gate checks agree with the rendered flags before network initialization. Request context providers registered with configureEventEvalContext also apply to SSR; do not change the shared server client's identity per request. Groups and claims in request providers affect the server evaluation only: initialize the browser with its matching context when its authenticated context differs from the public defaults.

With ssr: false, server definition fetching is disabled; Vue SSR receives only featureDefaults. Directives remain browser DOM behaviors; use <Feature> for server-rendered conditional content. Browser identity/features persistence keeps its existing options and storage keys. Server-created Vue instances are never exposed through the client package's process-global helper.