Skip to content

Commit a1477d5

Browse files
committed
chore: adding scaffolding for OF node server provider
1 parent 3812c08 commit a1477d5

15 files changed

Lines changed: 222 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ stats.html
2828
.env.local
2929
.env.*.local
3030
.claude/worktrees
31+
.claude/stacks
3132
.mcp.json

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,6 @@
2323
"packages/telemetry/node-server-sdk-otel": "1.3.13",
2424
"packages/tooling/jest": "1.0.14",
2525
"packages/sdk/shopify-oxygen": "0.1.10",
26-
"packages/sdk/react": "4.0.0"
26+
"packages/sdk/react": "4.0.0",
27+
"packages/sdk/openfeature-node-server": "1.2.0"
2728
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@
5858
"packages/sdk/shopify-oxygen/contract-tests",
5959
"packages/sdk/shopify-oxygen/example",
6060
"packages/sdk/browser/example",
61-
"packages/sdk/browser/example-fdv2"
61+
"packages/sdk/browser/example-fdv2",
62+
"packages/sdk/openfeature-node-server"
6263
],
6364
"private": true,
6465
"scripts": {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2025 Catamorphic, Co.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# LaunchDarkly OpenFeature Provider for the Node.js Server-Side SDK
2+
3+
<!--
4+
[![NPM][openfeature-node-server-npm-badge]][openfeature-node-server-npm-link]
5+
[![Actions Status][openfeature-node-server-ci-badge]][openfeature-node-server-ci]
6+
-->
7+
8+
> [!CAUTION]
9+
> This SDK is experimental and should NOT be considered ready for production use.
10+
> It may change or be removed without notice and is not subject to backwards
11+
> compatibility guarantees.
12+
13+
This package provides an [OpenFeature](https://openfeature.dev/) provider that wraps the [LaunchDarkly Server-Side SDK for Node.js](https://github.com/launchdarkly/js-core/tree/main/packages/sdk/server-node).
14+
15+
## Installation
16+
17+
```bash
18+
npm install @openfeature/server-sdk @launchdarkly/node-server-sdk @launchdarkly/openfeature-node-server
19+
```
20+
21+
## Usage
22+
23+
```typescript
24+
import { OpenFeature } from '@openfeature/server-sdk';
25+
import { LaunchDarklyProvider } from '@launchdarkly/openfeature-node-server';
26+
27+
const provider = new LaunchDarklyProvider('your-sdk-key');
28+
await OpenFeature.setProviderAndWait(provider);
29+
30+
const client = OpenFeature.getClient();
31+
const flagValue = await client.getBooleanValue('flag-key', false, {
32+
targetingKey: 'user-key',
33+
});
34+
```
35+
36+
## Contributing
37+
38+
See [Contributing](../../../CONTRIBUTING.md).
39+
40+
## Verifying SDK build provenance with the SLSA framework
41+
42+
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
43+
44+
## About LaunchDarkly
45+
46+
- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
47+
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
48+
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
49+
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
50+
- Grant access to certain features based on user attributes, like payment plan (eg: users on the 'gold' plan get access to more features than users in the 'silver' plan).
51+
- Disable parts of your application to facilitate maintenance, without taking everything offline.
52+
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Check out [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
53+
- Explore LaunchDarkly
54+
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
55+
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
56+
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
57+
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates
58+
59+
<!--
60+
[openfeature-node-server-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/openfeature-node-server.svg?style=flat-square
61+
[openfeature-node-server-npm-link]: https://www.npmjs.com/package/@launchdarkly/openfeature-node-server
62+
[openfeature-node-server-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/openfeature-node-server.yml/badge.svg
63+
[openfeature-node-server-ci]: https://github.com/launchdarkly/js-core/actions/workflows/openfeature-node-server.yml
64+
-->
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
it('package scaffolding builds and registers in the workspace', () => {
2+
expect(true).toEqual(true);
3+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default {
2+
transform: { '^.+\\.ts?$': 'ts-jest' },
3+
testMatch: ['**/__tests__/**/*test.ts?(x)'],
4+
testEnvironment: 'node',
5+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
6+
collectCoverageFrom: ['src/**/*.ts'],
7+
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"name": "@launchdarkly/openfeature-node-server",
3+
"version": "1.2.0",
4+
"description": "LaunchDarkly OpenFeature provider for the Node.js server SDK",
5+
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/openfeature-node-server",
6+
"repository": {
7+
"type": "git",
8+
"url": "https://github.com/launchdarkly/js-core.git"
9+
},
10+
"main": "./dist/index.cjs",
11+
"module": "./dist/index.js",
12+
"types": "./dist/src/index.d.ts",
13+
"type": "module",
14+
"exports": {
15+
".": {
16+
"require": {
17+
"types": "./dist/src/index.d.ts",
18+
"default": "./dist/index.cjs"
19+
},
20+
"import": {
21+
"types": "./dist/src/index.d.ts",
22+
"default": "./dist/index.js"
23+
}
24+
}
25+
},
26+
"engines": {
27+
"node": ">=20"
28+
},
29+
"scripts": {
30+
"build": "tsup-node && npx tsc --emitDeclarationOnly --declaration --outDir dist",
31+
"lint": "npx eslint . --ext .ts",
32+
"lint:fix": "yarn run lint --fix",
33+
"test": "jest",
34+
"check": "yarn lint && yarn build && yarn test"
35+
},
36+
"files": [
37+
"dist"
38+
],
39+
"keywords": [
40+
"launchdarkly",
41+
"openfeature",
42+
"feature-flags"
43+
],
44+
"author": "LaunchDarkly",
45+
"license": "Apache-2.0",
46+
"dependencies": {
47+
"@launchdarkly/js-sdk-common": "2.24.3",
48+
"@launchdarkly/openfeature-js-server-common": "0.1.0"
49+
},
50+
"peerDependencies": {
51+
"@launchdarkly/node-server-sdk": "9.x",
52+
"@openfeature/server-sdk": "^1.16.0"
53+
},
54+
"devDependencies": {
55+
"@launchdarkly/node-server-sdk": "9.10.12",
56+
"@openfeature/core": "^1.10.0",
57+
"@openfeature/server-sdk": "^1.16.0",
58+
"@types/jest": "^29.5.3",
59+
"@typescript-eslint/eslint-plugin": "^6.20.0",
60+
"@typescript-eslint/parser": "^6.20.0",
61+
"eslint": "^8.45.0",
62+
"eslint-config-prettier": "^8.8.0",
63+
"eslint-plugin-import": "^2.27.5",
64+
"eslint-plugin-jest": "^27.6.3",
65+
"eslint-plugin-prettier": "^5.0.0",
66+
"jest": "^29.6.1",
67+
"prettier": "^3.0.0",
68+
"ts-jest": "^29.1.1",
69+
"tsup": "^8.5.1",
70+
"typescript": "5.1.6"
71+
}
72+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* This is the API reference for the LaunchDarkly OpenFeature provider for the
3+
* Node.js server SDK.
4+
*
5+
* @module @launchdarkly/openfeature-node-server
6+
*/
7+
8+
// Provider implementation lands in a follow-up slice.
9+
export {};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"compilerOptions": {
3+
"rootDir": ".",
4+
"outDir": "dist",
5+
"target": "es2020",
6+
"lib": ["es2020"],
7+
"module": "ESNext",
8+
"strict": true,
9+
"noImplicitOverride": true,
10+
"allowSyntheticDefaultImports": true,
11+
"esModuleInterop": true,
12+
"sourceMap": true,
13+
"declaration": true,
14+
"declarationMap": true,
15+
"resolveJsonModule": true,
16+
"stripInternal": true,
17+
"moduleResolution": "bundler"
18+
},
19+
"include": ["src"],
20+
"exclude": ["**/*.test.ts", "dist", "node_modules", "__tests__"]
21+
}

0 commit comments

Comments
 (0)