https://github.com/sokhenguchiha/next-supabase-boilerplate
https://github.com/sokhenguchiha/next-supabase-boilerplate
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sokhenguchiha/next-supabase-boilerplate
- Owner: sokhenguchiha
- Created: 2024-01-28T14:03:57.000Z (about 1 year ago)
- Default Branch: feat/stripe
- Last Pushed: 2024-02-19T08:53:53.000Z (about 1 year ago)
- Last Synced: 2024-08-13T07:17:01.448Z (8 months ago)
- Language: TypeScript
- Size: 144 KB
- Stars: 9
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- jimsghstars - sokhenguchiha/next-supabase-boilerplate - (TypeScript)
README
## Getting Started
First, run the development server:
```bash
npm i
npm run dev
```Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
## Learn More
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- [Supabase](https://supabase.com/) - Build in a weekend Scale to millions.
- [Shadcn](https://ui.shadcn.com/) - Build your component library.
- [React Query](https://tanstack.com/query/latest/) - TanStack Query.## Profile table
```sql
create table
public.profiles (
id uuid not null,
created_at timestamp with time zone not null default now(),
email text not null,
display_name text null,
image_url text null,
constraint profiles_pkey primary key (id),
constraint profiles_id_fkey foreign key (id) references auth.users (id) on update cascade on delete cascade
) tablespace pg_default;
```## Auth Trigger Function
```sql
begininsert into public.profiles(id,email,display_name,image_url)
values(
new.id,
new.raw_user_meta_data ->> 'email',
COALESCE(new.raw_user_meta_data ->> 'user_name',new.raw_user_meta_data ->> 'name'),
new.raw_user_meta_data ->> 'avatar_url'
);
return new;end;
```### Auth Trigger Creation
```sql
create trigger create_user_on_signup
after insert on auth.users for each row
execute function create_user_on_signup ();
```### Remove Trigger
```sql
drop trigger create_user_on_signup on auth.users;
```