A multi-organization project management database with Row Level Security (RLS) to ensure secure data isolation. Organizations manage their own projects and can share projects or assign tasks across organizations, enabling controlled collaboration while maintaining strict access control.
This repository contains files to setup a Supabase project to recreate the results mentioned in blog. It includes:
- Custom JWT token generation for RLS authorization.
- SQL migration scripts to set up the database schema, extensions, and RLS policies.
- Configuration files for Supabase services.
- Node.js and npm installed
- Supabase account and project
- Supabase CLI installed
- Clone the repository:
git clone https://github.com/antstackio/supabase-rls-optimization-demo.git
cd supabase-rls-optimization-demo
- Install dependencies:
npm install
- Create a
.env
file based on.env.example
and set your JWT secret:
cp .env.example .env
# Edit .env to set your JWT_SECRET
- Generate a JWT token (optional):
npm run gen-token
- Initialize Supabase in your project directory:
supabase init
- Start the Supabase local development environment:
supabase start
Note: If you want to push the changes to your Supabase project, you can refer to the following link: Supabase Documentation
- Use the generated JWT token to authenticate API requests.
- Manage projects, tasks, tenants, and users with secure RLS policies.