Skip to main content

Function: createServerSupabase()

createServerSupabase(): Promise<any>

Defined in: src/db/clients/server.ts:16

Request-scoped Supabase client backed by the auth cookie (RLS applies). Use in Server Components, server actions, and route handlers for user-scoped reads/writes. This is the "user client" of the two-client model (ADR-0004); privileged work uses the service client.

cookies() is async in the Next.js App Router, so this factory is async too. The setAll try/catch tolerates the read-only cookie store inside Server Components (writes there are a no-op; the session is refreshed in middleware instead).

Returns

Promise<any>