@growthbook/proxy-eval

中文文档
1.3.0发布于 2026/10/31MITTypeScriptCommonJS近 30 天下载 1.7万

Remote evaluation service for proxies, edge workers, or backend APIs

原始使用文档
文档目录3 节
  1. Usage
  2. What clients see
  3. Remote Saved Groups

@growthbook/proxy-eval

Evaluates GrowthBook feature flags and experiments on a server, for remote evaluation. The GrowthBook Proxy uses it, and you can use it in your own proxies, edge workers, or backend APIs. Clients send their attributes and get back evaluated results without seeing your targeting rules.

npm install @growthbook/proxy-eval

Usage

Pass the SDK payload for a connection (from the GrowthBook API, a cache, or a webhook) and the user's attributes:

import { evaluateFeatures } from "@growthbook/proxy-eval";

const result = await evaluateFeatures({
  payload, // the SDK Connection's features payload
  attributes: { id: "user_123", country: "US" },
});

// { features, experiments, dateUpdated }

Remote evaluation clients send attributes, and optionally forcedVariations, forcedFeatures and url. Pass them through. To keep experiment assignments stable, also pass a stickyBucketService.

example/cloudflare is a complete Cloudflare Worker that reads the payload from KV.

What clients see

Rules stay on the server. Suppose you have a feature with two targeting rules and an experiment:

const rules = [
  { condition: { email: { $regex: "@acme\\.com$" } }, force: "acme-deal" },
  { condition: { plan: "enterprise" }, force: "enterprise" },
  { key: "banner-test", variations: ["standard", "promo"], coverage: 0.5 },
];

A user with plan: "enterprise" matches the second rule. Their client receives only the resulting value with no conditions and no sign that other rules exist:

{ "defaultValue": "enterprise" }

A user who doesn't match the first rules falls into the experiment rule. Their client receives only the variation they were assigned, and the others are emptied:

{ "key": "banner-test", "variations": ["standard", {}] }

Experiment and feature exposure tracking still work when evaluating a reduced payload.

Remote Saved Groups

To evaluate rules that use Remote Saved Groups, pass a savedGroupResolver that looks up the user's groups. The JS SDK's redisResolver reads the Redis that @growthbook/remote-saved-groups-redis-loader fills:

import { redisResolver } from "@growthbook/growthbook";

const result = await evaluateFeatures({
  payload,
  attributes,
  savedGroupResolver: redisResolver({ sMembers: (key) => redis.smembers(key) }),
  onSavedGroupResolverError: (err) => console.error(err),
});

With a resolver, remote group IDs sent by the client are ignored. If the lookup fails, the user is in no remote groups, and the result has no dateUpdated, so SDKs accept the next correct response.

版本与发布记录

@growthbook/proxy-eval 共发布 14 个版本,首次发布于 2023/10/10;过去 12 个月发布了 5 个版本。

版本发布日期距今
1.3.0latest2026/10/3117 天前
1.2.02026/08/133 个月前
1.1.32026/05/136 个月前
1.1.22026/01/279 个月前
1.1.12026/01/239 个月前
1.1.02025/09/171.2 年前

关于 @growthbook/proxy-eval 的常见问题

@growthbook/proxy-eval 是什么?

Remote evaluation service for proxies, edge workers, or backend APIs

如何安装 @growthbook/proxy-eval?

在项目目录运行 npm install @growthbook/proxy-eval,或使用 pnpm add / yarn add / bun add。

@growthbook/proxy-eval 支持 TypeScript 吗?

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

@growthbook/proxy-eval 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@growthbook/proxy-eval 可以商用吗?

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

@growthbook/proxy-eval 的下载量有多少?

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

@growthbook/proxy-eval 还在维护吗?

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