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

@formio/feature-flags

v1.1.0

Published

Feature flag management for Form.io applications

Readme

@formio/feature-flags

A flag management system for Form.io applications that works in both backend and frontend environments.

Overview

Environment-based feature flag system that allows you to:

  • Toggle features on/off using environment variables
  • Share feature flag configuration between frontend and backend
  • Centralize feature flag definitions in one place

Installation

# In the monorepo
pnpm add @formio/feature-flags

Feature Flag Registry

All feature flags are defined in a central registry (FEATURE_FLAGS) with the following properties:

{
  key: string;           // The flag identifier (e.g., 'FEATUREX')
  defaultValue: boolean; // Default value when no environment variable is set
  envVar: string;        // Environment variable name (e.g., 'FORMIO_FEATURE_FEATUREX')
  description?: string;  // Optional description of the feature
}

Current Feature Flags

  • ESIGNATURE: Enable/disable eSignature features
    • Environment Variable: FORMIO_FEATURE_ESIGNATURE
    • Default: false

Usage

Backend

In Configuration Files

const featureFlags = require('@formio/feature-flags');

// Helper to get config from environment or docker secrets
const getConfig = (key, defaultValue) => {
  if (process.env.hasOwnProperty(key)) {
    return process.env[key];
  }
  return defaultValue;
};

// Get all feature flags with resolved values
const flags = featureFlags.getFeatureFlags(getConfig);
console.log(flags.ESIGNATURE); // true or false

// Check a specific flag
const isEnabled = featureFlags.isFeatureEnabled(
  featureFlags.FEATURE_FLAGS.ESIGNATURE.key, 
  getConfig
);

In Server/App Configuration

// apps/formio-server/config.js
const featureFlags = require('@formio/feature-flags');

module.exports = function() {
  const config = {};
  
  // Export the FEATURE_FLAGS constant for structured access
  config.FEATURE_FLAGS = featureFlags.FEATURE_FLAGS;
  
  // Get all feature flags with config overrides
  config.featureFlags = featureFlags.getFeatureFlags(getConfig);
  
  // Helper function to check if a feature flag is enabled
  config.isFeatureEnabled = (flagKey) => {
    return featureFlags.isFeatureEnabled(flagKey, getConfig);
  };
  
  return config;
};

Frontend

In Portal Formio Provider

// apps/formio-app/src/scripts/app.js
import { isFeatureEnabled, FEATURE_FLAGS } from '@formio/feature-flags';

angular
  .provider('FeatureFlags', function() {
    let featureFlags = {};

    this.setfeatureFlagsConfig = function(config) {
      featureFlags = config;
    };

    this.$get = function() {
      return function(flag) {
        const getConfig = function() {
          if (flag) {
            return featureFlags?.[flag.key] || flag.defaultValue;
          }
        };
        return isFeatureEnabled(flag, getConfig);
      };
    };
  })
  .config([
    ...
    'FeatureFlagsProvider',
    function(
    ...
    FeatureFlagsProvider
  ) {
    ...
    FeatureFlagsProvider.setfeatureFlagsConfig(AppConfig.featureFlags);
    ...
    // Check if eSignature is enabled
    if (FeatureFlagsProvider.$get()(FEATURE_FLAGS.ESIGNATURE)) {
      // Enable eSignature features
    }
  }])

In Controllers/Components

// Check if eSignature is enabled using the frontend service
if (FeatureFlags(FEATURE_FLAGS.ESIGNATURE)) {
  // Show eSignature UI
}

Environment Configuration

Feature flags can be controlled via environment variables:

# Or in .env file
FORMIO_FEATURE_ESIGNATURE=true

Adding New Feature Flags

To add a new feature flag:

  1. Open packages/feature-flags/src/types.ts
  2. Add your feature flag to the FEATURE_FLAGS registry:
export const FEATURE_FLAGS = {
  ESIGNATURE: {
    key: 'ESIGNATURE',
    defaultValue: false,
    envVar: 'FORMIO_FEATURE_ESIGNATURE',
    description: 'Enable eSignature features'
  },
  MY_NEW_FEATURE: {
    key: 'MY_NEW_FEATURE',
    defaultValue: false,
    envVar: 'FORMIO_FEATURE_MY_NEW_FEATURE',
    description: 'Description of my new feature'
  }
} as const;
  1. Rebuild the package:
pnpm build
  1. Use the new feature flag in your code:
// Backend
if (config.isFeatureEnabled(config.FEATURE_FLAGS.MY_NEW_FEATURE.key)) {
  // Feature code
}

// Frontend
if (FeatureFlagsChecker.isEnabled(FEATURE_FLAGS.MY_NEW_FEATURE.key)) {
  // Feature UI
}

Development

# Install dependencies
pnpm install

# Build the package
pnpm build