Skip to main content



View code

Run locally

  1. Create a supabase account here
  2. You need to setup your Supabase Database so it can store your users. Go to SQL Editor in your Supabase account and run the following SQL query:
create table
public.users (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
moralis_provider_id character varying null,
metadata json null,
constraint users_pkey primary key (id)
) tablespace pg_default;

alter table "public"."users" enable row level security;

create policy "Individuals can view their own user records."
on users for select
using ( (auth.jwt() ->> 'id')::bigint = id);
Screenshot 2023-11-26 at 12 23 04

If you view your database, you can double-check that the query was executed correctly. You should see a table called users with the following columns and 1 active RLS policy at the top.

Screenshot 2023-11-26 at 12 23 48

You should see this if you click on that 1 active RLS policy. This ensures that only authenticated users can view their data.

Screenshot 2023-11-26 at 12 24 57
  1. Copy .env.example to .env and fill in the values from your supabase dashboard and add the moralis api key
  2. Open public/script.js, and fill in the values (located at the top of the file) from your supabase dashboard
  3. Run yarn dev to run the server locally

Now your server is running locally with the following endpoints:

  • Client: localhost:3000 (or any other port you set in .env)
  • API: localhost:3000/api (or any other port you set in .env)

Now you can authenticate via MetaMask as long as you have the MetaMask browser extention installed in the browser.