This New Database Tool is a Game-Changer

Поділитися
Вставка
  • Опубліковано 3 січ 2025

КОМЕНТАРІ •

  • @joshtriedcoding
    @joshtriedcoding  Рік тому +8

    The starter kit: github.com/joschan21/drizzle-planetscale-starter I feel like this makes trying drizzle way easier

    • @peter042
      @peter042 Рік тому +1

      Could you add an auth example with nextauth or clerk?

  • @jakedotdev
    @jakedotdev Рік тому +19

    Drizzle is great. I genuinely believe every developer needs to know SQL. This is just how you optimise your application.

    • @jlucsx
      @jlucsx Рік тому

      I would say not only SQL, but all that stuff about indexes, sargable and non- sargable queries, etc.

    • @RegalWK
      @RegalWK Рік тому +1

      Drizzle is not great, it have broken migrations workflow

    • @StarsOfMinecrafttr
      @StarsOfMinecrafttr Рік тому

      if you code ur project with unique indexes every single time you can, your project will be super fast, whether you use prisma or not.

  • @omfj
    @omfj Рік тому +31

    Can't wait for "Josh tried Horsing"!

  • @EddyVinck
    @EddyVinck Рік тому +17

    It was pretty easy to swap out Prisma with Drizzle in my create-t3-app project

    • @jacob7785
      @jacob7785 Рік тому +2

      Do you use next-auth in your create-t3-app project? Because i'm afraid of have issues combining drizzle with next-auth

    • @EddyVinck
      @EddyVinck Рік тому +2

      @@jacob7785 I don’t, I’m using Clerk. Not sure what the implications would be for next-auth

    • @PorkopekPeres
      @PorkopekPeres Рік тому

      Why not using both in the same repo?

  • @SeanCassiere
    @SeanCassiere Рік тому +6

    For Planetscale you should be using the db-push command from drizzle-kit and the PS database schema branch pull request/merge

    • @mikelautensack7351
      @mikelautensack7351 Рік тому

      Can you point me to and docs or fourms on how to do this? Beating my head against the wall just trying to get a simple db connected to by next app! I was trying with AWS RDS first with no luck and now moved to planetcale and still cant get it figured out.

  • @rohitkharche7562
    @rohitkharche7562 Рік тому +10

    The only thing this orm is lacking is its next-auth adaptor. If that gets released quickly it will be a joy to work with this

    • @yiannis_p
      @yiannis_p Рік тому

      It’s out already

    • @rohitkharche7562
      @rohitkharche7562 Рік тому

      @@yiannis_p no it's not I checked the next auth docs

    • @windar2390
      @windar2390 Рік тому

      If there was an authjs adaptor, I would 100% choose Drizzle. But now I'm unsure.

    • @dan_____
      @dan_____ Рік тому +1

      It's not in the docs, but someone already made a PR for it a few weeks ago. It should get merged on the next release probably, unless its already been.

    • @programming7292
      @programming7292 Рік тому +1

      @@dan_____ They had released it but drizzle made some braking changes and then they are again rebuilding it.

  • @rhysyw97
    @rhysyw97 Рік тому +3

    Is there a video somewhere that explains the Prisma "multiple table read" issue? I can't seem to get my head around Prisma's popularity if it actually makes people incur a much larger cost for row reads/requests. I cant see how or why anyone can afford Prisma scale if it is actually performing more reads per join than Drizzle.

    • @krisnrg
      @krisnrg Рік тому

      Same seems absolutely unreal if they really are doing that.

  • @PorkopekPeres
    @PorkopekPeres Рік тому +1

    Why not using both? Prisma for DX and Drizzle only in the queries where Prisma is slow? They don't affect the bundle

  • @xReDxTuRtLeZx
    @xReDxTuRtLeZx Рік тому +2

    i also hopped on to the drizzle hype train. upgrading my project from the layout i had which was similar to Theo's Chirp app was much more confusing than i thought. took me very long to understand that the drizzle call had to be done server side, and in react router, everything in my app was treated as client side. in new app dir i managed to get a much better separation of client and server. if anyone has trouble upgrading their chirp-clone from prisma to drizzle, i highly recommend using next 13.4 app dir and ask questions to communities if needed!

    • @joshtriedcoding
      @joshtriedcoding  Рік тому

      Ah interesting, yeah database queries cannot be done on client components. NextJS really makes this super straightforward

    • @xReDxTuRtLeZx
      @xReDxTuRtLeZx Рік тому

      @@joshtriedcoding as someone who was just getting into the t3 stack and nextjs in general, prisma made it seem too easy, and i began to run my drizzle queries on client using public env variables until i realized that is NOT the way. atleast the switch to drizzle helped me become for familiar with the environment as a whole and how it works

  • @shadmansudipto7287
    @shadmansudipto7287 Рік тому +1

    Javascript developer discovering tools that have existed for more than a decade.

  • @ernestofuentes9333
    @ernestofuentes9333 Рік тому +5

    Josh, i have tried drizzle and it's amazing by the moment. In your video you missed an important information and it's that it doesn't have an official stable release and you could find some weird behaviours for example in my case i have tried the new relations model that they released on version 0.26 y it works fine for one to many relations queries but fails backwards for example if you have a users and posts table you can ask for the user and his posts, but if you ask for a post and his user fails with some weird error.
    Thanks for your video anyways, keep it up.

    • @joshtriedcoding
      @joshtriedcoding  Рік тому +2

      Cheers man. Haven't stumbled upon any weird behavior for that myself but thanks for pointing it out

  • @smart0758
    @smart0758 Рік тому +2

    Unfortunately, drizzle kit:push postgres is not available atm😢. Migration in postgres is not as handy as mysql.

  • @pradeepbisht3397
    @pradeepbisht3397 Рік тому +2

    is there any adpater for drizzle for next-auth?

  • @marufbepary100
    @marufbepary100 Рік тому +1

    I used Drizzle and it isn't a Prisma killer simply because it's not really meant tor replace Prisma. I would say for very simple simple project, Prisma is fine since it has enough functionality and it can deal with SQL and NoSQL databases with the same dialect. Drizzle is only for SQL and each provider (Postgres, MySQL, etc) have their own slightly different dialects which only matters for large projects where you are using these advanced features.

  • @GordonChil
    @GordonChil Рік тому +3

    This is excellent. I'm sure you have this planned, but can you do a video showing how to add to the schema? Like, I have another column that I need to add to an existing table. Or let's say I need to change the type of a column from a varchar(255) to text. How would that work with the migrate method?

    • @redmatrice4709
      @redmatrice4709 Рік тому

      i've never tried drizzle but i'm interested in doing so, but i will respond based on my mysql knowledge , as far as i know text is almost the same as using varchar(65535) which is really big and inefficient, i wouldn't recommend using it unless you don't have other option, the more the varchar value is big the more it consume memory and storage space, and even for a phone number varchar(255) is a bit overkill, hope you get what i mean

  • @1val
    @1val Рік тому +2

    Would love to implement drizzle with next-auth eventually but I'm a bit scared I'll break something lol

  • @tomirodriguez7195
    @tomirodriguez7195 Рік тому +3

    Thanks again for all your information ! You really simplify my drizzle setup where I was using the database name, user, password and other envs hahaha. Was having trouble with that and the SSL certificate but your setup works as charm!
    Is there any advantage of running first the migrations and then pushing? Since I was directly pushing to planetscale without migrations 🤔

    • @joshtriedcoding
      @joshtriedcoding  Рік тому +1

      Happy to hear that man! Not 100% sure what you mean, when "pushing", you are always pushing *something* - in this case the sql migrations

    • @tomirodriguez7195
      @tomirodriguez7195 Рік тому

      ​@@joshtriedcoding I mean, i just have a drizzle:push command that reads the config and pushes directly to planetscale, without runing manually the generate.
      "drizzle:push": "drizzle-kit push:mysql --config drizzle.config.ts"
      where the config its almost the same as yours, without the out:
      const config: Config = {
      schema: "./src/server/db/schema/*",
      connectionString: process.env.DATABASE_URL,
      };
      I was wondering if the generate had anything I'm missing 🤔

  • @philheathslegalteam
    @philheathslegalteam Рік тому +1

    One very important thing to note on Planetscale. You should index on userId foreign column.
    Prisma vscode extension does this automatically when using relationMode prisma.

  • @farastray1
    @farastray1 Рік тому +1

    I wish more ORMs would take a similar approach as the Django ORM. It is really easy to optimize at scale with `select_related` and `prefetch_related`.

    • @rachaitya
      @rachaitya Рік тому

      with node js there is no need to fetch data at one, because network request are non blocking so few round trips database would have no effect, in django whiel the data is being fetched from the db, its just sitting duck and waiting for data to arrive, while node can handle some other task, also "select_related" are "prefetch_related" are basically joins and many ORMs except the fraudulent "prismaORM" have proper joins.

  • @ron-almog
    @ron-almog 8 місяців тому

    btw, planetscale does not offer a free tier any more. that's too bad. neon (postgres) still works.

  • @yunyang6267
    @yunyang6267 Рік тому

    is there a need to use zod with server action? do we still need to type check the inputs?

  • @tarzan7994
    @tarzan7994 Рік тому +1

    Hi Josh, great video I love the content. do you think you could do a video on how to call the dbs directly in a server component and how to properly implement On demand re validation in these cases? Keep up the great work

  • @NitinSinghNaruka
    @NitinSinghNaruka Рік тому

    Is this ready to be used in a production app?

  • @khaledsanny4817
    @khaledsanny4817 Рік тому

    Ok after few weeks seeing your videos in my feed and watching them... i approved your content and energy and decided to subscribe 🙂 keep up coding Josh

  • @geebsayshi
    @geebsayshi Рік тому +3

    Not so long ago, I moved on from Sequelize and embraced Prisma having heard all sort of great things about it but now there’s a new kid on the block and all I hear is not so great things about Prisma

    • @joshtriedcoding
      @joshtriedcoding  Рік тому +1

      None of these is "good" or "bad" per se, they shine in very different use cases. Prisma is awesome for getting started and having a simple and clean DX. Drizzle is awesome for embracing all benefits of sql, postgres, ... with their performance advantages, but not so much suited for beginners because it does add overhead if you're just trying to learn the underlying technology such as Next

    • @geebsayshi
      @geebsayshi Рік тому

      ⁠@@joshtriedcodingyea well said. I’m a performance freak. I get pressured when I know there’s a more performant alternative to what I’m using. Drizzle will have to wait until my next project cos I’m all in with Prisma atm. Thanks for the vid.

  • @geraldodev
    @geraldodev Рік тому

    it does not allows the repetition of a table name in different schemas. This is blocking for multischemas multitenant apps

  • @daigahou
    @daigahou Рік тому

    so every time the schema is modified, do we need to regenerate sql and repush?

  • @Xexr87
    @Xexr87 Рік тому

    Thanks for the video, good stuff. I love Dizzle too.
    Why are you generating migrations here though? The point of push with planet scale is not to use migrations and instead use it’s inbuilt branching.

  • @Jukera
    @Jukera Рік тому

    How about a next-auth adapter? Is there any implementation at this point?

  • @craigcaski
    @craigcaski Рік тому

    Love the videos man but it would be nice if your titles/thumbnails were a bit more descriptive. I thought this was a prisma video and almost skipped it! I was hoping you were gonna do a Drizzle video!

  • @Jacek2048
    @Jacek2048 Рік тому

    Defined a many-to-many relation in Drizzle. Looked at the code. Installed Prisma.

  • @andreik917
    @andreik917 Рік тому

    do we still need some kind of prisma proxy alternative?

  • @FutureNewsDaily
    @FutureNewsDaily Рік тому +1

    Great content Josh! What are your thoughts regarding Postgres vs MySQL vs nosql for a multiuser use case?

  • @wfkpk
    @wfkpk Рік тому

    Hey Josh We need one video where you compare working of drizzle and prisma under the hood like about their query engine I do know about prisma but dont have any idea about drizzle orm.

  • @sarabwt
    @sarabwt Рік тому +1

    What's the difference between this and typeorm?

    • @SeanCassiere
      @SeanCassiere Рік тому

      It's mostly DX and type-safety.
      - No classes (experimental decorators etc.)
      - Helpers for inferring the types for selects and inserts
      - Takes advantage of generics to properly propagate the types from end-to-end

  • @maxterrain
    @maxterrain 11 місяців тому

    Why did you omit the fact that relations in drizzle is a PITA?

  • @rodgetech
    @rodgetech Рік тому

    Hey Josh, super cool. Kinda reminds me of typeorm

  • @mageshyt2550
    @mageshyt2550 Рік тому

    dude what u think about pocketbase

  • @usmanmarkaz
    @usmanmarkaz Рік тому

    Sir is React and Next js turned into PHP??

  • @BarisPalabiyik
    @BarisPalabiyik Рік тому

    0:24 Heey I used ''unmatched DX'' in my last comment to your prisma video :D

  • @giannifed
    @giannifed Рік тому

    Is there a tool for modify table? For example add a column. Push overrides database and ypu lose all data.

  • @Gyurmatag
    @Gyurmatag Рік тому

    So I can use it with Vercel Edge functions out of the box?

  • @McElitsome
    @McElitsome Рік тому +1

    Why can't I just find a PostgreSQL query builder for a Typescript NextJS project. Something worth using in a startup production app?
    All I find are ORMs that are either in beta or not flexible or not even mature. Or document based databases, does JavaScript just hate SQL that much?
    Maybe I don't know, tell me something that suits this criteria, coz man 🤦🏾‍♂️🙆🏾‍♂️ I've been searching for what feels like forever

  • @muhammadalifdanielbinmohdh3188

    Ofc after i done learning prisma

  • @wakibtz7134
    @wakibtz7134 Рік тому

    Hello Josh! I have a problem with Next Auth middleware. I can not find answer in internet. When i make simple next auth code and then try use middleware i get error:
    ./node_modules/next-auth/next/middleware.js
    Module parse failed: Identifier 'NextResponse' has already been declared (3:6)
    | "use strict";
    | const NextResponse = require("next/dist/server/web/spec-extension/response").NextResponse;
    > const NextResponse = require("next/dist/server/web/spec-extension/response").NextResponse;
    I tried rewrite code from begin but i still get it. If u have a time or know how to solve this problem, can u help me pls?

  • @asimalqasmi7316
    @asimalqasmi7316 Рік тому

    It's an interesting topic, I'll try it.

  • @programming7292
    @programming7292 Рік тому

    To all of you who want to start using drizzle orm as theo or josh said it. It is not mature doesn't have a adapter for the planet scale database with next auth as prisma does nor has as refined docs, unsigned integer or as big of a community .
    Right after this video was released planet scale introduced the scaler pro plan where you have unlimited read and write which mitigates the cost issue. starting from $39 it can go up to $999 8 vCPU and 32 GB RAM in AWS which much be sufficient for almost all use cases and vast majority of people. If you need more than this you are already a multi million dollar company and that's that.
    Untill Drizzle goes to version 1 I am waiting and will go with prisma and planetscale.

    • @joshtriedcoding
      @joshtriedcoding  Рік тому

      fair point. drizzle is very fun and refreshing to use, but not very established. While I think that will change in the not so near future, there's absolutely nothing wrong with prisma

  • @yunyang6267
    @yunyang6267 Рік тому

    is this starter kit outdated by any chance? Is it just me getting the connectionString does not satisfy the config type error in drizzle.config.ts?

  • @krisnrg
    @krisnrg Рік тому

    It’s absolutely unreal that Prisma does that. Like that’s all been figured out in the PHP days why are they doing that?

  • @jampy42
    @jampy42 Рік тому +1

    Nice video, can you do a video with drizzle and next-auth please 🥺, thanks 🙏

  • @kumardeepanshu8503
    @kumardeepanshu8503 Рік тому

    Is drizzle good for postgres ?

    • @joshtriedcoding
      @joshtriedcoding  Рік тому

      Yeah works with that

    • @kumardeepanshu8503
      @kumardeepanshu8503 Рік тому

      @@joshtriedcoding have to tried it with trpc ?

    • @kumardeepanshu8503
      @kumardeepanshu8503 Рік тому

      @@joshtriedcoding does it actually have big performance improvement over prism or just a minute difference.
      Right now I am working on a client work and i have a scenario in which I have do to many to many relation , and it is slow in prisma, as it is taking around 4s to to create it in database .
      Do does drizzle actually make a difference?

  • @Like_a_lion_979
    @Like_a_lion_979 Рік тому

    Can i use drizzle with supabase? Somebody tested?

  • @saralightbourne
    @saralightbourne Рік тому

    just finished learning prisma, damn it🥺

  • @xixReact
    @xixReact Рік тому

    protect n serve lord farqaad

  • @googoochu3923
    @googoochu3923 11 місяців тому

    Push command not recommend in docs ... Better to use migrate

  • @mattiarasulo9934
    @mattiarasulo9934 Рік тому +1

    Every month we should rewrite our codebases as there’s a “new kid on the block”.. Vercel ecosystem has something off..

  • @armandsalle8447
    @armandsalle8447 Рік тому

    Drizzle looks very good 🙌 Why Prisma doesn't work on the edge, but Drizzle does? 🧐 I'm still not confortable with Edge runtime and what it means

  • @faizanahmed9304
    @faizanahmed9304 Рік тому +1

    I think I must revise my SQL notes and cheatsheets.

    • @joshtriedcoding
      @joshtriedcoding  Рік тому +1

      Man just the same for me. The last real SQL query I've written before this was like a year ago and I felt like a grandpa getting into drizzle

    • @faizanahmed9304
      @faizanahmed9304 Рік тому

      @@joshtriedcoding lol

  • @nat_pinnock
    @nat_pinnock Рік тому

    Hi, I’m the 1% 😂🙋🏻‍♀️ I’m definitely going to swap out Prisma for Drizzle at some point, but Prisma is just so easy at the moment.

  • @microspacer
    @microspacer Рік тому

    It's all the hype

  • @NikosKatsikanis
    @NikosKatsikanis Рік тому

    why not prisma? because no esm

  • @ThisFellahHadFire
    @ThisFellahHadFire Рік тому

    8.75 seconds to create a user?

  • @vickoalan
    @vickoalan Рік тому

    More videos about DrizzleORM PLease

  • @Bobab0y
    @Bobab0y Рік тому

    Drizzle it is and get to get more comfortable with SQL ? Challenge accepted

  • @Abhishek-fw7oo
    @Abhishek-fw7oo Рік тому

    A new fullstack project with drizzle pleas JOSH

  • @Ivan-wm6gm
    @Ivan-wm6gm Рік тому +1

    another JS ORM. I wish someone create an opensource JS enterprise edition where we can have standardized toolbox maybe similar to spring.

  • @kiddhkane
    @kiddhkane 5 місяців тому

    You could put "Drizzle" in the title, but I guess that wouldn't be click-baity enough?

  • @hash809
    @hash809 Рік тому

    Please create a video tutorial of real projects using drizzle josh 🤘

  • @owenwexler7214
    @owenwexler7214 Рік тому

    Currently prototyping now…

  • @gregthomas5887
    @gregthomas5887 Рік тому

    How long before you and your AI friends take over our jobs, Josh?

  • @mobix25
    @mobix25 Рік тому

    can you please make a tutorial for Next js and planetscale.

  • @maverick456-33
    @maverick456-33 Рік тому

    DrizzleORM looks more intuitive.

  • @TariqSajid
    @TariqSajid Рік тому

    can you make your videos 60fps?

  • @GoTzilo
    @GoTzilo Рік тому

    Raw SQL > SQL builders >> ORMs.

    • @noahwinslow3252
      @noahwinslow3252 Рік тому

      I'm starting to feel this way but then I can't enforce my types 😥

  • @alsherifkhalaf7385
    @alsherifkhalaf7385 Рік тому

    I wish to see SQLite starter 😊😊

  • @shayanalijalbani9894
    @shayanalijalbani9894 Рік тому

    Drizzle is good but firebase and App write are too good for database and hunny thing is that I never use App write but rode about it 😅

  • @gunman479
    @gunman479 Рік тому

    I don't know what's going on over at YT but I've been unsubscribed from your channel not once, but twice now! I have no idea why it's happening.

  • @fra4897
    @fra4897 Рік тому

    everybody is saying drizzle is great and everybody is saying it's not -.- even the tweets they have on the website are saying that so not really sure this time

    • @cethien
      @cethien Рік тому

      its just the typical "this new thing is not exactly like my old thing, so its bad >:("
      had this in minimal api's in dotnet, people were going "this is cluttered and messy". well, news break: just do multiple files, its about the faster framework

    • @joshtriedcoding
      @joshtriedcoding  Рік тому +3

      Man the tweets on their website are a joke :D

    • @peter042
      @peter042 Рік тому +1

      ​@@joshtriedcodingthat's where they bought me 😂

    • @fra4897
      @fra4897 Рік тому

      @@joshtriedcoding they got me haha but why is that, like why somebody would deliberately undermine their reputation?

    • @DisasterSPA
      @DisasterSPA Рік тому

      @@joshtriedcoding They're actually true tweets, but Drizzle team has their meme game top notch

  • @Topsquadjapan
    @Topsquadjapan Рік тому

    Javacript community makes my eyes bleed. Always something new. Shiny Object Syndrome community. Next week this will be replaced as well.

    • @erkintek
      @erkintek Рік тому

      I hope prisma be replaced

  • @Xe054
    @Xe054 Рік тому

    Wtf, I hate Prisma now!

  • @hawarhekmat1174
    @hawarhekmat1174 Рік тому

    I'm more like noSQL world

  • @greendsnow
    @greendsnow Рік тому

    State of js shows there's a significant amount of non binary developers, most of whom are male, yes. 😅

  • @adspacheco
    @adspacheco Рік тому

    why u changed :
    "migrations:push": "node -r esbuild-register src/lib/db/migrate.ts",
    ?

  • @allsunday1485
    @allsunday1485 Рік тому

    How come you're connecting through @planetscale/database but providing only a db url instead of db host, username and password?
    EDIT: nvm I just read the database-js documentation