Prisma in Next.js – My Fav Way to Work with Databases (CRUD, Dev/Prod Workflow, Relations, Indexes)
ByteGrad
👉 Check out Prisma: https://www.prisma.io/?via=bytegrad (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: https://bytegrad.com/courses/professional-react-nextjs
Hi, I’m Wesley. I’m a brand ambassador for Kinde (paid sponsorship).
👉 Check out Kinde for auth and more https://bit.ly/3QOe1Bh
👉 NEW React & Next.js Course: https://bytegrad.com/courses/professional-react-nextjs
👉 Professional JavaScript Course: https://bytegrad.com/courses/professional-javascript
👉 Professional CSS Course: https://bytegrad.com/courses/professional-css
👉 Web development roadmap 2024 & 2025: https://email.bytegrad.com
👉 Email newsletter (BIG update soon): https://email.bytegrad.com
👉 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