Prerequisites
- A Traffical account with a project created in the dashboard
- An SDK key (
traffical_sk_..., scopessdk:read+sdk:write) from your project settings - Node.js 18+
Initialize the client
Create a client with your organization, project, environment, and an SDK key. The client fetches the config bundle from Traffical and caches it in memory.The
await matters — the client fetches the initial bundle before it can resolve parameters. If you can’t await at startup, use createTrafficalClientSync and call waitUntilReady() later.Resolve a parameter
Call The
getParams with user context and default values. Resolution is fully local — no API call is made.context object is used for two things:- Bucketing — the unit key (typically
userId) determines which allocation the user gets, and the assignment is stable across requests. - Targeting — other fields like
locale,plan, orcountryare evaluated against policy conditions.
defaults object is your safety net. The SDK returns these values when no policy matches, when the bundle hasn’t loaded yet, or when Traffical is unreachable.Full example
Next steps
How it works
Local resolution, evaluation modes, and the config bundle.
Parameters
Typed values with defaults.
Projects & environments
What
orgId, projectId, and env refer to.CLI
Manage parameters as code.