steven-tey / precedent

An opinionated collection of components, hooks, and utilities for your Next.js project.
https://precedent.dev
MIT License
4.65k stars 406 forks source link

Switch to Drizzle #37

Open NuroDev opened 1 year ago

NuroDev commented 1 year ago

image

Okay for real though, while Prisma is awesome, I think the next best move for this project would be considering switching to Drizzle as it offers a lot of the benefits of Prisma but fixes a number of the core issues that many people have with it.

The main 2 being codegen & edge support. Since Drizzle allows you to create your schema purely in TypeScript there is no need to generate types from a .prisma file. Then of course the switch to a "native driver" or HTTP driver, like @planetscale/database, to allow for use in a V8 isolate / edge runtime.

How

Probably one of the biggest blockers going in would be porting the current Prisma schema to Drizzle, which should not be too hard.

I have successfully done this myself already for my own custom data as well as using these PR's in the NextAuth.js repo showing how to implement the tables needed to handle NextAuth.js / Auth.js.

If need be I am happy to help migrate the Prisma schema to a Drizzle schema 🙂

gamedevsam commented 1 year ago

I've been looking at Drizzle and it does indeed seem like a strong alternative to Prima, but it feels too early at this stage to be recommending it on bootstrapper projects that are designed to be deployed to production by many users. Wait a year or two for it to mature, docs to improve, and then consider adopting it in these types of projects.

gamedevsam commented 1 year ago

As an example, it seems JSON functionality is a bit hit or miss right now: https://github.com/drizzle-team/drizzle-orm/issues/748

vignesh-gupta commented 9 months ago

Yeah, I agree @gamedevsam, but I do love drizzle and would love to see it grow soon!