Access to all courses
Creating a Models and Actions
In this lesson, we'll create a basic model and a basic server action to interact with our database. We'll start by creating a connection file to connect to our database inside our Next.js app. ## Create a basic model Now that we have our connection file set up, we can create a basic model. We'll create a model for a user. This is only an example, but will be a good starting point to understand how we structure our files and models. Create a file called user.ts in the models folder:
The rest of this lesson is waiting.
Join JS Mastery Pro to unlock it.





Get Full Access
$149 /month
Lock in a year & save—2 months free!
Quizzes, mini-challenges, AI summaries, inline sandboxes
Participation in a private community
Build real production-grade apps
Mock interviews & project reviews
Weekly live sessions & member-only access