mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 21:05:06 +03:00
* docs: remove link to token-transformer since that repo has since been refactored and no particular file contains the code originally linked to * docs: update Redis link in rate limiting examples to point to the correct URL * docs: update Supabase URLs to current magic link docs * docs: update README for postgres-on-the-edge function to remove polyscale line (service no longer exists) and add resource links to relevant deno blog post * docs: update Open Graph image generation examples links to the new documentation URL * docs: update README with new Quickstart: Swift guide URL * docs: update Supabase Vector links to reflect new URL * docs: add two new link suggestions the replace the current broken one. Choose one. * docs: update documentation links for Postgres Language Server to reflect new URL * docs: update event trigger matrix documentation link to compensate for fact that 'current' verb does not work for some of their links * Update apps/docs/content/troubleshooting/supabase-grafana-memory-charts.mdx Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com> --------- Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
80 lines
2.4 KiB
Markdown
80 lines
2.4 KiB
Markdown
# Supabase Flutter User Management
|
|
|
|
This repo is a quick sample of how you can get started building apps using Flutter and Supabase. You can find a step by step guide of how to build out this app in the [Quickstart: Flutter guide](https://supabase.io/docs/guides/with-flutter).
|
|
|
|
This repo will demonstrate how to:
|
|
|
|
- sign users in with Supabase Auth using [magic link](https://supabase.com/docs/reference/dart/auth-signinwithotp)
|
|
- store and retrieve data with [Supabase database](https://supabase.io/docs/guides/database)
|
|
- store image files in [Supabase storage](https://supabase.io/docs/guides/storage)
|
|
|
|
<img height="500px" src="https://raw.githubusercontent.com/supabase/supabase/master/examples/user-management/flutter-user-management/supabase-flutter-demo.png" alt="Supabase User Management example" />
|
|
|
|
## Getting Started
|
|
|
|
Rename `.env.example` to `.env` and fill in [your Supabase credentials](https://supabase.io/docs/guides/with-flutter#get-the-api-keys).
|
|
|
|
You can run this app on iOS, Android or the Web.
|
|
|
|
To run this application, simply run the following for iOS or Android
|
|
|
|
```bash
|
|
flutter run
|
|
```
|
|
|
|
Or for web, run the following command to launch it on `localhost:3000`
|
|
|
|
```bash
|
|
flutter run -d web-server --web-hostname localhost --web-port 3000
|
|
```
|
|
|
|
## Database Schema
|
|
|
|
```sql
|
|
-- Create a table for public "profiles"
|
|
create table profiles (
|
|
id uuid references auth.users not null,
|
|
updated_at timestamp with time zone,
|
|
username text unique,
|
|
avatar_url text,
|
|
website text,
|
|
|
|
primary key (id),
|
|
unique(username),
|
|
constraint username_length check (char_length(username) >= 3)
|
|
);
|
|
|
|
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 ( (select auth.uid()) = id );
|
|
|
|
create policy "Users can update own profile."
|
|
on profiles for update
|
|
using ( (select 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 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' );
|
|
```
|