Documentation menu

Database Schema

anymrkt uses Supabase Postgres with RLS enabled on all tables (deny-by-default). Migrations live in supabase/migrations/ — never edit supabase-schema.sql directly after setup.

RLS identity convention

Critical:

This app runs NextAuth v5 with the Supabase adapter, not Supabase Auth. Therefore RLS policies must use next_auth.uid(), never auth.uid(). The auth.uid() function is always NULL here and a policy using it denies rather than permits. Role checks use is_operator(), never auth.jwt() -> 'role'.

Key tables

TablePurpose
profilesUser profiles; role column (buyer, seller_pending, seller_active, operator).
brandsMarketplace brands; multi-tenant scoping.
mcp_tokensMCP bearer tokens; includes tool_filters JSONB column.
mcp_operationsAudit log for every MCP tool call.
listingsProduct listings on the marketplace.
builder_pagesBuilder pages with standalone flag for export.