{"id":27196014,"url":"https://github.com/moisestech/ai24-app","last_synced_at":"2025-04-09T19:58:04.281Z","repository":{"id":181699204,"uuid":"660968925","full_name":"moisestech/AI24-app","owner":"moisestech","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-24T22:31:51.000Z","size":2846,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T19:58:00.238Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ai-24-app.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moisestech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-01T11:22:54.000Z","updated_at":"2023-07-01T14:42:37.000Z","dependencies_parsed_at":"2023-07-16T23:10:24.399Z","dependency_job_id":"b84c4b54-54bf-48cf-a614-df8e393aec30","html_url":"https://github.com/moisestech/AI24-app","commit_stats":null,"previous_names":["moisestech/ai24-app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moisestech%2FAI24-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moisestech%2FAI24-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moisestech%2FAI24-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moisestech%2FAI24-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moisestech","download_url":"https://codeload.github.com/moisestech/AI24-app/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103909,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-09T19:58:03.847Z","updated_at":"2025-04-09T19:58:04.273Z","avatar_url":"https://github.com/moisestech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supabase Next.js Auth \u0026 User Management Starter\n\nThis example will set you up for a very common situation: users can sign up or sign in and then update their account with public profile information, including a profile image.\n\nThis demonstrates how to use:\n\n- User signups using Supabase [Auth](https://supabase.com/auth).\n  - Supabase [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs).\n  - Supabase [pre-built Auth UI for React](https://supabase.com/docs/guides/auth/auth-helpers/auth-ui).\n- User avatar images using Supabase [Storage](https://supabase.com/storage)\n- Public profiles restricted with [Policies](https://supabase.com/docs/guides/auth#policies).\n- Frontend using [Next.js](\u003c[nextjs.org/](https://nextjs.org/)\u003e).\n\n## Technologies used\n\n- Frontend:\n  - [Next.js](https://github.com/vercel/next.js) - a React framework for production.\n  - [Supabase.js](https://supabase.com/docs/library/getting-started) for user management and realtime data syncing.\n  - Supabase [Auth Helpers for Next.js](https://supabase.com/docs/guides/auth/auth-helpers/nextjs).\n  - Supabase [pre-built Auth UI for React](https://supabase.com/docs/guides/auth/auth-helpers/auth-ui).\n- Backend:\n  - [supabase.com/dashboard](https://supabase.com/dashboard/): hosted Postgres database with restful API for usage with Supabase.js.\n\n## Instant deploy\n\nThe Vercel deployment will guide you through creating a Supabase account and project. After installation of the Supabase integration, all relevant environment variables will be set up so that the project is usable immediately after deployment 🚀.\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2Fuser-management%2Fnextjs-user-management\u0026project-name=nextjs-user-management\u0026repository-name=nextjs-user-management\u0026integration-ids=oac_jUduyjQgOyzev1fjrW83NYOv\u0026external-id=nextjs-user-management)\n\n### 1. Create new project\n\nSign up to Supabase - [https://supabase.com/dashboard](https://supabase.com/dashboard) and create a new project. Wait for your database to start.\n\n### 2. Run \"User Management\" Quickstart\n\nOnce your database has started, head over to your project's `SQL Editor` and run the \"User Management Starter\" quickstart. On the `SQL editor` page, scroll down until you see `User Management Starter: Sets up a public Profiles table which you can access with your API`. Click that, then click `RUN` to execute that query and create a new `profiles` table. When that's finished, head over to the `Table Editor` and see your new `profiles` table.\n\n### 3. Get the URL and Key\n\nGo to the Project Settings (the cog icon), open the API tab, and find your API URL and `anon` key, you'll need these in the next step.\n\nThe `anon` key is your client-side API key. It allows \"anonymous access\" to your database, until the user has logged in. Once they have logged in, the keys will switch to the user's own login token. This enables row level security for your data. Read more about this [below](#postgres-row-level-security).\n\n![image](https://user-images.githubusercontent.com/10214025/88916245-528c2680-d298-11ea-8a71-708f93e1ce4f.png)\n\n**_NOTE_**: The `service_role` key has full access to your data, bypassing any security policies. These keys have to be kept secret and are meant to be used in server environments and never on a client or browser.\n\n### 4. Env vars\n\nCreate a file in this folder `.env.local`\n\n```\nNEXT_PUBLIC_SUPABASE_URL=\nNEXT_PUBLIC_SUPABASE_ANON_KEY=\n```\n\nPopulate this file with your URL and Key.\n\n### 5. Run the application\n\nRun the application: `npm run dev`. Open your browser to `https://localhost:3000/` and you are ready to go 🚀.\n\n## Supabase details\n\n### Postgres Row level security\n\nThis project uses very high-level Authorization using Postgres' Role Level Security.\nWhen you start a Postgres database on Supabase, we populate it with an `auth` schema, and some helper functions.\nWhen a user logs in, they are issued a JWT with the role `authenticated` and their UUID.\nWe can use these details to provide fine-grained control over what each user can and cannot do.\n\nThis is a trimmed-down schema, with the policies:\n\n```sql\n-- Create a table for public profiles\ncreate table profiles (\n  id uuid references auth.users not null primary key,\n  updated_at timestamp with time zone,\n  username text unique,\n  full_name text,\n  avatar_url text,\n  website text,\n\n  constraint username_length check (char_length(username) \u003e= 3)\n);\n-- Set up Row Level Security (RLS)\n-- See https://supabase.com/docs/guides/auth/row-level-security for more details.\nalter table profiles\n  enable row level security;\n\ncreate policy \"Public profiles are viewable by everyone.\" on profiles\n  for select using (true);\n\ncreate policy \"Users can insert their own profile.\" on profiles\n  for insert with check (auth.uid() = id);\n\ncreate policy \"Users can update own profile.\" on profiles\n  for update using (auth.uid() = id);\n\n-- This trigger automatically creates a profile entry when a new user signs up via Supabase Auth.\n-- See https://supabase.com/docs/guides/auth/managing-user-data#using-triggers for more details.\ncreate function public.handle_new_user()\nreturns trigger as $$\nbegin\n  insert into public.profiles (id, full_name, avatar_url)\n  values (new.id, new.raw_user_meta_data-\u003e\u003e'full_name', new.raw_user_meta_data-\u003e\u003e'avatar_url');\n  return new;\nend;\n$$ language plpgsql security definer;\ncreate trigger on_auth_user_created\n  after insert on auth.users\n  for each row execute procedure public.handle_new_user();\n\n-- Set up Storage!\ninsert into storage.buckets (id, name)\n  values ('avatars', 'avatars');\n\n-- Set up access controls for storage.\n-- See https://supabase.com/docs/guides/storage#policy-examples for more details.\ncreate policy \"Avatar images are publicly accessible.\" on storage.objects\n  for select using (bucket_id = 'avatars');\n\ncreate policy \"Anyone can upload an avatar.\" on storage.objects\n  for insert with check (bucket_id = 'avatars');\n\ncreate policy \"Anyone can update their own avatar.\" on storage.objects\n  for update using ( auth.uid() = owner ) with check (bucket_id = 'avatars');\n```\n\n## More Supabase Examples \u0026 Resources\n\n## Examples\n\nThese official examples are maintained by the Supabase team:\n\n- [Next.js Subscription Payments Starter](https://github.com/vercel/nextjs-subscription-payments)\n- [Next.js Slack Clone](https://github.com/supabase/supabase/tree/master/examples/slack-clone/nextjs-slack-clone)\n- [Next.js 13 Data Fetching](https://github.com/supabase/supabase/tree/master/examples/caching/with-nextjs-13)\n- [And more...](https://github.com/supabase/supabase/tree/master/examples)\n\n## Other resources\n\n- [[Docs] Next.js User Management Quickstart](https://supabase.com/docs/guides/getting-started/tutorials/with-nextjs)\n- [[Egghead.io] Build a SaaS product with Next.js, Supabase and Stripe](https://egghead.io/courses/build-a-saas-product-with-next-js-supabase-and-stripe-61f2bc20)\n- [[Blog] Fetching and caching Supabase data in Next.js 13 Server Components](https://supabase.com/blog/fetching-and-caching-supabase-data-in-next-js-server-components)\n\n## Authors\n\n- [Supabase](https://supabase.com)\n\nSupabase is open source. We'd love for you to follow along and get involved at https://github.com/supabase/supabase\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoisestech%2Fai24-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoisestech%2Fai24-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoisestech%2Fai24-app/lists"}