dabit3 / supabase-next.js

Full stack app built with Supabase and Next.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Full stack blog with Supabase and Next.js

This code goes along with the blog post The Complete Guide to Full Stack Development with Supabase and Next.js published here

To get started with this project, follow these steps.

  1. Create a new project in the Supabase dashboard

  2. Click on SQL in the left menu, and execute the following SQL query:

CREATE TABLE posts (
  id bigint generated by default as identity primary key,
  user_id uuid references auth.users not null,
  user_email text,
  title text,
  content text,
  inserted_at timestamp with time zone default timezone('utc'::text, now()) not null
);

alter table posts enable row level security;

create policy "Individuals can create posts." on posts for
    insert with check (auth.uid() = user_id);

create policy "Individuals can update their own posts." on posts for
    update using (auth.uid() = user_id);

create policy "Individuals can delete their own posts." on posts for
    delete using (auth.uid() = user_id);

create policy "Posts are public." on posts for
    select using ( true );

Run either locally or deploy to Vercel

Deploying to Vercel

Deploy with Vercel

Running locally

  1. Clone this project
git clone https://github.com/dabit3/supabase-next.js.git
  1. Change into the directory and install the dependencies
cd supabase-next

npm install
  1. Create a file named .env.local and update it with the values from your Supabase project:
NEXT_PUBLIC_SUPABASE_URL=https://app-id.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-public-api-key

App URLs

  1. Run the server
npm run dev

About

Full stack app built with Supabase and Next.js


Languages

Language:JavaScript 83.9%Language:CSS 16.1%