Skip to main content
NexusConfig is a plain TypeScript interface holding every value required to construct a client. Pass it to NexusClient.create().

Field reference

Every option is validated by NexusClient.create(); a missing, malformed or out-of-range value throws NexusConfigError naming the option and the value instead of being coerced.
Other Westyx Nexus SDKs call this field baseUrl / BaseUrl / base_url; endpoint means the same thing.

Environment variables

NODE_ENV is not one of them. The SDK delivers configs through the client and never writes process.env, so a Nexus config named NODE_ENV changes nothing: a framework reads that variable from the process environment when it loads, before the first sync. Set it in the deployment.

API key types

Calling getSecret(...) with a public key throws NexusPublicKeyError synchronously, before the network call.

Where to keep the API key

Standard Node.js practice - environment variables:
For more structured config, libraries like dotenv, convict, or zod work seamlessly:
The SDK itself never logs the raw key.

Choosing the TTL

The TTL is a tradeoff between staleness window and redundant network traffic. With SSE enabled (the default), changes propagate in milliseconds regardless of the TTL - the TTL only matters as a safety net if the stream falls back.
While the stream is connected the background refresh runs at most once a minute - the stream pushes each change the moment it happens, so polling faster only adds load. When the stream disconnects or falls back, the refresh returns to your ttl.