No video

Prisma in Next.js - My Fav Way to Work with Databases (CRUD, Dev/Prod Workflow, Relations, Indexes)

  Рет қаралды 40,415

ByteGrad

ByteGrad

Күн бұрын

👉 Check out Prisma: www.prisma.io/... (paid sponsorship & I get commission from your purchases)
Disclaimer: this is a sponsored video (paid). It's your responsibility to evaluate safety, accuracy and other relevant parts of the reviewed product.
👉 NEW React & Next.js Course: bytegrad.com/c...
Hi, I'm Wesley. I'm a brand ambassador for Kinde (paid sponsorship).
👉 Check out Kinde for auth and more bit.ly/3QOe1Bh
👉 NEW React & Next.js Course: bytegrad.com/c...
👉 Professional JavaScript Course: bytegrad.com/c...
👉 Professional CSS Course: bytegrad.com/c...
👉 Web development roadmap 2024 & 2025: email.bytegrad...
👉 Email newsletter (BIG update soon): email.bytegrad...
👉 Discord: all my courses have a private Discord
⏱️ Timestamps:
00:00 Intro
01:07 Next.js architecture
02:02 Example app overview
03:15 Setup Prisma
06:09 Schema fundamentals
07:36 Prisma extension + defaultFormatter
08:34 Schema fundamentals (continued)
10:09 Create database
12:38 View database content (Prisma Studio)
14:13 GET data on page (findMany)
16:50 Prisma Client instantiation
18:29 GET data on page (findUnique)
22:18 Changing schema (Slug) - npx prisma db push
25:38 @unique
27:42 @map
28:04 @index
28:53 Filtering (where)
29:55 Ordering
30:18 Select
31:00 Pagination
32:29 Count
33:42 Writing data (POST / PUT / DELETE)
42:03 Relations (one-to-many)
43:54 Many-to-many
44:27 One-to-one
46:50 include & connect (relations queries)
49:12 Seeding database
51:10 Prisma types
53:13 Seeding database (continued)
55:50 Error handling
57:35 Caching in Next.js
59:59 Prisma Accelerate caching
1:00:34 Going to production
1:04:32 Migrations
1:06:15 npx prisma migrate
1:08:18 postinstall (prisma generate)
1:08:42 Push to Vercel
1:10:19 Serverless vs Edge
1:10:59 Middleware (edge)
1:13:07 Prisma Pulse
#webdevelopment #reactjs #nextjs

Пікірлер: 99
@Ssmb-qj4df
@Ssmb-qj4df Ай бұрын
Man is the best teacher who doesn't give me anxiety while learning
@rohitkochikkatfrancis
@rohitkochikkatfrancis 2 ай бұрын
THIS IS THE BEST EXPLAINED VIDEO FOR PRISMA !!!!! Thank you so much for dwelling into even the minor details so that people who dont even have a clue bout what it is can easily understand it.
@rtx50700
@rtx50700 2 ай бұрын
Bro read my mind, yesterday I was thinking about when you will make a video on Prisma..and here it is 🙏
@enn_nj
@enn_nj 2 ай бұрын
😂same with me bro..i love you so much bro, you read our mind😂🙏🏻🙏🏻🙏🏻 that's what i need..thankyou so muchh💐💐💐♥️
@PrismaData
@PrismaData 2 ай бұрын
Incredible video!
@ByteGrad
@ByteGrad 2 ай бұрын
Any time!
@CleverGeneration
@CleverGeneration 2 ай бұрын
I'm only half way through and I've already learnt so many new things, thank you!!! Brilliant video ❤
@Saradomin65
@Saradomin65 2 ай бұрын
Was planning to get back to full-stack dev using prisma with Nextjs to create some side projects and this video comes in. Definitely will help a ton, thanks! 😁
@olusanyaolamide9764
@olusanyaolamide9764 2 ай бұрын
Nice one, will definitely check it out when I have time, I'm excited already, but we'll also love you to do a NodeJs Express course
@aryaamootaghi3248
@aryaamootaghi3248 6 күн бұрын
this guy knows what he is doing 🚀🚀🚀🚀
@ReDestro69
@ReDestro69 20 минут бұрын
Hey ByteGrad, love your videos. Would love to see you make a video on supabase and Nextjs
@aloky247
@aloky247 17 күн бұрын
I was directed here from the Prisma docs. Thank you for the awesome tutorial.
@abeybruck151
@abeybruck151 2 ай бұрын
very very very awesome. you sir is a natural born teacher. respect
@u.chaudhry2147
@u.chaudhry2147 2 ай бұрын
@ByteGrad can you next do tRPC with Next.js App Router? Also, you are the best teacher of the t3 stack out there. The way you teach us in such depth is awesome!
@alarafatsiddique9362
@alarafatsiddique9362 Ай бұрын
Could you please make a tutorial specifically on how to use Prisma from development, and testing to production with some concrete examples?
@mistersir3185
@mistersir3185 2 ай бұрын
The timing of this video is divinely. Love you bro.
@R3nxt
@R3nxt 2 ай бұрын
Great video. You were right, caching deserves its own video. Could you please upload a video that handles caching?
@ByteGrad
@ByteGrad 2 ай бұрын
Yes, coming soon!
@armaandhanji2112
@armaandhanji2112 2 ай бұрын
Looking forward to the caching video alot too!
@josephito27
@josephito27 20 күн бұрын
10 mins in and it is already solving me a lot of doubts about Next js omg, thank you
@RobertBojor
@RobertBojor 15 күн бұрын
Great example for using Prisma, thank you! I do have a question, when using this over an existing database, with data, and I mean lots of it, wouldn't make more sense to instead use prisma generate, instead of the push, to update the client with the unique fields and so on?
@GhostHack_1
@GhostHack_1 2 ай бұрын
One warning about prisma that most developers (including myself) overlook, it does not support optimistic rowlocking API calls. You will have to use Raw SQL for that and it gets very messy / hard to do when accounting for race conditions in production.
@JackTheZuluman
@JackTheZuluman 2 ай бұрын
Man,I really thought I can use Prisma. Thanks a lot for this🔥🔥🔥
@ashfaqkabir
@ashfaqkabir Ай бұрын
Awesome Video, Please Do a video On Dashboard Tutorial with Next Auth, SeverActions, Prisma and Mongodb
@jc2057
@jc2057 4 күн бұрын
good video, and definitely good commercial for copilot lol
@vt1tov
@vt1tov 2 ай бұрын
I love you man. Thanks! Great content :)
@zainn7336
@zainn7336 2 ай бұрын
Sir make a full video of supabase and next js as backend
@nunzioasisto
@nunzioasisto 2 ай бұрын
What would you suggest if the revalidatePath is not refreshing the input and content boxes after submitting a post? The new post appears but the data is not cleared from input nor content.
@a4tech357
@a4tech357 Ай бұрын
Helpful video! Can we get a github repo?
@RoyTjuh
@RoyTjuh Ай бұрын
dankjewel voor de video kerel
@jeffinj7707
@jeffinj7707 2 ай бұрын
Please also consider the fact that there are use cases where we have a standalone node/nestjs backend with an ORM, a nextjs app maybe one of the clients using the APIs. so no point in implementing the ORM in the nextjs too. what would be a better solution here? RQ?
@jfhandfield
@jfhandfield 2 ай бұрын
Wow great video Byte. Really well explained. The only question I have is what if I have 2 different database to access. How are you going to make your clients? Is it going to be in the same db.ts?
@PolatjonQurbonov
@PolatjonQurbonov Ай бұрын
It is a very informative lesson! Thank you!
@MrJohn360
@MrJohn360 13 күн бұрын
Thanks for sharing.
@TenzDelek
@TenzDelek Ай бұрын
i am about to start out, should i go with Prisma or drizzle?
@mostafashahat9760
@mostafashahat9760 2 ай бұрын
Awesome, keep up the great work 💖
@Sagarclips
@Sagarclips 22 күн бұрын
When creating post, why client component was not used
@ptk_001
@ptk_001 2 ай бұрын
Thanks for this amazing content!
@JacobPhillips-rf5db
@JacobPhillips-rf5db 2 ай бұрын
THANK YOU! You're AWESOME!
@socarmm
@socarmm 14 күн бұрын
Excelente! Gracias
@kdstudiogames3602
@kdstudiogames3602 Ай бұрын
sir your video is very helpfull to me. i have compleated the above video. but i have issue with the update post which i have tried in same way as server acton use for create post. how to pass the id in action={updatePost}. how to pass the id? please help
@aberbaCodes
@aberbaCodes 2 күн бұрын
Unrelated question, but how to you fast forward copy and paste code in your videos whilst the voice shows no break?
@parkerboling666
@parkerboling666 2 ай бұрын
Hey bytegrad I really enjoy your content and recently have been following along in some of your content, and I like kinde authentication. I’m building a full stack application for a childcare company and it would be a good video idea to show admin authorization and interacting with the kinde API to manage users from a secured back end admin panel this would help me out tremendously! I really enjoy the content though keep up the good work!
@assassingob7315
@assassingob7315 Ай бұрын
Hey, everybody! Can someone explain why after the application build, the updated data in the database is not updated on the client? The component is server-side
@true227
@true227 26 күн бұрын
i can't find data type cuid() in the description postgre, it's have only uuid()
@ianc6418
@ianc6418 Ай бұрын
I am stuck on trying to figure out how sqlite runs on apple silicon. home-brew doesn't seem to work edit: It seems to come preinstalled on macOS. How weird is that!
@victormustin2547
@victormustin2547 2 ай бұрын
I may be wrong but I don't think you talked about security and authorization which would have been great
@AK-kq1mk
@AK-kq1mk 19 күн бұрын
Useful stuff
@nikolas_beckel
@nikolas_beckel 10 күн бұрын
Good video 👌
@mlavinb
@mlavinb 2 ай бұрын
Great content! thanks for sharing
@indimerz
@indimerz 2 ай бұрын
can you make a video to show recommended way of doing filtering, sorting, search with nextjs and prisma??
@alaskandonut
@alaskandonut 2 ай бұрын
The prisma documentation is pretty easy to read on search and filter. It’s really not bad at all.
@darz_k.
@darz_k. 28 күн бұрын
Hey man - as an aside to this video being related to prisma - I'm looking at a new hosting provider, and they are only offering sql databases for the backend - would you recommend using regular sql databases with nextjs and react? Projects would be small to medium in terms of requests and users. If you could give us your advice on that, it would be much appreciated!
@viundesign
@viundesign Ай бұрын
6:33 Why doesn't it appear to me the autocomplete? I have the Prisma extension already installed
@mustafamufeed1666
@mustafamufeed1666 Ай бұрын
+1
@viundesign
@viundesign Ай бұрын
Still wondering
@viundesign
@viundesign Ай бұрын
@@mustafamufeed1666 Git Hub Copilot
@viundesign
@viundesign Ай бұрын
@@mustafamufeed1666 Git Hub Copilot
@suphawatwong9438
@suphawatwong9438 29 күн бұрын
@@viundesign it's co-pilot feature, i guess
@vipernext2190
@vipernext2190 2 ай бұрын
as always greate video ❤❤
@enn_nj
@enn_nj 2 ай бұрын
The best video from the best teacher 🙏🏻🙏🏻🙏🏻🙏🏻i really like this Chanel.
@user-vd5kp6jz7d
@user-vd5kp6jz7d 29 күн бұрын
Does anyone have a problem with form fields not reset after submission?
@teetanrobotics5363
@teetanrobotics5363 2 ай бұрын
Could you please make a project on credentials and social oauth using Auth.js, Supabase. We can also use resend for sign up confirmation and forgot password.
@abdelrahmanmostafa9489
@abdelrahmanmostafa9489 Ай бұрын
Github link?
@nasko235679
@nasko235679 2 ай бұрын
When you need to get data from db to a client component would you say the best way is by fetching the data in a parent server component and then passing it down to the client as props?
@ByteGrad
@ByteGrad 2 ай бұрын
That would be pretty typical yes
@asmitkhanal834
@asmitkhanal834 2 ай бұрын
i m new on nextJs so help me to use delete and update operation in the frontend ui code.How to execute the created function in the UI form?help me plzzz
@nasko235679
@nasko235679 2 ай бұрын
NICE!
@eliyir
@eliyir 2 ай бұрын
🙏
@krishpatel3632
@krishpatel3632 2 ай бұрын
What vs code theme do you use? It's great
@umernasir4217
@umernasir4217 2 ай бұрын
Please tell me as well.
@AvikNayak_
@AvikNayak_ 2 ай бұрын
Maybe Andromeda
@heismyke
@heismyke Ай бұрын
He doesnt like to tell people what theme he uses. i have been asking him too for a long time
@ivangeorge4478
@ivangeorge4478 2 ай бұрын
45:52 what was that sound :)
@blazi_0
@blazi_0 2 ай бұрын
The hardest thing that i dealt with prisma schmea until now was adding multi language support. Tried so many ways and ended up with using json for storing the values Not happy with this solution and looking for better ways, ill be appreciated if someone can help me with this
@sorenbs1
@sorenbs1 2 ай бұрын
I’ve always implemented this by loading the full translation file as json and caching it in memory on the server. That way loading the replacements is super cheap.
@A28480
@A28480 2 ай бұрын
Would be very helpful to understand why the data sometimes disappears when the schema is changed? Anyone know why it happens? Thanks a lot
@emad_naeim
@emad_naeim 2 ай бұрын
if the old data violates the new schema you make then it will be deleted (it will tell you and warn you before that), like if you are going to add new column and that column is required.. and you didn't specify the default value.. then by default old data will be deleted because they don't have value for this new colum. as a hack when you are playing with schema and you want to add new column.. specify a default value.. then it won't delete old data
@A28480
@A28480 2 ай бұрын
@@emad_naeim thank you very much
@emad_naeim
@emad_naeim 2 ай бұрын
@@A28480 😇🤍
@juliusgrisette
@juliusgrisette 2 ай бұрын
Thank you
@imkeyi
@imkeyi 2 ай бұрын
what if a post could have multiple categories and tags
@irfansaeedkhan7242
@irfansaeedkhan7242 2 ай бұрын
thank you
@gttrackpro9433
@gttrackpro9433 2 ай бұрын
hey @bytegrad, this workflow & advance tutorial is available on your course?
@ByteGrad
@ByteGrad 2 ай бұрын
We also use Prisma in the course, but not super advanced or something like that
@gttrackpro9433
@gttrackpro9433 2 ай бұрын
​@@ByteGrad ok got it. going to purchase your course asap 🎉
@haikelareff
@haikelareff Ай бұрын
god bless you...
@ahmadullahnikzad2850
@ahmadullahnikzad2850 Ай бұрын
revalidatePath does not work
@richardnorris9256
@richardnorris9256 Ай бұрын
This guy must be Dutch to speak English this clearly and quickly while multitasking. He definitely isn't British or American anyway, his English is too good.
@rvuyyuru
@rvuyyuru 2 ай бұрын
Switched to drizzle
@beyourahi
@beyourahi 2 ай бұрын
alright let's start the war 🚀 Prisma VS Drizzle
@jellyfish1772
@jellyfish1772 2 ай бұрын
why not drizzle
@bibblebabl
@bibblebabl 2 ай бұрын
If you think you ready to try it - go for it. It’s not exactly the same and it has less abstractions AFAICT. So basically you will need better understanding of SQL because drizzle gives you more control since it’s more a query builder. Now it becomes more popular but I guess not all people understand that it requires some entry level when with prisma you don’t have to care about a lot of things
@jonbharrell
@jonbharrell 2 ай бұрын
@bibblebabl is completely right. Prisma and Drizzle are similar tools at different levels of abstraction. If you prefer the Drizzle way of defining your models and querying, then it is the right tool for you.
@dukim632
@dukim632 Ай бұрын
i find primsa to be pretty horrible tool, the fact that we all opt out writing SQL is just mad. ORM creates stupid developers which cannot write proper SQL which creates TONS of problems later on
@true227
@true227 26 күн бұрын
i'm totally agree
@giuseppebosco5813
@giuseppebosco5813 2 ай бұрын
Pls drizzle
@iukeay
@iukeay 2 ай бұрын
I have a large database relational database with 30+ tables. Does Prisma still have issues doing relationship joins without having to scan the whole table - I have been looking into drizzle Just because we do a lot of relational joins. Just at the very small community and not as much documentation / examples. Love love love all your videos !!!!!! Keep it up king
All 17 React Best Practices (IMPORTANT!)
1:46:11
ByteGrad
Рет қаралды 93 М.
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 32 МЛН
WHO CAN RUN FASTER?
00:23
Zhong
Рет қаралды 38 МЛН
Migration Lesson: Don't Use Prisma | Prime Reacts
29:16
ThePrimeTime
Рет қаралды 149 М.
I tried 8 different Postgres ORMs
9:46
Beyond Fireship
Рет қаралды 403 М.
Read the Room: Measuring Air Quality with Rust and Elixir
17:50
Code & Stuff
Рет қаралды 1,7 М.
Is Drizzle Really Better Than Prisma?
20:15
Web Dev Simplified
Рет қаралды 76 М.
All 29 Next.js Mistakes Beginners Make
1:45:10
ByteGrad
Рет қаралды 108 М.
DHH discusses SQLite (and Stoicism)
54:00
Aaron Francis
Рет қаралды 58 М.
Microservices with Databases can be challenging...
20:52
Software Developer Diaries
Рет қаралды 24 М.
"The Life & Death of htmx" by Alexander Petros at Big Sky Dev Con 2024
23:01
Montana Programmers
Рет қаралды 48 М.
Build a productivity web app that's NOT a todo list
18:55
Learn With Jason
Рет қаралды 63 М.
You're not stupid: How to learn difficult things with Obsidian
6:16
Python Programmer
Рет қаралды 362 М.
Doing This Instead Of Studying.. 😳
00:12
Jojo Sim
Рет қаралды 32 МЛН