[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M796HBZTSEV5GSCN8R29E67P":3,"skill-same:01M796HBZTSEV5GSCN8R29E67P":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":36,"commitSha":37,"skillDirectory":38,"forksCount":39,"repositoryHtmlUrl":40,"repositoryHomepageUrl":6,"ownerHtmlUrl":41,"ownerBlogUrl":42,"ownerDescription":43,"updatedAt":44,"install":45,"resources":58},"01M796HBZTSEV5GSCN8R29E67P","supabase-reference-architecture",null,"Implement enterprise Supabase reference architectures — monorepo layout, multi-tenant RLS,\nmicroservices with cross-project access, framework integration, edge functions, caching,\nqueue patterns, and audit logging.\nUse when designing a new Supabase project from scratch, reviewing project structure for\nproduction readiness, planning multi-tenant isolation, or establishing team architecture standards.\nTrigger with phrases like \"supabase architecture\", \"supabase project structure\",\n\"supabase monorepo\", \"supabase multi-tenant\", \"supabase reference design\",\n\"how to organize supabase at scale\".","jukeyman\u002Fjukeyman-skills","jukeyman","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F142960420?v=4","01M78FR4Y3DHMMCBCC0GXXNB3F","RICK JEFFERSON","01M78FR4Z8RVQRAD31Y5J7V6EB",1,"MIT","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--supabase-pack--supabase-reference-architecture\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: supabase-reference-architecture\ndescription: |\n  Implement enterprise Supabase reference architectures — monorepo layout, multi-tenant RLS,\n  microservices with cross-project access, framework integration, edge functions, caching,\n  queue patterns, and audit logging.\n  Use when designing a new Supabase project from scratch, reviewing project structure for\n  production readiness, planning multi-tenant isolation, or establishing team architecture standards.\n  Trigger with phrases like \"supabase architecture\", \"supabase project structure\",\n  \"supabase monorepo\", \"supabase multi-tenant\", \"supabase reference design\",\n  \"how to organize supabase at scale\".\nallowed-tools: Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(supabase:*), Grep, Glob\nversion: 1.0.0\nlicense: MIT\nauthor: Jeremy Longshore \u003Cjeremy@intentsolutions.io>\ncompatible-with: claude-code, codex, openclaw\ntags: [saas, supabase, architecture, patterns, multi-tenant, monorepo]\n---\n\n# Supabase Reference Architecture\n\n## Overview\n\nProduction Supabase applications need more than a flat `lib\u002Fsupabase.ts` file. This skill covers five enterprise architecture patterns: monorepo with shared types, multi-tenant RLS isolation, microservices with separate Supabase projects, framework integration (Next.js \u002F SvelteKit), and operational patterns (edge functions, caching, queues, audit trails). Each pattern stands alone — pick the ones that match your scale.\n\nFor the full monorepo directory layout and microservices cross-project access, see [Project Structure](references\u002Fproject-structure.md). For edge functions, caching, queue, and audit trail patterns, see [Operational Patterns](references\u002Fkey-components.md).\n\n## Prerequisites\n\n- `@supabase\u002Fsupabase-js` v2+ installed (`npm install @supabase\u002Fsupabase-js`)\n- Supabase CLI installed (`npm install -g supabase`)\n- A Supabase project at [supabase.com\u002Fdashboard](https:\u002F\u002Fsupabase.com\u002Fdashboard)\n- Familiarity with `supabase-install-auth` (project URL, anon key, service role key)\n- PostgreSQL basics (RLS policies, triggers, functions)\n\n## Instructions\n\n### Step 1: Client Singleton — The Foundation\n\nEvery app in the monorepo imports from a shared package instead of creating its own client. This guarantees a single source of truth for the URL, keys, and type definitions.\n\n```typescript\n\u002F\u002F packages\u002Fsupabase\u002Fsrc\u002Fclient.ts\nimport { createClient, SupabaseClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '.\u002Fdatabase.types'\n\nlet client: SupabaseClient\u003CDatabase> | null = null\n\nexport function getSupabaseClient(): SupabaseClient\u003CDatabase> {\n  if (!client) {\n    const url = process.env.NEXT_PUBLIC_SUPABASE_URL ?? process.env.SUPABASE_URL\n    const key = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? process.env.SUPABASE_ANON_KEY\n    if (!url || !key) {\n      throw new Error('Missing SUPABASE_URL or SUPABASE_ANON_KEY environment variables')\n    }\n    client = createClient\u003CDatabase>(url, key)\n  }\n  return client\n}\n\n\u002F\u002F Reset for testing\nexport function resetClient(): void {\n  client = null\n}\n```\n\n```typescript\n\u002F\u002F packages\u002Fsupabase\u002Fsrc\u002Fadmin.ts — Server-side only, never bundle in client code\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '.\u002Fdatabase.types'\n\nexport function getSupabaseAdmin() {\n  const url = process.env.SUPABASE_URL\n  const serviceKey = process.env.SUPABASE_SERVICE_ROLE_KEY\n  if (!url || !serviceKey) {\n    throw new Error('Missing SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY — server-only')\n  }\n  return createClient\u003CDatabase>(url, serviceKey, {\n    auth: { autoRefreshToken: false, persistSession: false }\n  })\n}\n```\n\nKey detail: The admin client sets `autoRefreshToken: false` and `persistSession: false` because server-side code should never store user sessions.\n\n### Step 2: Multi-Tenant RLS via JWT Claims\n\nThe most scalable Supabase multi-tenant pattern uses a custom JWT claim (`org_id`) combined with RLS policies. Every table includes an `org_id` column, and RLS extracts the tenant from the user's JWT — no application-level filtering needed.\n\n```sql\n-- Migration: 20260101000000_create_tenants.sql\n\n-- Tenants table\ncreate table public.tenants (\n  id uuid primary key default gen_random_uuid(),\n  name text not null,\n  slug text unique not null,\n  plan text default 'free' check (plan in ('free', 'pro', 'enterprise')),\n  created_at timestamptz default now()\n);\n\n-- Tenant membership\ncreate table public.tenant_members (\n  tenant_id uuid references public.tenants(id) on delete cascade,\n  user_id uuid references auth.users(id) on delete cascade,\n  role text default 'member' check (role in ('owner', 'admin', 'member', 'viewer')),\n  primary key (tenant_id, user_id)\n);\n\n-- Example tenant-scoped table\ncreate table public.projects (\n  id uuid primary key default gen_random_uuid(),\n  org_id uuid not null references public.tenants(id) on delete cascade,\n  name text not null,\n  created_by uuid references auth.users(id),\n  created_at timestamptz default now()\n);\n\n-- Enable RLS on all tenant-scoped tables\nalter table public.projects enable row level security;\n\n-- RLS policy: users can only see rows belonging to their tenant\n-- The org_id is extracted from the JWT claims set during authentication\ncreate policy \"Tenant isolation\" on public.projects\n  for all\n  using (\n    org_id = (auth.jwt() ->> 'org_id')::uuid\n  );\n```\n\nThe tenant-switching function verifies membership before updating the JWT claim:\n\n```sql\n-- Helper function to set org_id in JWT claims after login\ncreate or replace function public.set_tenant_claim(tenant_id uuid)\nreturns void as $$\nbegin\n  -- Verify user is a member of this tenant\n  if not exists (\n    select 1 from public.tenant_members\n    where tenant_members.tenant_id = set_tenant_claim.tenant_id\n      and tenant_members.user_id = auth.uid()\n  ) then\n    raise exception 'Not a member of tenant %', tenant_id;\n  end if;\n\n  -- Set the custom claim\n  perform auth.update_user_metadata(\n    auth.uid(),\n    jsonb_build_object('org_id', tenant_id)\n  );\nend;\n$$ language plpgsql security definer;\n```\n\nKey details for multi-tenant RLS:\n- `auth.jwt() ->> 'org_id'` reads a custom claim from the user's JWT — zero application code needed\n- Every tenant-scoped table must have an `org_id` column and RLS enabled\n- Tenant switching requires updating the JWT claim and re-authenticating\n- For row-level tenant + role permissions, combine `org_id` with a role lookup\n\n### Step 3: Framework Integration (Next.js)\n\nServer components use the `service_role` key for direct database access. Client components use the `anon` key with RLS protection.\n\n```typescript\n\u002F\u002F app\u002Flib\u002Fsupabase-server.ts — Next.js App Router (server components)\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport { cookies } from 'next\u002Fheaders'\nimport type { Database } from '@my-platform\u002Fsupabase'\n\nexport async function getSupabaseServer() {\n  const cookieStore = await cookies()\n\n  return createClient\u003CDatabase>(\n    process.env.NEXT_PUBLIC_SUPABASE_URL!,\n    process.env.SUPABASE_SERVICE_ROLE_KEY!,\n    {\n      auth: { autoRefreshToken: false, persistSession: false },\n      global: {\n        headers: {\n          \u002F\u002F Forward the user's auth cookie for RLS context\n          cookie: cookieStore.toString()\n        }\n      }\n    }\n  )\n}\n\n\u002F\u002F app\u002Fprojects\u002Fpage.tsx — Server component with direct DB access\nexport default async function ProjectsPage() {\n  const supabase = await getSupabaseServer()\n  const { data: projects } = await supabase\n    .from('projects')\n    .select('id, name, created_at')\n    .order('created_at', { ascending: false })\n    .limit(50)\n\n  return \u003CProjectList projects={projects ?? []} \u002F>\n}\n```\n\n```typescript\n\u002F\u002F app\u002Flib\u002Fsupabase-browser.ts — Client components use the anon key\n'use client'\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '@my-platform\u002Fsupabase'\n\nlet browserClient: ReturnType\u003Ctypeof createClient\u003CDatabase>> | null = null\n\nexport function getSupabaseBrowser() {\n  if (!browserClient) {\n    browserClient = createClient\u003CDatabase>(\n      process.env.NEXT_PUBLIC_SUPABASE_URL!,\n      process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!\n    )\n  }\n  return browserClient\n}\n```\n\nFor SvelteKit integration and additional framework patterns, see [Examples](references\u002Fexamples.md).\n\n## Output\n\nAfter applying these patterns you will have:\n- Monorepo with shared Supabase client, typed database access, and centralized migrations\n- Multi-tenant RLS isolation using `auth.jwt() ->> 'org_id'` — zero application-level filtering\n- Framework-specific integration for Next.js (server\u002Fclient split) and SvelteKit (hooks)\n- Edge Functions, caching layer, job queue, and audit trail (see [Operational Patterns](references\u002Fkey-components.md))\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `Missing SUPABASE_URL or SUPABASE_ANON_KEY` | Environment variables not set | Check `.env` file and ensure variables are loaded |\n| `new row violates row-level security policy` | RLS blocks the operation | Verify `org_id` JWT claim matches the row's `org_id` |\n| `Not a member of tenant` | User tried switching to unauthorized tenant | Check `tenant_members` table for the user-tenant pair |\n| `TypeError: Cannot read properties of null` | Client singleton not initialized | Ensure env vars are available before first `getSupabaseClient()` call |\n| `cron.schedule: permission denied` | `pg_cron` extension not enabled | Enable via dashboard: Database > Extensions > pg_cron |\n\nFor the full error reference including RLS debugging and cross-project troubleshooting, see [Error Handling Reference](references\u002Ferrors.md).\n\n## Examples\n\n### Multi-Tenant Query Flow (TypeScript)\n\n```typescript\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '.\u002Fdatabase.types'\n\nconst supabase = createClient\u003CDatabase>(\n  process.env.SUPABASE_URL!,\n  process.env.SUPABASE_ANON_KEY!\n)\n\n\u002F\u002F 1. Sign in\nconst { data: { session } } = await supabase.auth.signInWithPassword({\n  email: 'user@example.com',\n  password: 'secure-password'\n})\n\n\u002F\u002F 2. Switch tenant context\nconst { error: claimError } = await supabase.rpc('set_tenant_claim', {\n  tenant_id: 'tenant-uuid-here'\n})\nif (claimError) throw claimError\n\n\u002F\u002F 3. Refresh session to pick up new JWT claims\nawait supabase.auth.refreshSession()\n\n\u002F\u002F 4. All subsequent queries are automatically scoped to this tenant\nconst { data: projects } = await supabase\n  .from('projects')\n  .select('id, name, created_at')\n  .order('created_at', { ascending: false })\n\nconsole.log('Tenant projects:', projects)\n\u002F\u002F Only returns projects where org_id matches the JWT claim\n```\n\nFor the job queue consumer example and SvelteKit integration, see [Examples](references\u002Fexamples.md).\n\n## Resources\n\n- [Supabase Architecture](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fgetting-started\u002Farchitecture)\n- [Row Level Security](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fdatabase\u002Fpostgres\u002Frow-level-security)\n- [Multi-Tenant RLS](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fauth\u002Frow-level-security#multi-tenant-applications)\n- [Edge Functions](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Ffunctions)\n- [TypeScript Support](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Freference\u002Fjavascript\u002Ftypescript-support)\n- [Generating Types](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fapi\u002Frest\u002Fgenerating-types)\n- [pg_cron Extension](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fdatabase\u002Fextensions\u002Fpg_cron)\n- [Auth JWT Helper](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fauth\u002Fjwts)\n- [createClient Reference](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Freference\u002Fjavascript\u002Finitializing)\n\n## Next Steps\n\nFor performance optimization and indexing strategies, see `supabase-performance-tuning`. For deployment pipelines and CI integration, see `supabase-ci-integration`. For security hardening and policy guardrails, see `supabase-security-basics`.\n","# Supabase Reference Architecture\n\n## Overview\n\nProduction Supabase applications need more than a flat `lib\u002Fsupabase.ts` file. This skill covers five enterprise architecture patterns: monorepo with shared types, multi-tenant RLS isolation, microservices with separate Supabase projects, framework integration (Next.js \u002F SvelteKit), and operational patterns (edge functions, caching, queues, audit trails). Each pattern stands alone — pick the ones that match your scale.\n\nFor the full monorepo directory layout and microservices cross-project access, see [Project Structure](references\u002Fproject-structure.md). For edge functions, caching, queue, and audit trail patterns, see [Operational Patterns](references\u002Fkey-components.md).\n\n## Prerequisites\n\n- `@supabase\u002Fsupabase-js` v2+ installed (`npm install @supabase\u002Fsupabase-js`)\n- Supabase CLI installed (`npm install -g supabase`)\n- A Supabase project at [supabase.com\u002Fdashboard](https:\u002F\u002Fsupabase.com\u002Fdashboard)\n- Familiarity with `supabase-install-auth` (project URL, anon key, service role key)\n- PostgreSQL basics (RLS policies, triggers, functions)\n\n## Instructions\n\n### Step 1: Client Singleton — The Foundation\n\nEvery app in the monorepo imports from a shared package instead of creating its own client. This guarantees a single source of truth for the URL, keys, and type definitions.\n\n```typescript\n\u002F\u002F packages\u002Fsupabase\u002Fsrc\u002Fclient.ts\nimport { createClient, SupabaseClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '.\u002Fdatabase.types'\n\nlet client: SupabaseClient\u003CDatabase> | null = null\n\nexport function getSupabaseClient(): SupabaseClient\u003CDatabase> {\n  if (!client) {\n    const url = process.env.NEXT_PUBLIC_SUPABASE_URL ?? process.env.SUPABASE_URL\n    const key = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY ?? process.env.SUPABASE_ANON_KEY\n    if (!url || !key) {\n      throw new Error('Missing SUPABASE_URL or SUPABASE_ANON_KEY environment variables')\n    }\n    client = createClient\u003CDatabase>(url, key)\n  }\n  return client\n}\n\n\u002F\u002F Reset for testing\nexport function resetClient(): void {\n  client = null\n}\n```\n\n```typescript\n\u002F\u002F packages\u002Fsupabase\u002Fsrc\u002Fadmin.ts — Server-side only, never bundle in client code\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '.\u002Fdatabase.types'\n\nexport function getSupabaseAdmin() {\n  const url = process.env.SUPABASE_URL\n  const serviceKey = process.env.SUPABASE_SERVICE_ROLE_KEY\n  if (!url || !serviceKey) {\n    throw new Error('Missing SUPABASE_URL or SUPABASE_SERVICE_ROLE_KEY — server-only')\n  }\n  return createClient\u003CDatabase>(url, serviceKey, {\n    auth: { autoRefreshToken: false, persistSession: false }\n  })\n}\n```\n\nKey detail: The admin client sets `autoRefreshToken: false` and `persistSession: false` because server-side code should never store user sessions.\n\n### Step 2: Multi-Tenant RLS via JWT Claims\n\nThe most scalable Supabase multi-tenant pattern uses a custom JWT claim (`org_id`) combined with RLS policies. Every table includes an `org_id` column, and RLS extracts the tenant from the user's JWT — no application-level filtering needed.\n\n```sql\n-- Migration: 20260101000000_create_tenants.sql\n\n-- Tenants table\ncreate table public.tenants (\n  id uuid primary key default gen_random_uuid(),\n  name text not null,\n  slug text unique not null,\n  plan text default 'free' check (plan in ('free', 'pro', 'enterprise')),\n  created_at timestamptz default now()\n);\n\n-- Tenant membership\ncreate table public.tenant_members (\n  tenant_id uuid references public.tenants(id) on delete cascade,\n  user_id uuid references auth.users(id) on delete cascade,\n  role text default 'member' check (role in ('owner', 'admin', 'member', 'viewer')),\n  primary key (tenant_id, user_id)\n);\n\n-- Example tenant-scoped table\ncreate table public.projects (\n  id uuid primary key default gen_random_uuid(),\n  org_id uuid not null references public.tenants(id) on delete cascade,\n  name text not null,\n  created_by uuid references auth.users(id),\n  created_at timestamptz default now()\n);\n\n-- Enable RLS on all tenant-scoped tables\nalter table public.projects enable row level security;\n\n-- RLS policy: users can only see rows belonging to their tenant\n-- The org_id is extracted from the JWT claims set during authentication\ncreate policy \"Tenant isolation\" on public.projects\n  for all\n  using (\n    org_id = (auth.jwt() ->> 'org_id')::uuid\n  );\n```\n\nThe tenant-switching function verifies membership before updating the JWT claim:\n\n```sql\n-- Helper function to set org_id in JWT claims after login\ncreate or replace function public.set_tenant_claim(tenant_id uuid)\nreturns void as $$\nbegin\n  -- Verify user is a member of this tenant\n  if not exists (\n    select 1 from public.tenant_members\n    where tenant_members.tenant_id = set_tenant_claim.tenant_id\n      and tenant_members.user_id = auth.uid()\n  ) then\n    raise exception 'Not a member of tenant %', tenant_id;\n  end if;\n\n  -- Set the custom claim\n  perform auth.update_user_metadata(\n    auth.uid(),\n    jsonb_build_object('org_id', tenant_id)\n  );\nend;\n$$ language plpgsql security definer;\n```\n\nKey details for multi-tenant RLS:\n- `auth.jwt() ->> 'org_id'` reads a custom claim from the user's JWT — zero application code needed\n- Every tenant-scoped table must have an `org_id` column and RLS enabled\n- Tenant switching requires updating the JWT claim and re-authenticating\n- For row-level tenant + role permissions, combine `org_id` with a role lookup\n\n### Step 3: Framework Integration (Next.js)\n\nServer components use the `service_role` key for direct database access. Client components use the `anon` key with RLS protection.\n\n```typescript\n\u002F\u002F app\u002Flib\u002Fsupabase-server.ts — Next.js App Router (server components)\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport { cookies } from 'next\u002Fheaders'\nimport type { Database } from '@my-platform\u002Fsupabase'\n\nexport async function getSupabaseServer() {\n  const cookieStore = await cookies()\n\n  return createClient\u003CDatabase>(\n    process.env.NEXT_PUBLIC_SUPABASE_URL!,\n    process.env.SUPABASE_SERVICE_ROLE_KEY!,\n    {\n      auth: { autoRefreshToken: false, persistSession: false },\n      global: {\n        headers: {\n          \u002F\u002F Forward the user's auth cookie for RLS context\n          cookie: cookieStore.toString()\n        }\n      }\n    }\n  )\n}\n\n\u002F\u002F app\u002Fprojects\u002Fpage.tsx — Server component with direct DB access\nexport default async function ProjectsPage() {\n  const supabase = await getSupabaseServer()\n  const { data: projects } = await supabase\n    .from('projects')\n    .select('id, name, created_at')\n    .order('created_at', { ascending: false })\n    .limit(50)\n\n  return \u003CProjectList projects={projects ?? []} \u002F>\n}\n```\n\n```typescript\n\u002F\u002F app\u002Flib\u002Fsupabase-browser.ts — Client components use the anon key\n'use client'\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '@my-platform\u002Fsupabase'\n\nlet browserClient: ReturnType\u003Ctypeof createClient\u003CDatabase>> | null = null\n\nexport function getSupabaseBrowser() {\n  if (!browserClient) {\n    browserClient = createClient\u003CDatabase>(\n      process.env.NEXT_PUBLIC_SUPABASE_URL!,\n      process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!\n    )\n  }\n  return browserClient\n}\n```\n\nFor SvelteKit integration and additional framework patterns, see [Examples](references\u002Fexamples.md).\n\n## Output\n\nAfter applying these patterns you will have:\n- Monorepo with shared Supabase client, typed database access, and centralized migrations\n- Multi-tenant RLS isolation using `auth.jwt() ->> 'org_id'` — zero application-level filtering\n- Framework-specific integration for Next.js (server\u002Fclient split) and SvelteKit (hooks)\n- Edge Functions, caching layer, job queue, and audit trail (see [Operational Patterns](references\u002Fkey-components.md))\n\n## Error Handling\n\n| Error | Cause | Solution |\n|-------|-------|----------|\n| `Missing SUPABASE_URL or SUPABASE_ANON_KEY` | Environment variables not set | Check `.env` file and ensure variables are loaded |\n| `new row violates row-level security policy` | RLS blocks the operation | Verify `org_id` JWT claim matches the row's `org_id` |\n| `Not a member of tenant` | User tried switching to unauthorized tenant | Check `tenant_members` table for the user-tenant pair |\n| `TypeError: Cannot read properties of null` | Client singleton not initialized | Ensure env vars are available before first `getSupabaseClient()` call |\n| `cron.schedule: permission denied` | `pg_cron` extension not enabled | Enable via dashboard: Database > Extensions > pg_cron |\n\nFor the full error reference including RLS debugging and cross-project troubleshooting, see [Error Handling Reference](references\u002Ferrors.md).\n\n## Examples\n\n### Multi-Tenant Query Flow (TypeScript)\n\n```typescript\nimport { createClient } from '@supabase\u002Fsupabase-js'\nimport type { Database } from '.\u002Fdatabase.types'\n\nconst supabase = createClient\u003CDatabase>(\n  process.env.SUPABASE_URL!,\n  process.env.SUPABASE_ANON_KEY!\n)\n\n\u002F\u002F 1. Sign in\nconst { data: { session } } = await supabase.auth.signInWithPassword({\n  email: 'user@example.com',\n  password: 'secure-password'\n})\n\n\u002F\u002F 2. Switch tenant context\nconst { error: claimError } = await supabase.rpc('set_tenant_claim', {\n  tenant_id: 'tenant-uuid-here'\n})\nif (claimError) throw claimError\n\n\u002F\u002F 3. Refresh session to pick up new JWT claims\nawait supabase.auth.refreshSession()\n\n\u002F\u002F 4. All subsequent queries are automatically scoped to this tenant\nconst { data: projects } = await supabase\n  .from('projects')\n  .select('id, name, created_at')\n  .order('created_at', { ascending: false })\n\nconsole.log('Tenant projects:', projects)\n\u002F\u002F Only returns projects where org_id matches the JWT claim\n```\n\nFor the job queue consumer example and SvelteKit integration, see [Examples](references\u002Fexamples.md).\n\n## Resources\n\n- [Supabase Architecture](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fgetting-started\u002Farchitecture)\n- [Row Level Security](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fdatabase\u002Fpostgres\u002Frow-level-security)\n- [Multi-Tenant RLS](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fauth\u002Frow-level-security#multi-tenant-applications)\n- [Edge Functions](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Ffunctions)\n- [TypeScript Support](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Freference\u002Fjavascript\u002Ftypescript-support)\n- [Generating Types](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fapi\u002Frest\u002Fgenerating-types)\n- [pg_cron Extension](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fdatabase\u002Fextensions\u002Fpg_cron)\n- [Auth JWT Helper](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Fguides\u002Fauth\u002Fjwts)\n- [createClient Reference](https:\u002F\u002Fsupabase.com\u002Fdocs\u002Freference\u002Fjavascript\u002Finitializing)\n\n## Next Steps\n\nFor performance optimization and indexing strategies, see `supabase-performance-tuning`. For deployment pipelines and CI integration, see `supabase-ci-integration`. For security hardening and policy guardrails, see `supabase-security-basics`.\n",{"name":5,"tags":24,"author":31,"license":15,"version":32,"description":33,"allowed-tools":34,"compatible-with":35},[25,26,27,28,29,30],"saas","supabase","architecture","patterns","multi-tenant","monorepo","Jeremy Longshore \u003Cjeremy@intentsolutions.io>","1.0.0","Implement enterprise Supabase reference architectures — monorepo layout, multi-tenant RLS,\nmicroservices with cross-project access, framework integration, edge functions, caching,\nqueue patterns, and audit logging.\nUse when designing a new Supabase project from scratch, reviewing project structure for\nproduction readiness, planning multi-tenant isolation, or establishing team architecture standards.\nTrigger with phrases like \"supabase architecture\", \"supabase project structure\",\n\"supabase monorepo\", \"supabase multi-tenant\", \"supabase reference design\",\n\"how to organize supabase at scale\".\n","Read, Write, Edit, Bash(npm:*), Bash(npx:*), Bash(supabase:*), Grep, Glob","claude-code, codex, openclaw","main","99825ad3f3bcc6597ddcc7294a14e6e922f2b67b","skills\u002Fsaas-packs--supabase-pack--supabase-reference-architecture",0,"https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills","https:\u002F\u002Fgithub.com\u002Fjukeyman","https:\u002F\u002FRJBUSINESSSOLUTIONS.ORG","Credit and Finance Expert | Developer\r\n\r\nI'm Rick Jefferson, a seasoned credit and finance expert with over a decade of experience in financial literacy,","2026-07-13 07:03:29",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add jukeyman\u002Fjukeyman-skills --skill supabase-reference-architecture",{"tool":51,"command":52},"bunx","bunx skills add jukeyman\u002Fjukeyman-skills --skill supabase-reference-architecture",{"tool":54,"command":55},"pnpm","pnpm dlx skills add jukeyman\u002Fjukeyman-skills --skill supabase-reference-architecture","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fsaas-packs--supabase-pack--supabase-reference-architecture\u002FSKILL.md",true,[],[60,67,74,81,88,96],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M79ANS2SM329NEP5ZCX106RR","zustand-store-creator","Create zustand store creator operations. Auto-activating skill for Frontend Development.\nTriggers on: zustand store creator, zustand store creator\nPart of the Frontend Development skill category. Use when working with zustand store creator functionality. Trigger with phrases like \"zustand store creator\", \"zustand creator\", \"zustand\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzustand-store-creator\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M79AMZKP4YDEZ7EHG1Y7PP74","zero-trust-config-helper","Configure with zero trust config helper operations. Auto-activating skill for Security Advanced.\nTriggers on: zero trust config helper, zero trust config helper\nPart of the Security Advanced skill category. Use when configuring systems or services. Trigger with phrases like \"zero trust config helper\", \"zero helper\", \"zero\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-config-helper\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M79AMJSBCEJQNBTYNAHYN5HM","zapier-integration-helper","Assist with zapier integration helper operations. Auto-activating skill for Business Automation.\nTriggers on: zapier integration helper, zapier integration helper\nPart of the Business Automation skill category. Use when working with APIs or building integrations. Trigger with phrases like \"zapier integration helper\", \"zapier helper\", \"zapier\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzapier-integration-helper\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M79AHJZGVMARS13VFQYRR1MP","yaml-config-validator","Validate yaml config validator operations. Auto-activating skill for DevOps Basics.\nTriggers on: yaml config validator, yaml config validator\nPart of the DevOps Basics skill category. Use when configuring systems or services. Trigger with phrases like \"yaml config validator\", \"yaml validator\", \"yaml\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fyaml-config-validator\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M79AHGDZRN0020RDQSQDPAM8","xvary-stock-research","Thesis-driven equity analysis from public SEC EDGAR and market data; \u002Fanalyze, \u002Fscore, \u002Fcompare workflows with bundled Python tools (Claude Code, Cursor, Codex).","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxvary-stock-research\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M79AHCYJ9FV9RMHQ24HDRN33","xss-vulnerability-scanner","Scan xss vulnerability scanner operations. Auto-activating skill for Security Fundamentals.\nTriggers on: xss vulnerability scanner, xss vulnerability scanner\nPart of the Security Fundamentals skill category. Use when working with xss vulnerability scanner functionality. Trigger with phrases like \"xss vulnerability scanner\", \"xss scanner\", \"xss\".","https:\u002F\u002Fgithub.com\u002Fjukeyman\u002Fjukeyman-skills\u002Fblob\u002Fmain\u002Fskills\u002Fxss-vulnerability-scanner\u002FSKILL.md",[],[]]