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-vue
Requires Vue 3.3+.

Setup

import { createApp } from 'vue';
import { provideNexus } from '@westyx-nexus/sdk-vue';
import App from './App.vue';

const app = createApp(App);
provideNexus(app, {
  baseUrl: 'https://your-service.nexus.westyx.dev',
  apiKey:  'pk_live_...',
});
app.mount('#app');
The plugin blocks mounting until the initial sync completes and tears down the SSE stream on app.unmount().

Reading values

<script setup lang="ts">
import { useNexus } from '@westyx-nexus/sdk-vue';

const nexus    = useNexus();
const apiBase  = nexus.getConfig('API_BASE_URL');
const newUI    = nexus.getFlag('new-ui', false);
</script>

<template>
  <div v-if="newUI">New UI!</div>
  <div v-else>Legacy UI</div>
</template>

Composables

ComposableReturnsDescription
useNexus()clientFull client access
useConfig(key)Ref<string | undefined>Reactive config value
useFlag(key, default)Ref<boolean>Reactive flag value
useEvaluateAB(keys, userId, attrs)Ref<Record<string,boolean>>A/B evaluation

A/B rollout

<script setup lang="ts">
import { useEvaluateAB } from '@westyx-nexus/sdk-vue';

const flags = useEvaluateAB(['checkout-v2'], userId, { plan: 'pro' });
</script>

<template>
  <CheckoutV2 v-if="flags['checkout-v2']" />
  <CheckoutV1 v-else />
</template>

SSE live updates

The SDK opens an SSE stream automatically after setup. Value changes propagate within milliseconds. Reactive refs update automatically, triggering Vue’s reactivity system. The stream uses a 429-aware pre-flight fetch probe with exponential backoff (1→30 s) and a 3-strike circuit breaker. The plugin teardown in both provideNexus and createNexusPlugin().install wraps app.unmount to call client.disconnectStream() - no leaked connections during HMR or SSR shutdown.

Fallback reasons

ReasonMeaning
'max-errors'3 consecutive transport errors
'rate-limited'Server returned 429
'transport'Generic network failure