# 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

**![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdv2At3EdM59ZDFr99GePOEFwjEwch8lfMuP9yVAdBw7r0_00VIVhefFpzTNUEcVjLTp2GUSTQmsoGlbJRAuiDk-lw98td5yuMkWsFAl_HhJINzZ61-jQzRAX2K2tHNFmTEblS1Iw?key=EdrMeFx3ldj29sVR7R_2nA)**

6. You should now see two tables in “Table Editor” called “messages” and “profiles”.

**![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeRp8MQCxBHMxt2AYdu5Eui4KwgjK5ICtuuXX8QfwvGIkxCwZKMUxNZVX0Bu3HLH5GA5VW8maNA7X2sthp75vcCce0e1h7y2Xe_EkyOU5OKX05x_e9aCBtGRldCgujSNflbzCgJuQ?key=EdrMeFx3ldj29sVR7R_2nA)**

## 2. Creating a User in Supabase 

1.  Navigate to [https://codepen.io/ppartisan/pen/vEYbvwG](https://codepen.io/ppartisan/pen/vEYbvwG)

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfFv0FK4RpsJ6H_CYoe_LBBoZHgH8K_lfhlptukoPp-qiHnAtlXIPrCBR4ukU-F7gAw1ESYh8o-PdlH37IRDL6a1AZyUbRuvI52PtT7IyixUd76k6HgIvRE8C1JBgWTSMD_8rOIsw?key=EdrMeFx3ldj29sVR7R_2nA)

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. 

![Image](https://media.discordapp.net/attachments/1332078946497462364/1385579816689995890/image.png?ex=68569543&is=685543c3&hm=b0bc198a1263b07062a6175a89bdce8119d52e6999532abd57e43e25b8f24419&=&format=webp&quality=lossless&width=1549&height=430)

+

Leave a comment