This is a demo project to show how to use Ktor
and Supabase
together.
The main feature here is to demonstrate how to use supabase's Auth and Storage features.
Please read the blog post for more details.
- Sign up with supabase and create a Supabase project and get the API URL and API Key. Store them in the environment variables
SUPABASE_URL
andSUPABASE_KEY
respectively. - Create a table called
todos
as follows:
-- 1. Create table
create table
public.todos
(
id uuid primary key,
user_id uuid references auth.users,
task text not null,
is_done boolean not null default false
) tablespace pg_default;
- Restrict access to the table to only logged-in users. Each user can only see their own todos!:
```sql
-- Enable RLS
alter table todos enable row level security;
-- Create policy
create policy "User can see their own todos only."
on todos
for select using ( auth.uid() = user_id );
./gradlew runFatJar