Skip to content

Introduce mustache for db setup#900

Draft
Sqh3rd wants to merge 3 commits into
nuxt-hub:mainfrom
Sqh3rd:introduce-mustache
Draft

Introduce mustache for db setup#900
Sqh3rd wants to merge 3 commits into
nuxt-hub:mainfrom
Sqh3rd:introduce-mustache

Conversation

@Sqh3rd

@Sqh3rd Sqh3rd commented May 22, 2026

Copy link
Copy Markdown

Refactor db setup to use mustache templates instead of string interpolation

@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

@Sqh3rd

Sqh3rd commented May 22, 2026

Copy link
Copy Markdown
Author

I'm having a bit of trouble trying to negotiate the current differing setups with the documentation. Reading the documentation provided at https://hub.nuxt.com/docs/database it seems that there's mainly following use-cases: d1 over http, neon-serverless, and not-configuring db credentials to allow for runtime env resolving.

However in the code, there's also some behaviours, that are not explained in the docu, which I don't fully understand:

  • hyperdriveId: there's mention of a hyperdriveId, which is never explained, but handled similarly (but differently!) from other env resolving.
  • db lazy loading: sometimes the db is lazily loaded, depending on: the driver, whether nuxt is in dev mode, or whether or not hub.hosting includes 'cloudflare'.
  • inconsistent use of connection clients and connection strings: for some drivers depending on whether nuxt is in dev mode, either a client is created and passed to drizzle, or a connection string is supplied to the drizzle directly.
  • client exported for pglite when it's run in dev mode
  • mysql2 uses connection.uri while most other drivers use connection.url

As this is quite confusing and not straightforward I'd propose to also introduce following changes in this PR, should they make sense to someone more familiar with this logic:

  • Always lazy load db
  • Always create and pass clients if possible
  • use connection.url for mysql2
  • don't export client for pglite when run in dev mode

Would those changes be okay? I could create one commit dedicated solely to these changes, so you could take a look at them.

I'd be great if someone with more knowledge in that area could take the time to lift some of my confusion here 😄

@Sqh3rd

Sqh3rd commented May 22, 2026

Copy link
Copy Markdown
Author

I'd leave the PR in draft until my above comment is resolved, and feedback from the community/verzel team is incorporated into this PR

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.

1 participant