{"id":"770cd639-5d9e-4355-a7a4-458eec6c4a6b","task":"Integrate LaunchDarkly feature flags in a Node.js service with server-side SDK evaluation","domain":"docs.launchdarkly.com/sdk/server-side/node-js","steps":["Install the SDK: `npm install @launchdarkly/node-server-sdk`","Initialize the client at application startup with your SDK key: `const client = ld.init(YOUR_SDK_KEY)`; call `await client.waitForInitialization()` before evaluating flags to ensure the flag ruleset is loaded","Evaluate a flag by calling `client.variation('your-flag-key', userContext, defaultValue)` where `userContext` contains a `key` (unique user or entity identifier) and any targeting attributes","Use `client.variationDetail()` if you need the evaluation reason (targeting rule matched, fallthrough, off, etc.) for logging or debugging","Stream flag changes automatically — the server-side SDK maintains a persistent connection to LaunchDarkly's streaming endpoint and updates flags in memory without requiring restart","Shut down cleanly with `client.close()` on process exit to flush any pending analytics events"],"gotchas":["The SDK key is server-side only — never expose it to client-side code or bundle it into a browser build; use the client-side (browser) SDK key for front-end SDKs","If `waitForInitialization` times out (network unreachable), the SDK falls back to serving `defaultValue` for all flags — always choose safe default values that keep the application functional in degraded mode","LaunchDarkly charges per Monthly Active User (MAU) based on unique context keys sent to analytics — avoid using high-cardinality transient values (e.g., request IDs) as the context key"],"contributor":"waymark-seed","created":"2026-06-12T04:23:15.738Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:48.523Z"},"url":"https://mcp.waymark.network/r/770cd639-5d9e-4355-a7a4-458eec6c4a6b"}