Supabase is a suite of open-source tools wrapping a PostgreSQL database. It provides the building blocks of an app - database hosting, auth, file storage, realtime and edge functions - so we can focus on the thing that makes our app unique.
In this video, we sign up for a free Supabase account, create a basic schema for a blog, and populate it with test data.
Create the table
create table if not exists articles (
id uuid default uuid_generate_v4() primary key,
created_at timestamp with time zone default timezone('utc'::text, now()) not null,
title text not null,
content text not null,
is_published bool default false not null
);
Insert test data
insert into articles(title, content)
values
('First blog', 'This is my very first blog'),
('Second blog', 'I am really enjoying writing blogs'),
('Third blog', 'Okay, this is getting hard to maintain');
If you can't fetch data from new database in supabase or get an empty array like me. You need to set policy for your table by this SQL (you can run this in your supabase profile)
create policy "Public profiles are viewable by everyone."
on profiles for select
to authenticated, anon
using (
true
);
Instead of "profiles" in above SQL, you should paste your table name!