Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Dec 14, 2025

Closes #708

When binding IDs are provided in hub config, auto-generate wrangler bindings via nitro.cloudflare.wrangler.

Feature Config Wrangler
D1 driver: 'd1' + connection.databaseId d1_databases
Hyperdrive connection.hyperdriveId hyperdrive
R2 driver: 'cloudflare-r2' + bucketName r2_buckets
KV driver: 'cloudflare-kv-binding' + namespaceId kv_namespaces
Cache driver: 'cloudflare-kv-binding' + namespaceId kv_namespaces

Great DX improvement for Cloudflare - no need to manually sync nuxt.config with wrangler.toml.

hub: {
  blob: { driver: 'cloudflare-r2', bucketName: 'my-bucket', binding: 'BLOB' },
  kv: { driver: 'cloudflare-kv-binding', namespaceId: 'kv-abc123', binding: 'KV' },
  cache: { driver: 'cloudflare-kv-binding', namespaceId: 'cache-xyz789', binding: 'CACHE' },
  db: { dialect: 'sqlite', driver: 'd1', connection: { databaseId: 'db-456def' } }
}

Missing

Documentation for this is at the moment missing. If we decide to move forward, I can update the docs marking this new methodology the "recommended" way to work with cloudflare. however, if you think this is not good enough, or you have other ideas planned, we can close this pr :)

@vercel
Copy link

vercel bot commented Dec 14, 2025

@onmax is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 14, 2025

npm i https://pkg.pr.new/@nuxthub/core@716

commit: 6985e50

@onmax onmax force-pushed the feat/auto-wrangler-bindings branch 4 times, most recently from 41a8792 to a47117a Compare December 14, 2025 16:04
@atinux atinux requested a review from RihanArfan December 15, 2025 11:41
@onmax onmax force-pushed the feat/auto-wrangler-bindings branch from a9e8e32 to 50fbbcf Compare December 17, 2025 11:07
Copy link
Member

@RihanArfan RihanArfan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should prefix these ones to explicitly make them clear they're for Cloudflare now that NuxtHub is vendor agnostic. I think database is fine as it's within the connection block.

@atinux
Copy link
Contributor

atinux commented Dec 17, 2025

Not sure about your comment @RihanArfan as this is actually similar to how nitro storage works by merging all options.

I am fine having:

blob: {
  driver: 'cloudflare-r2',
  bucketName: 'BLOB'
}

@atinux atinux merged commit ff2fabe into nuxt-hub:main Dec 17, 2025
7 of 9 checks passed
@onmax onmax deleted the feat/auto-wrangler-bindings branch December 17, 2025 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate the wrangler.json file automatically from the Hub Cloudflare configuration.

3 participants