create-t3-app icon indicating copy to clipboard operation
create-t3-app copied to clipboard

feat: Make T3 edge ready

Open FleetAdmiralJakob opened this issue 2 years ago • 18 comments

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 avatar May 26 '23 12:05 FleetAdmiralJakob

Maybe Drizzle (after the last video)

FleetAdmiralJakob avatar May 31 '23 11:05 FleetAdmiralJakob

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.

JesseKoldewijn avatar Jun 01 '23 01:06 JesseKoldewijn

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.

Stoffberg avatar Jun 01 '23 11:06 Stoffberg

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 👍

JesseKoldewijn avatar Jun 01 '23 11:06 JesseKoldewijn

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

juliusmarminge avatar Jun 04 '23 18:06 juliusmarminge

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.

JesseKoldewijn avatar Jun 04 '23 18:06 JesseKoldewijn

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

juliusmarminge avatar Jun 04 '23 20:06 juliusmarminge

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?

JesseKoldewijn avatar Jun 04 '23 20:06 JesseKoldewijn

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

If your db support uuid natively use that

juliusmarminge avatar Jun 04 '23 20:06 juliusmarminge

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.

JesseKoldewijn avatar Jun 04 '23 21:06 JesseKoldewijn

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

juliusmarminge avatar Jun 04 '23 21:06 juliusmarminge

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🤙

JesseKoldewijn avatar Jun 04 '23 21:06 JesseKoldewijn

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:

  • @auth/core
  • next-auth@experimental
  • @auth/drizzle-adapter
  • @planetscale/database

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

dantrain avatar Oct 23 '23 21:10 dantrain

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.

sscotth avatar Oct 24 '23 00:10 sscotth

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.

FleetAdmiralJakob avatar Jan 25 '24 21:01 FleetAdmiralJakob

Edge is no longer recommended by vercel

ThomasBouasli avatar Apr 22 '24 04:04 ThomasBouasli

Edge is no longer recommended by vercel

But PPR isn't out yet

FleetAdmiralJakob avatar Apr 22 '24 17:04 FleetAdmiralJakob

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

juliusmarminge avatar Apr 22 '24 18:04 juliusmarminge