@supabase/ssr

The official framework-agnostic Supabase client for server-side rendering apps, handling cookie-based auth sessions.

SDK
npm
v0.12.7
208 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
83 /100 Excellent
Development Activity 84
Maintenance 100
Community 72
Maturity 48
Momentum 28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
80 /100 Excellent
Architecture 82
Code Quality 88
Innovation 72
Learning Curve 78

@supabase/ssr is Supabase’s official package for using the Supabase JavaScript client inside server-side rendering (SSR) frameworks — Next.js, Remix, SvelteKit, and others — where auth state has to travel through cookies instead of just browser storage. It replaces the older, framework-specific @supabase/auth-helpers-* packages (auth-helpers-nextjs, auth-helpers-react, auth-helpers-remix, auth-helpers-sveltekit), which have all been deprecated and consolidated into this single, framework-agnostic library.

The package exposes createBrowserClient() and createServerClient(), plus cookie-handling utilities that correctly read, write, and refresh Supabase session cookies across server components, middleware, and route handlers. It documents real edge cases up front — like concurrent requests racing to refresh the same single-use refresh token — and recommends patterns (e.g. refreshing sessions once per navigation in middleware) to avoid them.

What You Get

  • createServerClient() and createBrowserClient() functions that wrap @supabase/supabase-js with cookie-aware session handling
  • Cookie read/write/refresh utilities (cookies.ts) that keep auth sessions in sync between server and browser
  • clearAuthCookiesAtScopes() for correctly clearing session cookies across scopes on sign-out
  • Framework-agnostic design that replaces the deprecated auth-helpers-nextjs/react/remix/sveltekit packages with one library
  • Documented guidance on known limitations, like concurrent-request races against single-use refresh tokens

Common Use Cases

  • Reading and refreshing a Supabase auth session in Next.js middleware, server components, and route handlers
  • Migrating an app off a deprecated @supabase/auth-helpers-* package onto the consolidated, actively maintained client
  • Implementing cookie-based auth in Remix or SvelteKit apps that talk to Supabase
  • Keeping browser and server Supabase clients in sync so a user’s session persists correctly across navigations

Under The Hood

Architecture — The package centers on two entry points: createServerClient.ts (199 lines) for server-side contexts, which wires cookie get/set/remove callbacks into a @supabase/supabase-js client instance, and createBrowserClient.ts (153 lines) for the browser equivalent. Shared cookie-parsing/serialization logic lives in cookies.ts (600 lines), the largest source file, which handles Supabase’s chunked-cookie format (session data that exceeds a single cookie’s size limit gets split across multiple cookies) and cross-scope cookie clearing via clearAuthCookiesAtScopes.ts.

Tech Stack — TypeScript throughout, built on top of @supabase/supabase-js as its core dependency, with Vitest for testing and tsc for dual CJS/ESM builds (dist/main and dist/module). No framework-specific dependencies — the framework-agnostic design is a real architectural constraint, not just marketing.

Code Quality — Test coverage is unusually strong for a library this size: cookies.spec.ts alone is 1,704 lines against 600 lines of implementation, and createServerClient.spec.ts/createBrowserClient.spec.ts closely mirror their respective source files line-for-line in scope. TypeScript types are exported explicitly via types.ts, and a warnDeprecatedPackage.ts module proactively nudges users still on the old auth-helpers packages.

API Design — The two-function surface (createServerClient, createBrowserClient) is deliberately minimal and mirrors the shape of supabase-js’s own createClient(), so migrating from the deprecated packages is largely a matter of swapping the import and wiring cookies. The README is candid about a real limitation (concurrent refresh-token races) rather than glossing over it, and documents the middleware-based mitigation — a level of honesty about edge cases that’s uncommon and genuinely useful for integrators.

Used by 13 apps in this directory

TypeScript
54%
MIT

Anarlog

AI Assistants · Note Taking · Productivity

9,404

Anarlog is an open-source, local-first AI meeting notetaker that records, transcribes, and summarizes meetings entirely on your device — no cloud lock-in, no mandatory account, and every note saved as a plain markdown file you own forever.

View details
86
Repo Health
77
Technical
68
Dependency
Built with
TypeScript 54%
Rust 34%
Updated 4 days ago
Python
66%
Other

AutoGPT

AI Assistants · Automation · Productivity

187,596

Build, deploy, and run autonomous AI agents that automate complex multi-step workflows using a visual block-based graph editor.

View details
93
Repo Health
78
Technical
66
Dependency
Built with
Python 66%
TypeScript 33%
Updated 4 days ago
TypeScript
100%
AGPL 3.0

BaseBuddy

CMS

7

A self-hosted content editor for existing Postgres or Supabase schemas — maps the tables you already have into a WordPress-like TipTap editor instead of requiring you to reshape your database around a CMS.

View details
31
Repo Health
64
Technical
73
Dependency
Built with
TypeScript 100%
Updated 1 months ago
TypeScript
96%

Finance

AI Assistants · Invoicing Finance

903

Bloomberg-grade financial data and AI-powered analysis through a conversational chat interface you can self-host.

View details
54
Repo Health
62
Technical
70
Dependency
Built with
TypeScript 96%
Updated 3 weeks ago
TypeScript
99%
AGPL 3.0

fountain-ink

Blogging

64

A self-hostable, decentralized blogging platform built on Lens Protocol — own your content, audience, and distribution forever.

View details
26
Repo Health
66
Technical
63
Dependency
Built with
TypeScript 99%
Updated 7 months ago
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

15,042

All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.

View details
53
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 3 months ago
TypeScript
99%
Apache 2.0

Onlook

AI Design Tools · Design Tools

26,820

An open-source, AI-first visual editor that lets designers and developers build, style, and deploy React apps directly in code — no handoff required.

View details
65
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 99%
Updated 1 months ago
TypeScript
96%

Open Scouts

AI Agents · Automation

1,372

Create automated AI scouts that continuously search the web and send email alerts when they find what you're looking for.

View details
34
Repo Health
65
Technical
69
Dependency
Built with
TypeScript 96%
Updated 4 months ago
TypeScript
89%
MIT

Plasmic

CMS · Design Tools · Low Code Platforms

7,048

The open-source visual builder that lets teams design React apps and websites with drag-and-drop while integrating seamlessly with your codebase.

View details
81
Repo Health
78
Technical
64
Dependency
Built with
TypeScript 89%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers