Next.js App Router
/

Learn how to build a SaaS with Next.js App Router and Supabase

Building the Database schema

In this lesson, we learn how to create a database schema for Supabase and how to use the Supabase client to interact with the database.

Reading Time: 15 minutes

In the previous sections, we have set up the foundations of our SaaS application and added a way for users to sign up and log in.

In this section, we will create a database schema for our application and learn how to use the Supabase Javascript client to interact with the database.

As we've mentioned before, the application we will be building allows users to generate blog posts using OpenAI's GPT-3 API.

Therefore, our schema will need to store the following information:

- users - posts

We will also need to store the Stripe subscriptions and user thresholds, but we will do that later on.

Users Table

As we have mentioned in the previous lesson, Supabase stores the ...