Getting Started
Installation
Install and configure nuxt-unleash in your Nuxt project.
Install
pnpm add @adamkasper/nuxt-unleash
npm install @adamkasper/nuxt-unleash
yarn add @adamkasper/nuxt-unleash
Add Module
Add @adamkasper/nuxt-unleash to the modules array in your nuxt.config.ts:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@adamkasper/nuxt-unleash'],
unleash: {
url: 'https://your-unleash-proxy.example.com/api/frontend',
token: 'your-frontend-api-token',
appName: 'my-app',
},
})
The
url should point to your Unleash Proxy's Frontend API endpoint, not the Unleash server directly.Environment Variables
All options support NUXT_UNLEASH_* environment variable overrides:
.env
NUXT_UNLEASH_URL=https://your-proxy.example.com/api/frontend
NUXT_UNLEASH_TOKEN=your-frontend-api-token
NUXT_UNLEASH_APP_NAME=my-app
Verify
Use a composable in any component to verify the module is working:
app.vue
<template>
<div>
<p>Flags ready: {{ ready }}</p>
<p>Flag count: {{ flagCount }}</p>
</div>
</template>
<script setup>
const { ready, flagCount } = useFlagsStatus()
</script>
If your Unleash proxy is not reachable, the module starts gracefully with empty flags.
ready will be false until the first successful fetch.