
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
nuxt-feature-flags
Advanced tools
A powerful, type-safe feature flag module for Nuxt 3 that enables both static and dynamic feature flag evaluation with server-side support. Perfect for A/B testing, gradual rollouts, and feature management.
# Using npx
npx nuxi module add nuxt-feature-flags
# Using npm
npm install nuxt-feature-flags
# Using yarn
yarn add nuxt-feature-flags
# Using pnpm
pnpm add nuxt-feature-flags
nuxt.config.ts
:export default defineNuxtConfig({
modules: ['nuxt-feature-flags'],
featureFlags: {
flags: {
newDashboard: false,
experimentalFeature: true
}
}
})
<script setup>
const { isEnabled, get } = useClientFlags()
</script>
<template>
<div>
<NewDashboard v-if="isEnabled('newDashboard')" />
<div v-if="get('experimentalFeature')?.explanation">
Flag enabled because: {{ get('experimentalFeature').explanation.reason }}
</div>
</div>
</template>
// server/api/dashboard.ts
export default defineEventHandler((event) => {
const { isEnabled } = useServerFlags(event)
if (!isEnabled('newDashboard')) {
throw createError({
statusCode: 404,
message: 'Dashboard not available'
})
}
return {
stats: {
users: 100,
revenue: 50000
}
}
})
Visit our documentation site for detailed guides and API reference.
const {
flags, // Reactive flags object
isEnabled, // (flagName: string) => boolean
get // <T>(flagName: string) => Flag<T> | undefined
} = useClientFlags()
// Check if a flag is enabled
if (isEnabled('newFeature')) {
// Feature is enabled
}
// Get flag with explanation
const flag = get('experimentalFeature')
console.log(flag.explanation)
const {
flags, // Flags object
isEnabled, // (flagName: string) => boolean
get // <T>(flagName: string) => Flag<T> | undefined
} = useServerFlags(event)
// Check if a flag is enabled
if (isEnabled('newFeature')) {
// Feature is enabled
}
// Get flag with explanation
const flag = get('experimentalFeature')
console.log(flag.explanation)
interface Flag<T = boolean> {
value: T
explanation?: {
reason: 'STATIC' | 'TARGETING_MATCH' | 'DEFAULT'
rule?: string
}
}
interface FeatureFlagsConfig {
flags?: FlagDefinition // Feature flags object
config?: string // Path to configuration file
}
type FlagDefinition = Record<string, boolean>
// Example of inline configuration
export default defineNuxtConfig({
featureFlags: {
flags: {
promoBanner: true,
betaFeature: false,
newDashboard: false
}
}
})
// Example of configuration file
// feature-flags.config.js
export default {
isAdmin: false,
newDashboard: true,
experimentalFeature: true,
promoBanner: false,
betaFeature: false,
}
// nuxt.config
export default defineNuxtConfig({
featureFlags: {
flags: {
config: './feature-flags.config.js',
}
}
})
npm install
npm run dev
MIT License © 2025 Roberth González
FAQs
Feature flags for Nuxt
The npm package nuxt-feature-flags receives a total of 72 weekly downloads. As such, nuxt-feature-flags popularity was classified as not popular.
We found that nuxt-feature-flags demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.