# Setting Up Supabase Login
Follow these steps to create your own login for Roky via supabase!
## Prerequisites
1. Flutter
2. Supabase Local Setup
## 1. Creating *Message* and *User* Tables using Flutter
Assuming you have everything correctly installed, do the following:
1. Open Docker Desktop
2. Navigate to [http://localhost:54323/](http://localhost:54323/) to supabase.
3. On the left sidebar, click on “SQL Editor”.
4. Paste the following code from the [flutter tutorial](https://supabase.com/blog/flutter-tutorial-building-a-chat-app) into the SQL Editor.
“`
create table if not exists public.profiles (
id uuid references auth.users on delete cascade not null primary key,
username varchar(24) not null unique,
created_at timestamp with time zone default timezone(‘utc’ :: text, now()) not null,
— username should be 3 to 24 characters long containing alphabets, numbers and underscores
constraint username_validation check (username ~* ‘^[A-Za-z0-9_]{3,24}$’)
);
comment on table public.profiles is ‘Holds all of users profile information’;
create table if not exists public.messages (
id uuid not null primary key default gen_random_uuid(),
profile_id uuid default auth.uid() references public.profiles(id) on delete cascade not null,
content varchar(500) not null,
created_at timestamp with time zone default timezone(‘utc’ :: text, now()) not null
);
comment on table public.messages is ‘Holds individual messages sent on the app.’;
“`
5. Run the code by pressing the “run” button or pressing Ctrl
6. You should now see two tables in “Table Editor” called “messages” and “profiles”.
## 2. Creating a User in Supabase
1. Navigate to [https://codepen.io/ppartisan/pen/vEYbvwG](https://codepen.io/ppartisan/pen/vEYbvwG)
2. Enter your API key in the “API Key” box.
3. Press “Generate cURL”
4. Copy the code in the “Generated cURL Command” box, and paste it into a bash terminal.
This is an example of the code you will copy.
“`
curl -X POST ‘http://localhost:54321/auth/v1/signup’ \
-H “apikey: http://127.0.0.1:54321” \
-H “Content-Type: application/json” \
-d ‘{
“email”: “user1@roky”,
“password”: “Password”,
“data”: {
“username”: “User1”
}
}’
“`
*Notes on Step 4 (for Windows only):
In Windows, you will need to ensure you have WSL and Ubuntu-24.04 installed, this will allow you to use bash command-line tools in your Windows environment.
When you open WSL, you should see something like: “username@hostname:~$”, with username and hostname being unique to you.
When you open WSL, if the interface shows: “docker-desktop:~#”, this means you may not have Ubuntu-24.04 installed.*
6. In Supabase, navigate to the “profiles” table and you should see an entry for the user you just created.
Leave a comment