Next.js Fetch Data the Right Way (with a Data Access Layer!) (Security, Auth, DTO)

👉 Sign up for Kinde here: https://bit.ly/3QOe1Bh (paid sponsorship). 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

The issue discussed here is not a Next.js problem / bug / issue. It’s an issue with how we structure our code.
Vercel’s article on Next.js security: https://nextjs.org/blog/security-nextjs-server-components-actions

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 Data Access Layer = best practice
00:42 Why you need a Data Access Layer (DAL)
05:18 Add authentication quickly
10:55 Data Access Layer example
18:12 server-only package
18:27 ORM select
19:22 DTO (Data Transfer Object)

#webdevelopment #reactjs #nextjs

Note that my videos may contain mistakes. Always verify yourself that your code is safe and does what you want it to do for your specific situation. You agree by watching the videos that you are solely responsible for any mistakes in your code.

This channel and all its content is owned & operated by ByteGrad Sp. z o.o. with Tax ID: PL6762676561 .
.
TOP resource to LEARN AI for Developers – https://datacamp.pxf.io/RGyxrR (paid sponsorship & ByteGrad Sp. z o.o. gets commission)