@configdirector/server-sdk

中文文档
1.13.2发布于 2026/11/08MITTypeScriptESM + CJS构建来源已验证近 30 天下载 2317

Javascript server SDK for ConfigDirector. ConfigDirector is a remote configuration and feature flag service.

原始使用文档
文档目录5 节
  1. Install
  2. Retrieve a value
  3. Test your code
  4. Documentation
  5. Getting Help

ConfigDirector Node.js SDK

npm

Node.js server SDK for ConfigDirector, remote config and feature flags with typed values, JSON Schema validation, and safe renames of live flags. Start free, no card required.

Install

npm install --save @configdirector/server-sdk

Retrieve a value

import { createClient } from "@configdirector/server-sdk";

// The server SDK key is a secret. Do not commit it to your source code.
const client = createClient("YOUR-SERVER-SDK-KEY");
await client.initialize();

const newCheckout = client.getValue("new-checkout", false);

Full details are in the official documentation.

Test your code

@configdirector/server-sdk/testing creates a real client connected to an in-memory server that your test controls, so the code under test runs against the production client without opening a network connection or sending telemetry.

import { createTestClient } from "@configdirector/server-sdk/testing";

const testClient = createTestClient({ values: { "new-checkout": true } });
await testClient.client.initialize();

const service = new CheckoutService(testClient.client);

testClient.setValue("new-checkout", false);
testClient.removeValue("new-checkout");

The test client also holds or fails initialize (holdInitialization, completeInitialization, failInitialization) so startup and error handling can be tested. Values keep their type: a boolean, an integral number (integer), any other number (float), a string, or a plain object or array (json), and every context receives the same value. Reads behave exactly as they do against ConfigDirector. Under the test client, the first update is delivered inside initialize, so watchers run before initialize resolves and configsUpdated fires before clientReady; a held initialize that times out or is interrupted by dispose leaves the client not ready until the next initialize; an exception thrown by a watcher during a delivery is logged, as the production transports do; and since the test client sends no telemetry, every read that supplies a context with an invalid kind logs an error, rather than each invalid kind once per telemetry interval. Close the client with dispose, which ends a held initialize; closeConnection does not.

Documentation

Refer to the official documentation for the Node.js SDK.

There is also a quickstart guide for ConfigDirector and any of our SDKs.

Getting Help

版本与发布记录

@configdirector/server-sdk 共发布 35 个版本,首次发布于 2026/04/02;过去 12 个月发布了 35 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.13.2latest2026/11/083 天前
1.13.12026/11/083 天前
1.13.02026/11/064 天前
1.12.02026/10/2814 天前
1.11.12026/10/2417 天前
1.11.02026/10/2220 天前

关于 @configdirector/server-sdk 的常见问题

@configdirector/server-sdk 是什么?

Javascript server SDK for ConfigDirector. ConfigDirector is a remote configuration and feature flag service.

如何安装 @configdirector/server-sdk?

在项目目录运行 npm install @configdirector/server-sdk,或使用 pnpm add / yarn add / bun add。

@configdirector/server-sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@configdirector/server-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@configdirector/server-sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@configdirector/server-sdk 可以商用吗?

@configdirector/server-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@configdirector/server-sdk 的下载量有多少?

根据 npm 官方下载统计,@configdirector/server-sdk 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,317 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@configdirector/server-sdk 还在维护吗?

最新版本 1.13.2 发布于 2026/11/08(3 天前);至今共发布 35 个版本,其中过去 12 个月发布了 35 个;首次发布于 2026/04/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。