nuxthub
onmax/nuxt-skills
NuxtHub v0.10.6 애플리케이션을 구축할 때 사용됩니다. 이 라이브러리는 sqlite/postgresql/mysql을 기반으로 하는 Drizzle ORM을 비롯한 데이터베이스 기능, KV 스토리지, 블롭 스토리지, 캐시 API를 제공합니다. 설정 방법, 스키마 정의, 마이그레이션 처리, 멀티 클라우드 배포(Cloudflare, Vercel) 방법은 물론, hub:db, hub:kv, hub:blob와 같은 새로운 가상 모듈의 사용법도 포함되어 있습니다.
...모든 것을 확장하십시오nuxthub에 대하여
NuxtHub는 NuxtHub v0.10.6을 기반으로 풀스택 Nuxt 애플리케이션을 구축할 수 있도록 도와주는 Claude Code용 참고 스킬입니다. 이 스킬은 데이터베이스, KV 스토리지, 블롭 스토리지, 캐시 API 등을 다룹니다. 구식의 일반적인 지식에 의존하는 대신, 설정, 스키마 정의, 마이그레이션, 멀티 클라우드 배포, 그리고 최신 hub:db, hub:kv, hub:blob 가상 모듈 임포트 방식에 대한 최신 정보를 Claude에 제공함으로써 올바르고 버전에 맞는 NuxtHub 코드를 작성하는 문제를 해결해 줍니다.
이 스킬은 Drizzle ORM을 통해 SQLite, PostgreSQL, MySQL 방언을 활용한 타입 안전한 SQL 문법을 다루며, 스키마 예시, CRUD 패턴은 물론 개발 및 빌드 과정에서 자동으로 적용되는 마이그레이션 CLI(생성, 마이그레이션, 원시 SQL 실행, 테이블 삭제, 전체 삭제, 데이터 압축, 마이그레이션 완료 표시)도 제공합니다. 또한 TTL과 크기 제한이 적용되는 KV 스토리지, 업로드/다운로드/목록 조회/제공 기능과 검증 기능을 갖춘 블롭 스토리지, 그리고 캐시 API에 대한 내용도 포함되어 있습니다. 각 방언과 공급자는 로컬 및 프로덕션 환경의 백엔드와 필요한 환경 변수(D1, Turso, Neon, postgres-js, mysql2, Upstash, Redis, Cloudflare KV, Vercel, Deno)와 연결되며, 개발 환경에서 프로덕션용 설정을 사용할 수 있는 원격 모드나 v0.10.6의 읽기 복제본 지원과 같은 설정 옵션도 제공됩니다. Cloudflare용 wrangler.jsonc 템플릿과 Vercel, Netlify, Deno, AWS용 공급자 설정 관련 참고 파일도 함께 제공되며, 현재 작업에 필요한 참고 자료만을 로드하도록 안내합니다.
이 스킬은 Cloudflare, Vercel 및 기타 플랫폼에 애플리케이션을 배포하는 Nuxt 및 풀스택 개발자들이 정확한 NuxtHub 데이터 계층 및 배포 관련 가이드를 얻고자 하는 사람들을 대상으로 합니다. 이는 문서와 코드 패턴을 참고할 수 있는 자료로, 공급자별 표준 환경 변수 명명법에 대한 안내만 제공됩니다.
자주 묻는 질문
어떤 NuxtHub 버전과 데이터베이스를 지원하나요?
NuxtHub v0.10.6을 대상으로 하며, SQLite, PostgreSQL, MySQL 방언을 사용하는 Drizzle ORM에 대한 내용을 다룹니다. 여기에는 스키마 예시, CRUD 패턴, 로컬 및 프로덕션 환경용 백엔드 매핑 정보도 포함됩니다.
어떤 배포 대상을 지원하나요?
Cloudflare, Vercel, Deno, Netlify로의 멀티 클라우드 배포를 지원하며, Cloudflare용 wrangler.jsonc 템플릿과 Vercel, Netlify, Deno, AWS용 공급자 설정 관련 참고 파일도 제공됩니다.
마이그레이션은 어떻게 작동하나요?
스키마를 기반으로 마이그레이션을 생성하거나, 마이그레이션을 실행하거나, 원시 SQL을 실행하거나, 테이블을 삭제하거나, 모든 테이블을 삭제하거나, 데이터를 압축하거나, 마이그레이션 완료 상태로 표시하는 등의 기능을 제공하는 완전한 CLI가 문서화되어 있습니다. 마이그레이션은 nuxi 개발 및 빌드 과정에서 자동으로 적용되며, _hub_migrations 테이블에 기록됩니다.
원격 모드란 무엇인가요?
원격 모드(v0.10+)는 로컬 에뮬레이션 대신 로컬 개발 중에도 프로덕션 환경의 Cloudflare D1, KV, R2 연결을 사용하도록 해주며, 프로덕션 데이터를 기반으로 테스트를 진행할 때 유용합니다.
참고 파일은 어떻게 로드해야 하나요?
현재 작업에 필요한 참고 자료만을 로드하는 것이 권장됩니다. Cloudflare를 설정할 때는 wrangler-templates 참고 자료를, Vercel, Netlify, Deno, AWS에 배포하거나 외부 데이터베이스/스토리지 공급자를 설정할 때는 providers 참고 자료를 로드하면 됩니다.
Full-stack Nuxt framework with database, KV, blob, and cache. Multi-cloud support (Cloudflare, Vercel, Deno, Netlify).
For Nuxt server patterns: use nuxt skill (server.md)For content with database: use nuxt-content skill
Loading Files
Consider loading these reference files based on your task:
- references/wrangler-templates.md - if manually configuring wrangler.jsonc for Cloudflare deployment
- references/providers.md - if deploying to Vercel, Netlify, Deno, AWS, or configuring external database/storage providers
DO NOT load all files at once. Load only what's relevant to your current task.
Installation
npx nuxi module add hub
Configuration
// nuxt.config.tsexport default defineNuxtConfig({ modules: ['@nuxthub/core'], hub: { db: 'sqlite', // 'sqlite' | 'postgresql' | 'mysql' kv: true, blob: true, cache: true, dir: '.data', // local storage directory remote: false // use production bindings in dev (v0.10+) }})
Advanced Config
hub: { db: { dialect: 'postgresql', driver: 'postgres-js', // Optional: auto-detected casing: 'snake_case', // camelCase JS -> snake_case DB (v0.10.3+) migrationsDirs: ['server/db/custom-migrations/'], applyMigrationsDuringBuild: true, // default replica: { // Read replica support (v0.10.6+) connection: { connectionString: process.env.DATABASE_REPLICA_URL } } }, remote: true // Use production Cloudflare bindings in dev (v0.10+)}
remote mode: When enabled, connects to production D1/KV/R2 during local development instead of local emulation. Useful for testing with production data.
Database replica (v0.10.6+): Configure read replicas to distribute database load. Queries use replicas automatically while writes go to primary.
Database
Type-safe SQL via Drizzle ORM. db and schema are auto-imported on server-side.
Schema Definition
Place in server/db/schema.ts or server/db/schema/*.ts:
// server/db/schema.ts (SQLite)import { integer, sqliteTable, text } from 'drizzle-orm/sqlite-core'export const users = sqliteTable('users', { id: integer().primaryKey({ autoIncrement: true }), name: text().notNull(), email: text().notNull().unique(), createdAt: integer({ mode: 'timestamp' }).notNull()})
PostgreSQL variant:
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core'export const users = pgTable('users', { id: serial().primaryKey(), name: text().notNull(), email: text().notNull().unique(), createdAt: timestamp().notNull().defaultNow()})
Database API
// db and schema are auto-imported on server-sideimport { db, schema } from 'hub:db'// Selectconst users = await db.select().from(schema.users)const user = await db.query.users.findFirst({ where: eq(schema.users.id, 1) })// Insertconst [newUser] = await db.insert(schema.users).values({ name: 'John', email: '[email protected]' }).returning()// Updateawait db.update(schema.users).set({ name: 'Jane' }).where(eq(schema.users.id, 1))// Deleteawait db.delete(schema.users).where(eq(schema.users.id, 1))
Migrations
npx nuxt db generate # Generate migrations from schemanpx nuxt db migrate # Apply pending migrationsnpx nuxt db sql "SELECT * FROM users" # Execute raw SQLnpx nuxt db drop <TABLE> # Drop a specific tablenpx nuxt db drop-all # Drop all tables (v0.10+)npx nuxt db squash # Squash migrations into one (v0.10+)npx nuxt db mark-as-migrated [NAME] # Mark as migrated without running
Migrations auto-apply during npx nuxi dev and npx nuxi build. Tracked in _hub_migrations table.
Database Providers
| Dialect | Local | Production |
|---|---|---|
| sqlite | .data/db/sqlite.db | D1 (Cloudflare), Turso (TURSO_DATABASE_URL, TURSO_AUTH_TOKEN) |
| postgresql | PGlite | postgres-js (DATABASE_URL), neon-http (v0.10.2+, DATABASE_URL) |
| mysql | - | mysql2 (DATABASE_URL, MYSQL_URL) |
KV Storage
Key-value storage. kv is auto-imported on server-side.
import { kv } from 'hub:kv'await kv.set('key', { data: 'value' })await kv.set('key', value, { ttl: 60 }) // TTL in secondsconst value = await kv.get('key')const exists = await kv.has('key')await kv.del('key')const keys = await kv.keys('prefix:')await kv.clear('prefix:')
Constraints: max value 25 MiB, max key 512 bytes.
KV Providers
| Provider | Package | Env Vars |
|---|---|---|
| Upstash | @upstash/redis | UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN |
| Redis | ioredis | REDIS_URL |
| Cloudflare KV | - | KV binding in wrangler.jsonc |
| Deno KV | - | Auto on Deno Deploy |
| Vercel | - | KV_REST_API_URL, KV_REST_API_TOKEN |
Blob Storage
File storage. blob is auto-imported on server-side.
Blob API
import { blob } from 'hub:blob'// Uploadconst result = await blob.put('path/file.txt', body, { contentType: 'text/plain', access: 'public', // 'public' | 'private' (v0.10.2+) addRandomSuffix: true, prefix: 'uploads'})// Returns: { pathname, contentType, size, httpEtag, uploadedAt }// Downloadconst file = await blob.get('path/file.txt') // Returns Blob or null// Listconst { blobs, cursor, hasMore, folders } = await blob.list({ prefix: 'uploads/', limit: 10, folded: true })// Serve (with proper headers)return blob.serve(event, 'path/file.txt')// Deleteawait blob.del('path/file.txt')await blob.del(['file1.txt', 'file2.txt']) // Multiple// Metadata onlyconst meta = await blob.head('path/file.txt')
Upload Helpers
// Server: Validate + upload handlerexport default eventHandler(async (event) => { return blob.handleUpload(event, { formKey: 'files', multiple: true, ensure: { maxSize: '10MB', types: ['image/png', 'image/jpeg'] }, put: { addRandomSuffix: true, prefix: 'images' } })})// Validate before manual uploadensureBlob(file, { maxSize: '10MB', types: ['image'] })// Multipart upload for large files (>10MB)export default eventHandler(async (event) => { return blob.handleMultipartUpload(event) // Route: /api/files/multipart/[action]/[...pathname]})
Vue Composables
// Simple uploadconst upload = useUpload('/api/upload')const result = await upload(inputElement)// Multipart with progressconst mpu = useMultipartUpload('/api/files/multipart')const { completed, progress, abort } = mpu(file)
Blob Providers
| Provider | Package | Config |
|---|---|---|
| Cloudflare R2 | - | BLOB binding in wrangler.jsonc |
| Vercel Blob | @vercel/blob | BLOB_READ_WRITE_TOKEN |
| S3 | aws4fetch | S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_BUCKET, S3_REGION |
Cache
Response and function caching.
Route Handler Caching
export default cachedEventHandler((event) => { return { data: 'cached', date: new Date().toISOString() }}, { maxAge: 60 * 60, // 1 hour getKey: event => event.path})
Function Caching
export const getStars = defineCachedFunction( async (event: H3Event, repo: string) => { const data = await $fetch(`https://api.github.com/repos/${repo}`) return data.stargazers_count }, { maxAge: 3600, name: 'ghStars', getKey: (event, repo) => repo })
Cache Invalidation
// Remove specificawait useStorage('cache').removeItem('nitro:functions:getStars:repo-name.json')// Clear by prefixawait useStorage('cache').clear('nitro:handlers')
Cache key pattern: ${group}:${name}:${getKey(...args)}.json (defaults: group='nitro', name='handlers'|'functions'|'routes')
Deployment
Cloudflare
NuxtHub auto-generates wrangler.json from your hub config - no manual wrangler.jsonc required:
// nuxt.config.tsexport default defineNuxtConfig({ hub: { db: { dialect: 'sqlite', driver: 'd1', connection: { databaseId: '<database-id>' } }, kv: { driver: 'cloudflare-kv-binding', namespaceId: '<kv-namespace-id>' }, cache: { driver: 'cloudflare-kv-binding', namespaceId: '<cache-namespace-id>' }, blob: { driver: 'cloudflare-r2', bucketName: '<bucket-name>' } }})
Observability (recommended): Enable logging for production deployments:
// wrangler.jsonc (optional){ "observability": { "logs": { "enabled": true, "head_sampling_rate": 1, "invocation_logs": true, "persist": true } }}
Create resources via Cloudflare dashboard or CLI:
npx wrangler d1 create my-db # Get database-idnpx wrangler kv namespace create KV # Get kv-namespace-idnpx wrangler kv namespace create CACHE # Get cache-namespace-idnpx wrangler r2 bucket create my-bucket # Get bucket-name
Deploy: Create Cloudflare Workers project, link Git repo. Bindings auto-configured at build time.
Environments: Use CLOUDFLARE_ENV=preview for preview deployments.
See references/wrangler-templates.md for manual wrangler.jsonc patterns and references/providers.md for all provider configurations.
Other Providers
See references/providers.md for detailed deployment patterns for:
- Vercel: Postgres, Turso, Vercel Blob, Vercel KV
- Netlify: External databases, S3, Upstash Redis
- Deno Deploy: Deno KV
- AWS/Self-hosted: S3, RDS, custom configs
D1 over HTTP
Query D1 from non-Cloudflare hosts:
hub: { db: { dialect: 'sqlite', driver: 'd1-http' }}
Requires: NUXT_HUB_CLOUDFLARE_ACCOUNT_ID, NUXT_HUB_CLOUDFLARE_API_TOKEN, NUXT_HUB_CLOUDFLARE_DATABASE_ID
Build-time Hooks
// Extend schemanuxt.hook('hub:db:schema:extend', async ({ dialect, paths }) => { paths.push(await resolvePath(`./schema/custom.${dialect}`))})// Add migration directoriesnuxt.hook('hub:db:migrations:dirs', (dirs) => { dirs.push(resolve('./db-migrations'))})// Post-migration queries (idempotent)nuxt.hook('hub:db:queries:paths', (paths, dialect) => { paths.push(resolve(`./seed.${dialect}.sql`))})
Type Sharing
// shared/types/db.tsimport type { users } from '~/server/db/schema'export type User = typeof users.$inferSelectexport type NewUser = typeof users.$inferInsert
WebSocket / Realtime
Enable experimental WebSocket:
// nuxt.config.tsnitro: { experimental: { websocket: true } }
// server/routes/ws/chat.tsexport default defineWebSocketHandler({ open(peer) { peer.subscribe('chat') peer.publish('chat', 'User joined') }, message(peer, message) { peer.publish('chat', message.text()) }, close(peer) { peer.unsubscribe('chat') }})
Deprecated (v0.10)
Removed Cloudflare-specific features:
hubAI()-> Use AI SDK with Workers AI ProviderhubBrowser()-> PuppeteerhubVectorize()-> Vectorize- NuxtHub Admin -> Sunset Dec 31, 2025
npx nuxthub deploy-> Use wrangler deploy
Quick Reference
| Feature | Import | Access |
|---|---|---|
| Database | import { db, schema } from 'hub:db' | db.select(), db.insert(), etc. |
| KV | import { kv } from 'hub:kv' | kv.get(), kv.set(), etc. |
| Blob | import { blob } from 'hub:blob' | blob.put(), blob.get(), etc. |
All are auto-imported on server-side.
Resources
- Installation
- Migration from v0.9
- Database
- Blob
- KV
- Cache
- Deploy
모든 파일
0개 파일nuxthub 설치
해당 스킬 파일들을 다운로드하여 .claude/skills/ 디렉토리에 압축을 풀어 저장해 주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/onmax/nuxt-skills/blob/main/skills/nuxthub/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
복사





집
