Video by HeyTimDev · streamed from YouTube. All rights remain with the creator.
Lesson 6: Designing the Database with Prisma
About this lesson
In this video, HeyTimDev integrates Prisma with Supabase to manage the database structure of the short-video app efficiently. It starts by explaining why the project uses Prisma for database migrations and structure management, rather than creating every table by hand, and what advantages a schema defined in code brings as the app grows. You then set up Prisma locally, connect it to the project's PostgreSQL database and learn how migrations are run, so that changes to the structure can be applied in a controlled way. The core of the video is creating and managing the tables the app depends on, including users, videos, likes, followers and comments, and deciding what each one needs to store. Associations are set up between users and their content, so that videos and likes are linked to the people who created them, and the video shows how table relationships are handled with Prisma's migration tools, applying the schema to the database with Prisma's database push command. Along the way it shares practical tips for managing ids and associations, including generating UUIDs as identifiers and following good SQL practice when linking tables together. By the end of the video, the app has a well-structured database ready to handle the back-end needs of a social media app, and the next video turns to authentication and securing access to the data. Afterwards, read Chapter 6 of the course book, which designs the tables and works out the odds of an id collision by hand.