supabase-enterprise-rbac

Installation
SKILL.md

Supabase Enterprise RBAC

Overview

Supabase supports custom role-based access control (RBAC) by storing role information in app_metadata on the user's JWT, then reading those claims in RLS policies via auth.jwt() ->> 'role'. This skill implements a complete RBAC system: roles in app_metadata, RLS policies that enforce role hierarchies, organization-scoped access, role management through the Admin API, and API endpoints protected with role checks — all using real createClient from @supabase/supabase-js.

When to use: Building multi-role applications (admin/editor/viewer), implementing organization-scoped access, creating custom permission systems beyond Supabase's built-in anon/authenticated roles, or scoping API operations by user role.

Prerequisites

  • @supabase/supabase-js v2+ with service role key for admin operations
  • Understanding of JWT claims and Supabase's auth.jwt() SQL function
  • Database access via SQL Editor or psql for RLS policy creation
  • Supabase project with authentication configured

Instructions

The workflow has three steps: assign roles into the JWT, enforce them in the database with RLS, then enforce them again in application code.

Step 1: Define Roles via app_metadata and JWT Claims

Installs
37
GitHub Stars
2.7K
First Seen
Jan 24, 2026
supabase-enterprise-rbac — jeremylongshore/tons-of-skills-marketplace