Also known as: supabase-ssr, Supabase SSR package
Definition
@supabase/ssr is the official Supabase package for server-side authentication in Next.js, SvelteKit, and other SSR frameworks. It manages JWT storage in httpOnly cookies, handles the OAuth and magic-link callback cookie writes, and exposes createServerClient and createBrowserClient helpers for each context.
@supabase/ssr is the Supabase JS library's server-side rendering companion. It replaced the older @supabase/auth-helpers-nextjs package in 2024. The library exposes two factory functions: createServerClient for Server Components, Server Actions, and Route Handlers, and createBrowserClient for Client Components.
Cookie management across the server-client boundary. When a user authenticates, the session JWT must land in an httpOnly cookie that the server can read on the next request. The package handles the cookie write on the server side (where cookies() from next/headers is available) and provides matching read APIs that work in both Server Components and middleware/proxy.
httpOnly cookies cannot be read by inline JavaScript, so an XSS bug cannot exfiltrate the session token. The older pattern of storing the JWT in localStorage made every XSS a session-theft incident. The PKCE flow that the library uses by default also prevents authorization-code interception in OAuth and magic-link flows.