Database
Managing a PostgreSQL database with Supabase
Overview
Supabase provides you with a great UI to manage your database and table. If you have already completed the Supabase setup, there is no additional setup required to get started with the database.
CRUD Operations
You can use Supabase docs to learn the CRUD syntax.
Row-Level Security (RLS)
Row-Level Security (RLS for short) restricts access to certain rows of data based on a user’s permissions. This is why Supabase public keys can be exposed. By default, every new table you create will have RLS enabled but you will need to define policies to perform CRUD operations on it.
In your Supabase project’s dashboard, if you navigate to Authentication and then click Policies, you will see your tables. You will see if RLS is enabled and have the ability to create new policies.
Supabase provides templates for the common RLS policies you may want such as allowing inserts for authenticated users only, or allowing users to delete rows only if the user id of the row matches their’s.
Since the polcies are defined in SQL, they can get pretty complex. However, most people only need basic policies such as the ones Supabase has templates for.