Skip to content

Add OpenFeature Provider

FlagLint changes application call sites. It does not generate provider/bootstrap files.

Terminal window
npm install @openfeature/server-sdk @launchdarkly/node-server-sdk @launchdarkly/openfeature-node-server

Create one provider module such as platform/feature-flags.ts:

import { OpenFeature } from "@openfeature/server-sdk";
import { LaunchDarklyProvider } from "@launchdarkly/openfeature-node-server";
const ldProvider = new LaunchDarklyProvider(process.env.LD_SDK_KEY!);
await OpenFeature.setProviderAndWait(ldProvider);
export const openFeatureClient = OpenFeature.getClient();

The LaunchDarkly OpenFeature provider accepts OpenFeature targetingKey or an existing LaunchDarkly key. FlagLint preserves existing evaluation context expressions at migrated call sites.

If services import the shared client, allowlist the binding:

{
"openFeatureClientBindings": [
{
"importName": "openFeatureClient",
"modulePatterns": ["**/platform/feature-flags"]
}
]
}

For TypeScript ESM projects, configured module patterns without .js also recognize the corresponding .js runtime import specifier.