nuxt-hub / core

Build full-stack applications with Nuxt on CloudFlare, with zero configuration.
https://hub.nuxt.com
Apache License 2.0
994 stars 56 forks source link

Cloudflare D1 10gb size limit #232

Open birdlavv opened 3 months ago

birdlavv commented 3 months ago

The strict database size cap of 10gb for Cloudflare D1 is quite limiting for large projects.

Drizzle currently supports many database drivers, some of which are edge-friendly. Perhaps something like a Planetscale integration would be useful for larger projects to get around these limits.

Being able to use the NuxtHub's tasty tooling with other relational data sources would be a big DX win.

Additional context Cloudflare D1 limits documentation Rumors that the size cap will probably remain

atinux commented 3 months ago

Hey @birdlavv

What other database are you thinking about to use instead of D1? I will also ask the Cloudflare team about those limits.

birdlavv commented 3 months ago

Thanks for looking into it, @atinux! Currently, we are using Planetscale until D1 can scale to a larger size.

atinux commented 3 months ago

Then I guess the solution might be #208

birdlavv commented 3 months ago

Being able to use any relational DB (via #208) in the Drizzle UI in the NuxtHub dashboard would be 🔥

According to the Hyperdrive docs, MySQL support (Planetscale/Vitess) is not yet available. There does seem to be some movement on the Planetscale end.

D1 with a bigger size cap would be ideal due to the incredible Cloudflare pricing.

miguelrk commented 3 months ago

I didn't know of the 10GB Cloudflare limitation! This is a serious limitation for real world production apps...

Turso is a think a closer alternative to D1. I've used it before and its very good, ultra nice DX.

If Cloudflare is reluctant to increase that 10GB limit, I'm afraid making NuxtHub database agnostic is very important, maybe unjs/d0 can help in this regard?

atinux commented 3 months ago

It is also related to #15 as one solution would be to directly offer the UI on top of useDatabase() directly and know if we need to spawn a D1 database, a hyperdrive connector, or if you use an external provider like Turso (you will have to create the resource manually until we support an automation)

It is also related to #179 to know about the bindings to create.

PS: the NuxtHub database today (which is using D1) with already thousands of projects & users is <10 MB

miguelrk commented 3 months ago

TLRD: In general, I love the idea of NuxtHub wiring-up modules on Cloudflare by default (e.g. D1 for database, Workers KV for KV-storage, R2 for blob, ...) but being open to wire-up other providers for these modules by leveraging Nitro/UnJS (https://github.com/nuxt-hub/core/issues/179).

I'm pretty exited for first party Nitro Database, and in general, IMO one of the greatest strengths of NuxtHub is leveraging nitro and maintaining its provider-agnostic spirit (powered also by the great UnJS ecosystem).

I definitively agree, it would be great if the admin UI of NuxtHub uses useDatabase() in order to connect to the databases defined in the project's nitro.config/nuxt.config. Then the user should be able to select which database he wants to view/edit, much like the "DevTools > Storage" UI allows selecting which drive from multiple.

Allowing this, despite having to manually create these resources externally on the corresponding providers without an automation would probably already be good enough for more users (I speak at least for myself), and could probably be come faster. The automations could be introduced later if the team decides it, I understand this might be out of scope for NuxtHub itself, which is built (at least for now) primarily on Cloudflare.

I'm guessing this work is sort of waiting for nitro@v2 to include database out-of-the-box (not experimental)? (https://github.com/nuxt-hub/core/pull/15#issuecomment-2046888959)