Storage
NuxtHub
Use NuxtHub KV as the storage backend for feature flags.
The recommended storage backend. NuxtHub KV provides persistent key-value storage on Cloudflare with a single config line.
Setup
Install NuxtHub
pnpm add @nuxthub/core
Configure
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@nuxthub/core', '@adamkasper/nuxt-unleash'],
hub: {
kv: true,
},
unleash: {
url: 'https://your-proxy.example.com/api/frontend',
token: 'your-frontend-token',
appName: 'my-app',
storage: 'nuxthub',
},
})
@nuxthub/core must be listed before@adamkasper/nuxt-unleash in the modules array.How It Works
- Flags are stored in NuxtHub KV under the
unleash:flagskey - A TTL of
refreshInterval * 10is set as a safety net (e.g., 150s with the default 15s refresh) - The refresh lock uses a separate key with a 5-second deduplication window
- KV reads are fast and co-located with your Worker — no HTTP roundtrip
When to Use
- Deploying to Cloudflare Workers via NuxtHub
- You want persistent cache that survives Worker restarts
- You want zero-config storage