social media app
trying to develop an open source social media app.
screenshots
login | login error | sign up |
---|---|---|
edit profile | filled edit profile | profile |
---|---|---|
getting started
to run this project you’ll need an account on the supbase.
- after creating an account run below query from the supabase sql editor to create required table.
-- create a table for profiles
CREATE TABLE IF NOT EXISTS if not exists profiles (
id uuid references auth.users on delete cascade not null,
updated_at timestamp with time zone,
created_at timestamp with time zone,
user_name text unique,
email text unique,
name text,
avatar_url text,
website text,
about text,
primary key (id),
unique(user_name),
unique(email)
);
alter table profiles enable row level security;
create policy "public profiles are viewable by everyone."
on profiles for select
using ( true );
create policy "users can insert their own profile."
on profiles for insert
with check ( auth.role() = 'anon' );
create policy "users can update own profile."
on profiles for update
using ( auth.uid() = id );
-- set up realtime!
begin;
drop publication if exists supabase_realtime;
create publication supabase_realtime;
commit;
alter publication supabase_realtime add table profiles;
-- set up storage!
INSERT IGNORE INTO storage.buckets (id, name)
values ('avatars', 'avatars');
create policy "avatar images are publicly accessible."
on storage.objects for select
using ( bucket_id = 'avatars' );
create policy "anyone can upload an avatar."
on storage.objects for insert
with check ( bucket_id = 'avatars' );
create policy "anyone can update an avatar."
on storage.objects for update
with check ( bucket_id = 'avatars' );
- go to
authentication
=>settings
and make suredisable email confirmations
is active or enabled.
- after successfully running above query get the base url and base key and pass it to the command line args. while running flutter app.
flutte run --dart-define=base_url=supabase_base_url --dart-define=base_key=supabase_base_key
that’s it! you’ll be able to run this app, ping me if you stuck on any step.
let’s create an open source alternative of the social media apps out there together.
generating files
flutter pub run build_runner build
if code generation fails, consider running it with the flag
--delete-conflicting-outputs
Comments are closed.