# Nuxt 3 + Supabase: do not use the browser client on the server

The Nuxt Supabase module (or a hand-rolled `@supabase/ssr` setup) gives you a convenient client that works in components. Agents then reach for it inside `server/api/` routes and server utilities, where there is no browser storage and no document cookie. Every request looks logged out, or worse, shares state.

## Checkable procedure

1. In components and composables that run client-side, the standard browser client (`createBrowserClient` from `@supabase/ssr`) is correct.
2. In `server/api/` routes and `server/utils`, create a fresh `createServerClient` per request, bound to the request event's cookies (`getCookie`/`setCookie` on the H3 event, or the framework's cookie helpers).
3. Never import the client-side singleton into `server/` code. If a server route needs the user, build the request-scoped client first, then call `auth.getClaims()`.
4. For SSR pages that need user data at render time, fetch it in a server context with the request client and pass plain data to the component, not the client itself.
5. Cookie names are chunked (`sb-...-auth-token.0`, `.1`) when sessions are large. Your cookie wiring must handle `getAll`/`setAll` arrays, not a single cookie value.

## Quick test

Call a `server/api/me` route with a logged-in session and confirm it returns the right user. Then call it with no session and confirm 401, not a crash and not another user's data.