All skills
onmax avatar

/nuxthub

@9b5f595 official
by Maxonmax/nuxt-skills715 stars
38

Use when building NuxtHub v0.10.6 applications - provides database (Drizzle ORM with sqlite/postgresql/mysql), KV storage, blob storage, and cache APIs. Covers configuration, schema definition, migrations, multi-cloud deployment (Cloudflare, Vercel), and the new hub:db, hub:kv, hub:blob virtual module imports.

Use this Skill: https://skilld.dev/gh/onmax/nuxt-skills/nuxthub

This session only. Nothing lands on disk.

referenceswrangler-templates.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Wrangler Configuration for NuxtHub v0.10.6

Default (Recommended): NuxtHub auto-generates wrangler.json from your hub config in nuxt.config.ts. No manual wrangler.jsonc required.

Note: Node.js compatibility (nodejs_compat) is automatically enabled for Cloudflare Workers in v0.10.5+.

Manual wrangler.jsonc: Use when you need features not auto-generated (observability, migrations config, etc.) or prefer explicit file-based configuration.

Minimal (Database Only)

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "my-app",
  "compatibility_flags": ["nodejs_compat"],
  "d1_databases": [{ "binding": "DB", "database_name": "my-app-db", "database_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }]
}

Full Stack (DB + KV + Blob + Cache)

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "my-app",
  "compatibility_flags": ["nodejs_compat"],
  "d1_databases": [{ "binding": "DB", "database_name": "my-app-db", "database_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }],
  "kv_namespaces": [
    { "binding": "KV", "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" },
    { "binding": "CACHE", "id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }
  ],
  "r2_buckets": [{ "binding": "BLOB", "bucket_name": "my-app-bucket" }]
}

Observability (Recommended for Production)

Enable logging to track performance and debug issues:

{
  "observability": {
    "logs": {
      "enabled": true,          // Enable log collection
      "head_sampling_rate": 1,  // Sample rate 0-1 (1 = 100% of requests)
      "invocation_logs": true,  // Log function invocations
      "persist": true           // Persist logs to storage
    }
  }
}

Required permission: workers_observability (edit) in your Cloudflare API token.

See Cloudflare Observability docs.

D1 Migrations Configuration

Specify migrations table and directory:

{
  "d1_databases": [{
    "binding": "DB",
    "database_id": "<id>",
    "migrations_table": "_hub_migrations",
    "migrations_dir": ".output/server/db/migrations/"
  }]
}

Required Binding Names

Feature Binding Name Type
Database DB D1
Key-Value KV KV Namespace
Cache CACHE KV Namespace
Blob Storage BLOB R2 Bucket

Creating Resources via CLI

# D1 Database
npx wrangler d1 create my-app-db
# Output: database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

# KV Namespace for storage
npx wrangler kv namespace create KV
# Output: id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# KV Namespace for cache
npx wrangler kv namespace create CACHE
# Output: id = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

# R2 Bucket
npx wrangler r2 bucket create my-app-bucket
# Bucket name is used directly, no ID needed

Multi-Environment Setup

{
  "$schema": "node_modules/wrangler/config-schema.json",
  "name": "my-app",
  "compatibility_flags": ["nodejs_compat"],
  "d1_databases": [{ "binding": "DB", "database_name": "my-app-db-prod", "database_id": "prod-db-id" }],
  "env": {
    "staging": {
      "d1_databases": [{ "binding": "DB", "database_name": "my-app-db-staging", "database_id": "staging-db-id" }]
    }
  }
}

Deploy with: CLOUDFLARE_ENV=staging nuxt build && npx wrangler deploy

Auto-Generation from nuxt.config (Recommended)

NuxtHub auto-generates wrangler.json at build time from your hub config:

// nuxt.config.ts
export 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>'
    }
  }
})

Advanced: Use nitro.cloudflare.wrangler for explicit control:

export default defineNuxtConfig({
  nitro: {
    cloudflare: {
      wrangler: {
        compatibility_flags: ['nodejs_compat'],
        d1_databases: [{ binding: 'DB', database_id: '<id>' }],
        kv_namespaces: [
          { binding: 'KV', id: '<kv-id>' },
          { binding: 'CACHE', id: '<cache-id>' }
        ],
        r2_buckets: [{ binding: 'BLOB', bucket_name: '<bucket>' }]
      }
    }
  }
})

Source: SKILL.md on GitHub

1 warning12d5 checks · Risk SAFE
  • Gen Agent Trust Hub12d

    The skill provides comprehensive documentation and configuration templates for NuxtHub v0.10.6, covering database integration, storage, and deployment across major cloud providers. No security risks or malicious patterns were detected; the skill follows security best practices by emphasizing the use of environment variables and platform-specific secret managers for handling credentials.

  • Socket12d

    No alerts

  • Snyk12d

    Risk: LOW · No issues

  • Runlayer7mo

    2/3 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 9b5f595. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 8 months ago
  • Nuxt
  • Database
  • drizzle
  • orm
  • sqlite
  • postgresql
  • mysql
  • kv-storage
  • blob-storage
  • cloudflare

README badge

README badge for onmax/nuxt-skills/nuxthub

Configures and deploys Nuxt applications with Drizzle ORM databases (SQLite, PostgreSQL, MySQL), KV storage, blob upload, and response caching. Supports multi-cloud deployment to Cloudflare Workers, Vercel, Netlify, and Deno with auto-generated bindings and migration management.

Generated from the current SKILL.md.

Does this skill cover both local development and production deployment?
Yes. It supports local SQLite/PGlite development with auto-migration on dev/build, and production deployment to Cloudflare (D1), Vercel, Netlify, Deno Deploy, and external providers like Postgres, MySQL, Turso, and S3.
What database dialects are supported?
SQLite, PostgreSQL, and MySQL. Each has different local emulation and production provider options (e.g. SQLite uses local .data/db/sqlite.db or D1/Turso in production).
Is Drizzle ORM required?
Yes. The skill uses Drizzle ORM for type-safe SQL queries across all database dialects. Schemas are defined in server/db/schema.ts using Drizzle column and table types.
Can I use this skill for content management?
For content with database backing, use the nuxt-content skill instead. This skill covers database, KV, blob, and cache APIs directly, not content-specific workflows.
Does this handle file uploads and storage?
Yes. The blob API supports file upload, download, listing, and deletion. It includes multipart upload for large files (>10MB) and integrates with Cloudflare R2, Vercel Blob, and S3.

Generated from the current SKILL.md. These answers refresh after source changes.