Set up Vue SDK

Install and initialize the LaunchDarkly Vue SDK to start evaluating feature flags in your application.

Install the package

yarn add launchdarkly-vue-client-sdk

Initialize the SDK

Vue SDK initialization
// Add the code below to your main.js file.
import { createApp } from 'vue';
import App from './App.vue';
import { LDPlugin } from 'launchdarkly-vue-client-sdk';
const app = createApp(App);
// A "context" is a data object representing users, devices, organizations, and other entities.
const context = {
kind: 'user',
key: 'EXAMPLE_CONTEXT_KEY',
name: 'Sandy',
};
// This is your client-side ID.
app.use(LDPlugin, {
clientSideID: 'YOUR_CLIENT_SIDE_ID',
context: context
});
app.mount('#app');

You can find your server-side SDK keys, mobile keys, and client-side ID on the SDK keys page under Settings.

To learn more, read Initialize the client and context in the Vue SDK reference guide.