{"id":21228279,"url":"https://github.com/zackha/nuxt-content-supabase-comments","last_synced_at":"2026-01-02T03:03:35.656Z","repository":{"id":157110692,"uuid":"614361455","full_name":"zackha/nuxt-content-supabase-comments","owner":"zackha","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-15T13:13:55.000Z","size":784,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-21T17:49:10.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"MattFaz/nuxt-content-supabase-comments","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zackha.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-15T12:40:34.000Z","updated_at":"2023-03-15T13:14:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"33977934-56c3-49a1-915a-dfd3d4e05f47","html_url":"https://github.com/zackha/nuxt-content-supabase-comments","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackha%2Fnuxt-content-supabase-comments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackha%2Fnuxt-content-supabase-comments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackha%2Fnuxt-content-supabase-comments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zackha%2Fnuxt-content-supabase-comments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zackha","download_url":"https://codeload.github.com/zackha/nuxt-content-supabase-comments/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243672373,"owners_count":20328762,"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":"2024-11-20T23:15:24.373Z","updated_at":"2026-01-02T03:03:30.632Z","avatar_url":"https://github.com/zackha.png","language":"Vue","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nuxt Content Supabase Comments\n\nThis project is to demonstrate how [Supabase](xxx) can be used as a comments system on a static [Nuxt3](xxx) website.\n\nThe primay purpose of this is to enable comments on a SSG blog. As such it includes several useful modules:\n\n- [Nuxt Content](https://content.nuxtjs.org/)\n- [Nuxt Supabase](https://supabase.nuxtjs.org/)\n- [Nuxt Tailwind](https://tailwindcss.nuxtjs.org/)\n\n## TODO:\n\n- [ ] Allow users to submit comments\n- [ ] Determine why comments are only loading locally\n- [ ] Nested comments\n\n## Notes\n\n## Setup\n\nClone and install dependencies (_using yarn_):\n\n```bash\ngit clone git@github.com:MattFaz/nuxt-content-supabase-comments.git blog\ncd blog\nyarn install\n```\n\nRename `.env.example` file to `.env` and add your credentials:\n\n```bash\nmv .env.example .env\n```\n\nStart the development server:\n\n```bash\nyarn dev\n```\n\nGenerate static site:\n\n```bash\nnpx nuxi generate\n```\n\n## Supabase Setup\n\nCreate Tables:\n\n```sql\n-- Create a table for Public Profiles\ncreate table if not exists public.profiles (\n  id uuid references auth.users not null primary key,\n  updated_at timestamp with time zone,\n  username text unique\n  constraint username_length check (char_length(username) \u003e= 3)\n);\n\n-- Create a table for Comments\ncreate table if not exists public.comments (\n  id bigint generated always as identity primary key,\n  created_at timestamp with time zone default(now()),\n  parent_comment_id int,\n  text text not null,\n  updated_at timestamp with time zone,\n  profile_id uuid references public.profiles not null,\n  post_uuid uuid not null\n)\n```\n\nEnable Row Level Security on Profiles table:\n\n```sql\n--- Enable Row Level Security for Profiles table\nalter table public.profiles\n  enable row level security;\n```\n\nCreate Policies on tables:\n\n```sql\ncreate policy \"Public profiles are viewable by everyone.\" on public.profiles\n  for select using (true);\n\ncreate policy \"Users can insert their own profile.\" on public.profiles\n  for insert with check (auth.uid() = id);\n\ncreate policy \"Users can update own profile.\" on public.profiles\n  for update using (auth.uid() = id);\n\ncreate policy \"Comments are viewable by everyone.\"\n  on public.comments for select\n  using ( true );\n\ncreate policy \"Users can create Comments.\"\n  on public.comments for insert\n  with check (auth.role() = 'authenticated');\n\ncreate policy \"Users can update own Comments.\"\n  on public.comments for update\n  using ( auth.uid() = profile_id );\n```\n\nCreate Function \u0026 Trigger to create Profile on User Signup:\n\n```sql\n-- function to insert a row into public.profiles\ncreate function public.handle_new_user()\nreturns trigger\nlanguage plpgsql\nsecurity definer set search_path = public\nas $$\nbegin\n  insert into public.profiles (id, username)\n  values (new.id, new.raw_user_meta_data -\u003e\u003e 'username');\n  return new;\nend;\n$$;\n\n-- trigger the function every time a user is created\ncreate trigger on_auth_user_created\n  after insert on auth.users\n  for each row execute procedure public.handle_new_user();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzackha%2Fnuxt-content-supabase-comments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzackha%2Fnuxt-content-supabase-comments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzackha%2Fnuxt-content-supabase-comments/lists"}