Skip to main content
The NestJS SDK (@clubedge/feature-flags-nestjs) provides a FeatureFlagsModule that registers a singleton FeatureFlagsClient in the NestJS dependency injection container. It wraps @clubedge/feature-flags-sdk-core.

Requirements

  • NestJS 11+
  • Node.js 18+

Installation

Registration

Register the module in your root AppModule:
The module accepts the same options as any FeatureFlagsClient configuration: See SDK configuration for the full reference including retries, retryDelayMs, logger, and eventEmitter.

Injection

Inject the client into any service, controller, or provider using the FEATURE_FLAGS_CLIENT token:

Lifecycle management

The module calls client.initialize() automatically on onModuleInit. To ensure clean shutdown during NestJS termination:
Don’t forget to register FlagsLifecycleService in your module’s providers array.
The FeatureFlagsModule currently only exposes forRoot() — there is no async/factory registration method. Pass environment variables directly into forRoot().
The SDK pre-evaluates flags at config-fetch time with empty context — isEnabled() returns the cached result regardless of the context argument. For per-user targeting, use Direct HTTP.

Next steps