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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@xfeature/nestjs

v1.0.5

Published

A NestJS integration for @xfeature/core that provides decorators for feature-flagging controllers and modules.

Readme

@xfeature/nestjs

A NestJS integration for @xfeature/core that provides decorators for feature-flagging controllers and modules.

Installation

bun add @xfeature/nestjs

Quick Start

1. Define your features

import { defineFeature, registerFeatures } from '@xfeature/core';

export const Features = registerFeatures({
  UserManagement: defineFeature('user-management', {
    Registration: defineFeature('registration'),
    Profile: defineFeature('profile')
  }),
  Analytics: defineFeature('analytics')
});

2. Use features in your NestJS application

import { Controller } from '@nestjs/common';
import { FeatureController } from '@xfeature/nestjs';
import { Features } from './features';

@FeatureController(Features.UserManagement)
export class UserController {
  @Get()
  getUsers() {
    // This controller is only accessible when user-management feature is enabled
    return this.userService.getUsers();
  }
}

@FeatureController(Features.UserManagement.Registration)
export class RegistrationController {
  @Post()
  register(@Body() userData: any) {
    // This controller is only accessible when user-management.registration feature is enabled
    return this.userService.register(userData);
  }
}

3. Feature-flag entire modules

import { Module } from '@nestjs/common';
import { FeatureModule } from '@xfeature/nestjs';
import { Features } from './features';

@FeatureModule(Features.Analytics)
export class AnalyticsModule {
  // This module is only loaded when analytics feature is enabled
}

API Reference

@FeatureController(feature, options?)

Decorator that conditionally applies @Controller() based on feature flag state.

@FeatureController(Features.UserManagement)
export class UserController {
  // Controller is only registered when user-management feature is enabled
}

@FeatureModule(feature, options?)

Decorator that conditionally applies @Module() based on feature flag state.

@FeatureModule(Features.Analytics)
export class AnalyticsModule {
  // Module is only registered when analytics feature is enabled
}

Best Practices

  1. Organize Features Hierarchically: Use nested features to group related functionality

    const Features = {
      Ecommerce: defineFeature('ecommerce', {
        Cart: defineFeature('cart'),
        Payment: defineFeature('payment')
      })
    };
  2. Use Environment Variables: Features are automatically loaded from environment variables

    # Enable specific features
    FEATURES="user-management,analytics,user-management.registration"
  3. Feature Naming: Use kebab-case for feature names to ensure consistency

    defineFeature('user-management') // ✅ Good
    defineFeature('userManagement') // ❌ Avoid

License

This project is licensed under the MIT License - see the LICENSE file for details.