t3-oss / create-t3-app

The best way to start a full-stack, typesafe Next.js app
https://create.t3.gg
MIT License
24.16k stars 1.11k forks source link

feat: Make T3 edge ready #1452

Open FleetAdmiralJakob opened 1 year ago

FleetAdmiralJakob commented 1 year ago

Is your feature request related to a problem? Please describe.

I think it would be a great addition to the T3 stack if he gets edge ready.

Describe the solution you'd like to see

Dont rly know. Maybe switch the ORM.

EDIT: The pages router also needs to get switched to the Fetch API of tRPC

Describe alternate solutions

Additional information

No response

FleetAdmiralJakob commented 1 year ago

Maybe Drizzle (after the last video)

JesseKoldewijn commented 1 year ago

I think it would be a good thing to give an ORM select option where you could use either prisma or drizzle instead of fully switching.

Stoffberg commented 1 year ago

The T3-Stack team has expressed a preference for avoiding the use of "bleeding edge" technologies. Consequently, while Drizzle represents an interesting potential upgrade, they advise waiting until it matures and reaches its first release (v1) before considering a switch. During this interim period, a viable solution might be to create a community-maintained package or branch dedicated to implementing all the latest features. This approach could allow us to take advantage of newer technologies on smaller projects, while maintaining stability and reliability in the primary branch.

JesseKoldewijn commented 1 year ago

The T3-Stack team has expressed a preference for avoiding the use of "bleeding edge" technologies. Consequently, while Drizzle represents an interesting potential upgrade, they advise waiting until it matures and reaches its first release (v1) before considering a switch. During this interim period, a viable solution might be to create a community-maintained package or branch dedicated to implementing all the latest features. This approach could allow us to take advantage of newer technologies on smaller projects, while maintaining stability and reliability in the primary branch.

Understandable, I was mainly in the boat of including the choice between prisma and ie drizzle when it's ready 👍

juliusmarminge commented 1 year ago

We're a bit blocked by https://github.com/nextauthjs/next-auth/pull/7443 but other than that #1461 & #1446 should address this

JesseKoldewijn commented 1 year ago

Awesome! Glad to hear. Haven't gotten around to use drizzle a whole lot myself yet but from what I've experienced in some smaller projects I got bothe the setup and perf is so much better than prisma.

I btw take it you've (@juliusmarminge) used drizzle already for quite some projects right? Do you know any equivilant of the MySql cuid (as entry id for a model entry) on drizzle? The way I converted a prisma project to drizzle myself is by just having a varchar id row but I could imagine this possibly creating some issues at some point.

juliusmarminge commented 1 year ago

I've mostly been using Kysely lately but there I do something like this:

CleanShot 2023-06-04 at 22 32 48@2x

genId is an alias to nanoid in this project but you can do cuid, uuid, ulid or whatever you want really

JesseKoldewijn commented 1 year ago

I've mostly been using Kysely lately but there I do something like this:

CleanShot 2023-06-04 at 22 32 48@2x

genId is an alias to nanoid in this project but you can do cuid, uuid, ulid or whatever you want really

Haven't used kysely yet. It's similar to drizzle right? (In the sense of it being a edge-ready prisma alternative)

And if so. In case it uses some form of a schema, what does this look like in this case when using a uuid as the primary key?

juliusmarminge commented 1 year ago

Just use a varchar with the size you need. For uuid this should be 36B.

If your db support uuid natively use that

JesseKoldewijn commented 1 year ago

Just use a varchar with the size you need. For uuid this should be 36B.

If your db support uuid natively use that

Gotcha, mainly been using the cuid binding in prisma in previous project but couldn't find a similar binding for the drizzle schema.

juliusmarminge commented 1 year ago

Gotcha, mainly been using the cuid binding in prisma in previous project but couldn't find a similar binding for the drizzle schema.

Then you've used a VARCHAR(191) which is quite a bit larger than you need:

CleanShot 2023-06-04 at 23 10 06@2x
JesseKoldewijn commented 1 year ago

Gotcha, mainly been using the cuid binding in prisma in previous project but couldn't find a similar binding for the drizzle schema.

Then you've used a VARCHAR(191) which is quite a bit larger than you need:

CleanShot 2023-06-04 at 23 10 06@2x

Gotcha🤙

dantrain commented 8 months ago

We're a bit blocked by nextauthjs/next-auth#7443 but other than that #1461 & #1446 should address this

Is this really completed when nextauthjs/next-auth#7443 is still open?

Incidentally, I recently tried:

with create-next-app and it worked on the Vercel edge runtime no problem.

sscotth commented 8 months ago

https://github.com/nextauthjs/next-auth/pull/7443 just merged. Should be available now as v5.0.0-beta.0.

However, I agree. I think this issue should still be open until it is stable and t3 includes a dependency bump.

FleetAdmiralJakob commented 5 months ago

Since the T3 pages router is not using the fetch API and is for this reason not edge runtime ready I think this issue should stay open until this is also solved.

If you want I can also work on this.

ThomasBouasli commented 2 months ago

Edge is no longer recommended by vercel

FleetAdmiralJakob commented 2 months ago

Edge is no longer recommended by vercel

But PPR isn't out yet

juliusmarminge commented 2 months ago

We'll still get it edge ready if you wanna deploy to workers or whatever other reason you have.

Just straight up listening and following everything Vercel says isnt the goal of this project so we definetely still want to make it edge ready.

But it do that we need next-auth v5 stable