In this offline lecture, Harkirat expands on the previous Next.js lectures by introducing database interactions using Prisma ORM
, implementing better fetching
techniques, creating a singleton Prisma client
instance, and exploring Server Actions
for executing server-side code directly from components.
In the last lecture, we covered the basics of building a Next.js application with server-side rendering, API routes, and client-side interactivity. We explored how to fetch data from an API and render it on the server-side, as well as how to create API routes within our Next.js application to handle backend logic. Well, In this lecture, we will dive deeper into more advanced topics related to building a full-stack application with Next.js.Specifically, we will explore the following:
Next.js is a full-stack framework that allows you to build both the frontend and backend components of your application within a single codebase. While Next.js provides built-in support for server-side rendering (SSR) and API routes, it doesn't include a database solution out of the box. This is where third-party tools like Prisma come into play.
First, we need to install the Prisma package in our Next.js project:
npm install prisma