published fresh until

Next.js and Supabase: how do I build an admin panel with roles?

Summary When you need a role-based Next.js and Supabase admin area, enforce roles on the server and audit RLS so users cannot call admin actions directly. Role claims and an audit log have no tested answer yet.

Not for a data table with filters and CSV export, see case-expense-table-nextjs-supabase-filters-sort-csv-export; paid plans and billing, see case-subscription-billing-page-nextjs-stripe-webhooks

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The case

An internal or customer-facing admin area where different roles may view, edit or delete different records. Success looks like: logged-out visitors get nothing, a normal user cannot call an admin action directly, role is decided on the server, and someone can later see who changed what. Stack: Next.js + Supabase/Postgres.

This is a map, not new advice: every row points to an existing WhatWorks thread. Nobody here ran this whole build; the Status column says what each linked thread rests on. "Tried" would need a linked trial report, and none of the linked threads has one yet.

Parts, in the order people do them

PartWhat to useStatusLink
Check the panel is not open to everyoneTest logged out; enforce roles in the backend, not hidden buttonsUntried: community post or suggestion only, no linked trialHow do I know my AI-built admin panel is not open to everyone?
Stop users granting themselves a roleServer-side checks on role and plan fieldsUntried: community post or suggestion only, no linked trialCan my users give themselves the paid plan or admin role?
Row-level security rulesSupabase RLS checklist and advisor lintsDocumented: vendor or primary source, not tried (no linked trial)How do I check my agent-built Supabase app's RLS before launch?, What does Supabase's Security Advisor flag and how do I fix it?
Prove one role cannot read another's dataCross-tenant and cross-role testsUntried: community post or suggestion only, no linked trialHow do I prove one tenant can't read another's data in Supabase?
Admin framework or hand-builtreact-admin versus Refine, roles and audit log (free or paid)Documented: vendor or primary source, not tried (no linked trial)Which admin framework gives me roles and an audit log without paying?
User and record tablesshadcn data table on TanStack TableDocumented: vendor or primary source, not tried (no linked trial)How do I build a data table with sorting and filters using shadcn?
Role claims in the Supabase JWTNo tested answer yetNo tested answer yetnone (see open request)
Audit log table (who changed what)No tested answer yetNo tested answer yetnone (see open request)

Where it breaks

Open questions

  • Parts marked "No tested answer yet" are gaps in WhatWorks; ask for them with the request tool so an editor can look: role claims, audit log.

Status key

Documented: the linked thread cites official docs or a vendor source and was not run. Untried: the linked thread rests on a community post or on suggestions, not run. Tried: needs a linked trial report (none yet).

As of October 2026. Not for: a data table with filters and CSV export, see case-expense-table-nextjs-supabase-filters-sort-csv-export; paid plans and billing, see case-subscription-billing-page-nextjs-stripe-webhooks; stopping bulk scraping, see stop-logged-in-users-scraping-supabase-table-edge-function.

Started from a post by @WhatWorks editors, packaged by the editor.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Next.js and Supabase: how do I build an admin panel with roles?
Summary: When you need a role-based Next.js and Supabase admin area, enforce roles on the server and audit RLS so users cannot call admin actions directly. Role claims and an audit log have no tested answer yet.
Copy for agent
get the whatworks thread case-admin-panel-roles-nextjs-supabase-who-can-see-what and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread case-admin-panel-roles-nextjs-supabase-who-can-see-what
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp