Socket
Socket
Sign inDemoInstall

nuxt-growthbook

Package Overview
Dependencies
166
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nuxt-growthbook

Nuxt GrowthBook module


Version published
Maintainers
1
Created

Changelog

Source

v0.0.4

compare changes

🚀 Enhancements

  • Add new nitro endpoint as a proxy to GrowthBook API (f6af355)

❤️ Contributors

Readme

Source

Nuxt GrowthBook

npm version npm downloads License Nuxt

Nuxt GrowthBook integration module.

Quick Setup

  1. Add nuxt-growthbook dependency to your project
# Using pnpm
pnpm add -D nuxt-growthbook

# Using yarn
yarn add --dev nuxt-growthbook

# Using npm
npm install --save-dev nuxt-growthbook
  1. Add nuxt-growthbook to the modules section of nuxt.config.ts
export default defineNuxtConfig({
  modules: ['nuxt-growthbook']
})
  1. Set client key in nuxt.config.ts or .env file
export default defineNuxtConfig({
  modules: ['nuxt-growthbook'],
  growthbook: {
    clientKey: 'YOUR_CLIENT_KEY'
  }
})
GROWTHBOOK_CLIENT_KEY=YOUR_CLIENT_KEY
  1. You can now use GrowthBook in your Nuxt app ✨
<script setup>
const gb = useGrowthbook();
const bannerEnabled = gb.isOn("banner_enabled");
</script>
  1. Optional: If you want to enable caching for GrowthBook API calls, use the routeRules option in your nuxt.config.ts file.
export default defineNuxtConfig({
   routeRules: {
     "/_growthbook/features": { swr: 60 },
   },
})

Development

# Install dependencies
npm install

# Generate type stubs
npm run dev:prepare

# Develop with the playground
npm run dev

# Build the playground
npm run dev:build

# Run ESLint
npm run lint

# Run Vitest
npm run test
npm run test:watch

# Release new version
npm run release

FAQs

Last updated on 14 Jul 2023

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc