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
@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
| Method | Returns | Description |
|---|
getConfig(key) | string | undefined | Config value |
getConfigAs<T>(key) | T | undefined | Typed config |
getConfigJSON(key) | unknown | Parsed JSON config |
getSecret(key) | string | Secret value; throws on pk_ key or frontend kind |
getSecretFilePath(key) | string | Temp file path for file-type secrets |
getFlag(key, default) | boolean | Flag value; default if not found |
evaluateAB(keys, userID, attrs) | Promise<Record<string,boolean>> | A/B evaluation |
connect() | void | Start SSE stream |
close() | void | Stop 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 class | Cause |
|---|
NexusPublicKeyError | getSecret with pk_live_ key |
NexusServiceKindMismatchError | getSecret on kind=frontend service |
NexusBillingError | 402 - billing blocked |
NexusWIFTokenExchangeError | Server rejected the OIDC token |