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

@aiqfy/feature-sdk

v1.0.15

Published

Feature flag management SDK for AIQfy

Readme

AIQ Feature SDK

A TypeScript SDK for managing feature flags in your frontend applications.

Installation

npm install @aiq/feature-sdk

Basic Setup

import { FeatureSDK } from '@aiq/feature-sdk';

const featureSDK = new FeatureSDK({
  apiKey: 'your-api-key',      // The SDK key generated from your backend
  baseUrl: 'https://your-api-url',
  projectId: 'your-project-id', // Required: The project ID this SDK belongs to
  userId: 'optional-user-id',
  environment: 'optional-environment'
});

Getting Your SDK Key

  1. Create an SDK in your backend:
// Using the Go backend API
response, err := client.CreateSDKAPI(ctx, &pb.CreateSDKRequest{
  Name: "My Frontend SDK",
  ProjectId: "your-project-id"
})
  1. Use the generated SDK key in your frontend:
const featureSDK = new FeatureSDK({
  apiKey: response.sdk.key,    // The key will be in format: "aiqfy-xxxxxxxxxxxxxxxx"
  baseUrl: 'https://your-api-url',
  projectId: response.sdk.projectId
});

Checking Feature Flags

// Check if a feature is enabled
const isNewUIEnabled = await featureSDK.isEnabled('new-ui-feature');

// Get a feature variant
const variant = await featureSDK.getVariant('ab-test-feature');

// Get all feature flags for the current project
const allFlags = await featureSDK.getAllFlags();

React Example

import React, { useEffect, useState } from 'react';
import { FeatureSDK } from '@aiq/feature-sdk';

const featureSDK = new FeatureSDK({
  apiKey: process.env.REACT_APP_FEATURE_API_KEY,
  baseUrl: process.env.REACT_APP_FEATURE_API_URL,
  projectId: process.env.REACT_APP_FEATURE_PROJECT_ID
});

function MyComponent() {
  const [isNewFeatureEnabled, setIsNewFeatureEnabled] = useState(false);

  useEffect(() => {
    async function checkFeature() {
      const enabled = await featureSDK.isEnabled('new-feature');
      setIsNewFeatureEnabled(enabled);
    }
    checkFeature();
  }, []);

  return (
    <div>
      {isNewFeatureEnabled ? (
        <NewFeatureComponent />
      ) : (
        <OldFeatureComponent />
      )}
    </div>
  );
}

Updating User Context

// Update the user ID for feature evaluation
featureSDK.setUserId('new-user-id');

// Update the environment
featureSDK.setEnvironment('production');

API Reference

FeatureSDK

Constructor

new FeatureSDK(options: FeatureFlagOptions)

Options:

  • apiKey: Your SDK key for authentication (generated from backend)
  • baseUrl: The base URL of your feature flag service
  • projectId: The project ID this SDK belongs to
  • userId: (Optional) The user ID for feature evaluation
  • environment: (Optional) The environment for feature evaluation

Methods

  • isEnabled(featureId: string): Promise<boolean>

    • Checks if a feature flag is enabled
  • getVariant(featureId: string): Promise<string | undefined>

    • Gets the variant value of a feature flag
  • getAllFlags(): Promise<FeatureFlag[]>

    • Gets all feature flags for the current project
  • getFeatureFlag(featureId: string): Promise<FeatureFlag | undefined>

    • Gets a specific feature flag
  • setUserId(userId: string): void

    • Updates the user ID for feature evaluation
  • setEnvironment(environment: string): void

    • Updates the environment for feature evaluation
  • getProjectId(): string

    • Gets the current project ID

Features

  • Project-scoped feature flags
  • TypeScript support
  • Automatic caching with configurable timeout
  • User and environment context support
  • Variant support for A/B testing
  • Error handling
  • Automatic cache invalidation when context changes