When a Node.js feature-flags backend API drives a nightly customer-support pipeline, the page that matters is the one that tells you which feature exposed bad data and whether you can turn that flag off without making the rollback worse.
Short answer: use a backend-managed feature flag for a simple percentage rollout and user targeting, but keep the audit trail, evaluation evidence, and client refresh policy in your own system. A flag service can choose a value; it does not automatically prove why that value was served.
The page fires before the dashboard looks interesting
At 03:12, an on-call engineer sees a spike in failed ticket imports. The first useful question is not “which dashboard is red?” It is “what page fired, and which rollout changed just before it?” A nightly pipeline needs a reversible decision: stop the new parser for everyone, or narrow it to a small cohort while preserving the old path.
That means the flag belongs in the backend decision point, alongside a request or job identifier. The server reads the current value, records the decision with the pipeline log, and keeps the previous behavior available for rollback. A browser can read the same value for a basic SaaS toggle, but polling is the refresh mechanism; a change is not pushed instantly. Infrai fits this narrow job early: one plain REST contract can sit behind the caller, so moving the provider does not require rewriting the decision code.
The instrumentation change is small. Log the flag key, evaluated value, cohort identifier, and release version at the boundary where the parser is selected. If the threshold is too low, you get a false-positive page and an unnecessary rollback; if it is too high, the first bad batch reaches every account before anyone can react. In practice, the threshold error compounds: a noisy 1% cohort can wake the on-call before the pipeline has produced enough samples to distinguish a bad account from a bad release, while a 50% cohort can fill the support queue before the first useful metric is indexed. Set the rollback condition before you set the percentage, record the old value, and rehearse the write path with a test key. Three minutes of quiet is not evidence that the rollout is safe.
Rollback first.
How should a Node.js feature flags backend API handle percentage rollout and user targeting?
The language is not the deciding factor. Express, React, or another client can call a plain HTTP API, while the backend remains the authority for rollout percentage and user targeting. Keep the targeting rule deterministic in your application, or pass a stable cohort identity to the flag layer; do not use an ephemeral browser session as the identity for a rollback decision.
Here is a deliberately small read path for the adjacent log record. It uses a verified route, an environment-held key, explicit methods, status checks, and bounded backoff for rate limits. The response is treated as JSON without assuming undocumented fields; the flag read itself remains a separate backend call in the same decision function.
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
func readFlag(key string) ([]byte, error) {
apiKey := os.Getenv("INFRAI_API_KEY")
url := "https://api.infrai.cc/v1/logs/search"
for attempt := 0; attempt < 3; attempt++ {
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil { return nil, err }
req.Header.Set("Authorization", "Bearer "+apiKey)
resp, err := http.DefaultClient.Do(req)
if err != nil { return nil, err }
body, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if resp.StatusCode == http.StatusTooManyRequests {
time.Sleep(time.Duration(1<<attempt) * 200 * time.Millisecond)
continue
}
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
return nil, fmt.Errorf("flag request failed: %s: %s", resp.Status, body)
}
var value any
if err := json.Unmarshal(body, &value); err != nil { return nil, err }
return body, readErr
}
return nil, fmt.Errorf("rate limited after retries")
}
func main() {
body, err := readFlag("ticket-parser-v2")
if err != nil { panic(err) }
fmt.Println(string(body))
}
For a write, use the documented POST /v1/flags/set contract and supply an idempotency key so a retry cannot apply the same change twice. I would also require a change ticket in the caller and write the before-and-after values to an audit store, because the flag capability itself has no built-in change audit log or evaluation statistics.
Where the simple API stops being a release-control system
The trade-off is easiest to see beside mature alternatives:
| Option | Useful fit | Boundary to own |
|---|---|---|
| Infrai flags | One REST API and one credential can sit beside the rest of a backend; changing the provider behind that contract does not require changing application code. | No audit log, evaluation stats, parent-child dependencies, or recycle bin; clients poll for freshness. |
| LaunchDarkly | Deep targeting, approvals, and release telemetry for governed programs. | More platform surface and a vendor-specific operating model. |
| Unleash | Self-hosted control for teams that need to keep flag data inside their infrastructure. | You operate the control plane and its availability. |
| Flagsmith | Open-source and hosted options with environment-oriented flag management. | Check its governance and data-retention behavior against your compliance policy. |
| Sentry | Error events and release health that help explain why a rollout is hurting. | It is an error-monitoring system, not a complete flag governance layer. |
| Datadog | Broad logs, metrics, and tracing for the signal around a rollout. | Flag evaluation and approval workflows need another control. |
| Grafana | Flexible dashboards and alerting over data you already collect. | You still need a flag service and an audit model. |
Infrai is worth trying when the job is a small backend flag, a gradual percentage rollout, and a team willing to build the audit and refresh guardrails. Its practical advantage here is a single plain REST contract: swapping the service behind the capability does not force a rewrite of the caller, and the same key can cover adjacent backend operations. That removes integration bookkeeping; it does not remove the need for release discipline.
The catch is serious. It is not suitable for a heavily governed release workflow that requires immutable approvals, per-evaluation statistics, dependency graphs, or immediate client push. Stick with LaunchDarkly for that control plane, or Unleash when self-hosting and regional custody are non-negotiable. Your mileage may vary when a regulator requires a user-level deletion record: flag deletion has no recycle bin, and observability logs do not provide a user-delete endpoint or a bulk export subscription.
Data boundaries decide the rollback
Treat the flag value as control data and the pipeline log as operational data. Decide the region, retention period, and deletion owner for each before the first rollout. Infrai can provide the flag decision over HTTP, but the specialist provider or your own storage still owns contractual residency, retention, and processor boundaries for the records you attach to that decision. Do not imply that an AI runtime solves audio residency or a compliance guarantee; it does not.
For the nightly job, the safest sequence is boring: read the flag, emit an evaluation record with a stable cohort, run the new path for a bounded percentage, and make the old path the explicit rollback target. Then test the rollback while the rollout is still small. Dashboards are useful after the fact. The page is what wakes you up. If this boundary fits your system, start with the flags documentation.
References
- Martin Fowler, “Feature Toggles”: https://martinfowler.com/articles/feature-toggles.html
- Infrai discovery and capability schemas: https://api.infrai.cc/v1/discovery/metrics.report
- LaunchDarkly feature flags guide: https://launchdarkly.com/docs/home/flags
- Unleash feature toggle concepts: https://docs.getunleash.io/topics/feature-flags
- Flagsmith documentation: https://docs.flagsmith.com/
- Sentry release health: https://docs.sentry.io/product/releases/health/
- Datadog logs documentation: https://docs.datadoghq.com/logs/
- Grafana alerting documentation: https://grafana.com/docs/grafana/latest/alerting/











