NuxtHub KV to ViteHub KV migration
Move existing NuxtHub KV apps to ViteHub KV while keeping runtime call sites small.
Use this guide when an existing NuxtHub KV app should move to ViteHub KV.
The runtime shape is still a shared kv handle. The main changes are the package name, module registration, and top-level config key.
What Stays the Same
- Store and read values with one runtime handle.
- Keep provider options in app config.
- Use Cloudflare KV bindings for Cloudflare deployments.
- Use key prefixes to group related values.
What Changes
| NuxtHub | ViteHub |
|---|---|
hub.kv | top-level kv |
@nuxthub/kv | @vitehub/kv |
| NuxtHub module setup | modules: ['@vitehub/kv/nuxt'] |
| NuxtHub KV SDK docs | ViteHub KV usage |
Update Nuxt Config
Before:
nuxt.config.ts
export default defineNuxtConfig({
hub: {
kv: {
driver: 'cloudflare-kv-binding',
namespaceId: '<kv-namespace-id>',
},
},
})
After:
nuxt.config.ts
export default defineNuxtConfig({
modules: ['@vitehub/kv/nuxt'],
kv: {
driver: 'cloudflare-kv-binding',
binding: 'KV',
namespaceId: '<kv-namespace-id>',
},
})
For the full hosted Cloudflare setup, see Cloudflare.
Update Runtime Imports
Before:
server/api/settings.get.ts
import { kv } from '@nuxthub/kv'
After:
server/api/settings.get.ts
import { kv } from '@vitehub/kv'
Verify One Route
Add or keep a simple read route:
server/api/settings.get.ts
import { kv } from '@vitehub/kv'
export default defineEventHandler(async () => {
return {
settings: await kv.get('settings'),
}
})
Then deploy or run locally and request it:
curl http://localhost:3000/api/settings
Migration Checklist
- Install
@vitehub/kv. - Register
@vitehub/kv/nuxt. - Move config from
hub.kvto top-levelkv. - Replace
@nuxthub/kvimports with@vitehub/kv. - Confirm Cloudflare
bindingandnamespaceIdvalues. - Use Troubleshooting if the runtime mount or provider credentials fail.

