prisma-next-supabase

Integrate Prisma Next with Supabase for role-bound database access and row-level security.

47.5k|2.5k|Updated Jun 20, 2019
One-click install
npx skills add https://github.com/prisma/prisma --skill prisma-next-supabase
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prisma-next-supabase
Source: https://github.com/prisma/prisma/tree/main/skills/prisma-next-supabase
Command: npx skills add https://github.com/prisma/prisma --skill prisma-next-supabase

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the complexity of bridging Prisma Next with Supabase by managing cross-space foreign keys, enforcing row-level security (RLS) policies, and handling role-bound database connections.

Core Features & Use Cases

  • Role-Bound Querying: Safely execute database operations using specific Supabase roles like anon, authenticated, or service_role.
  • RLS Policy Management: Author and maintain row-level security policies directly within your Prisma contract.
  • Cross-Space Integration: Seamlessly reference Supabase-owned tables like auth.users while keeping your own application data managed and secure.

Quick Start

Initialize the supabase extension in your prisma-next configuration and bind your database queries to a specific user role to enforce row-level security.

Frequently Asked Questions about prisma-next-supabase

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce Supabase row-level security with Prisma?

You can enforce Supabase row-level security with Prisma by binding per-request database queries to specific Supabase roles like anon, authenticated, or service_role. This approach validates JWT-based authentication and ensures role-bound access control for production-grade interactions.

Can I reference Supabase auth.users from my Prisma schema?

Yes, you can reference Supabase auth.users from your Prisma schema using cross-space foreign key relationships. This integration allows your application models to seamlessly reference Supabase-internal schemas like auth and storage while keeping your application data managed securely.

What is the best way to handle per-request role binding in a TypeScript database application?

The best way to handle per-request role binding in a TypeScript database application is to configure your database client to dynamically switch between Supabase roles. This enforces row-level security policies based on the authenticated user context for each specific request.

How do I author and maintain row-level security policies within my Prisma contract?

You author and maintain row-level security policies within your Prisma contract by initializing the Supabase extension in your configuration. This enables you to define RLS policies directly alongside your application models for secure, role-bound querying.

Does Prisma work with Supabase JWT authentication for database access?

Yes, Prisma works with Supabase JWT authentication by validating JWT tokens to establish per-request role binding. This mechanism ensures that database operations execute with the correct row-level security enforcement for authenticated users.