Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.nexus.westyx.cloud/llms.txt

Use this file to discover all available pages before exploring further.

Installation

.npmrc
@westyx-nexus:registry=https://gitlab.com/api/v4/projects/<PROJECT_ID>/packages/npm/
npm install @westyx-nexus/sdk-nodejs
Requires Node.js 18+. No token required - the registry is public.

Quick start

import { NexusClient } from '@westyx-nexus/sdk-nodejs';

const client = await NexusClient.create({
  endpoint: 'https://your-service.nexus.westyx.dev',
  apiKey:   'sk_live_...',
});

client.connect(); // SSE live updates

const dbHost  = client.getConfig('DB_HOST');
const dbPass  = client.getSecret('DB_PASSWORD');
const cert    = client.getSecretFilePath('TLS_CERT'); // path to temp file
const newUI   = client.getFlag('new-ui', false);

process.on('SIGTERM', () => client.close());

Configuration reference

NexusClient.create({
  endpoint:  'https://your-service.nexus.westyx.dev', // required
  apiKey:    'sk_live_...',                           // required unless WIF
  ttl:       300,                                     // seconds, default 300
  wif:       { enabled: true, provider: 'auto' },    // optional
  observer:  { onFallback: (reason) => console.log(reason) },
})

API

MethodReturnsDescription
getConfig(key)string | undefinedConfig value
getConfigAs<T>(key)T | undefinedTyped config
getConfigJSON(key)unknownParsed JSON config
getSecret(key)stringSecret value; throws on pk_ key or frontend kind
getSecretFilePath(key)stringTemp file path for file-type secrets
getFlag(key, default)booleanFlag value; default if not found
evaluateAB(keys, userID, attrs)Promise<Record<string,boolean>>A/B evaluation
connect()voidStart SSE stream
close()voidStop and clean up

Workload Identity Federation

const client = await NexusClient.create({
  endpoint: 'https://your-service.nexus.westyx.dev',
  wif: {
    enabled:  true,
    provider: 'auto', // 'kubernetes' | 'aws' | 'gcp' | 'azure' | 'auto'
  },
});

Error types

Error classCause
NexusPublicKeyErrorgetSecret with pk_live_ key
NexusServiceKindMismatchErrorgetSecret on kind=frontend service
NexusBillingError402 - billing blocked
NexusWIFTokenExchangeErrorServer rejected the OIDC token