{
 "kind": "tool",
 "slug": "supabase-ssr",
 "path": "tools/supabase-ssr/",
 "name": "Supabase SSR",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "SDKs for hosted services",
   "tools/service-sdks/"
  ]
 ],
 "lead": "Supabase client library optimized for server-side rendering frameworks.",
 "chips": [
  {
   "label": "SDKs for hosted services",
   "path": "tools/service-sdks/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install @supabase/ssr"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/supabase/ssr"
  },
  {
   "label": "Website",
   "href": "https://github.com/supabase/ssr#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/supabase/ssr"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 19, 2026",
   "note": "Latest GitHub release Sep 8, 2026. ",
   "src": "https://github.com/supabase/ssr"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "286 projects",
   "status": "info",
   "sub": "#2 of 287 in its category",
   "note": "Dependency in 286 public GitHub projects set up for AI coding agents that we scanned (4.6%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://supabase.com/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Supabase SSR does",
   "parts": [
    {
     "t": "prose",
     "text": "Supabase SSR always keeps the Supabase auth session in cookies, which the README calls \"the entire point of the package\", so a server-rendered request reads the same session the browser wrote."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Supabase SSR popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "61",
       "of": "/ 100",
       "l": "Gid Score, #977 overall"
      },
      {
       "n": "14.6M",
       "l": "downloads a week, npm"
      },
      {
       "n": "217",
       "l": "GitHub stars"
      },
      {
       "n": "286",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Supabase SSR is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "Supabase SSR is a dependency in 286 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.9% of the 4,867 JavaScript/TypeScript ones), #2 of 287 in sdks for hosted services.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 564; those are left out of every share on this page.",
      "Projects that use it most often also use Supabase JS (97.9%), Next.js (93.7%), Lucide React (82.9%).",
      "It is more common in projects set up for Roo Code (6.3%) than for OpenCode (2.6%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "147 projects, 4.5%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "135 projects, 5.5%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "133 projects, 4.4%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "20 projects, 4.2%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "18 projects, 3.8%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "16 projects, 5.7%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "9 projects, 2.6%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "7 projects, 6.3%",
       "v": "Roo Code",
       "path": "agents/roo-code/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 97.9% of its projects",
       "v": "Supabase JS",
       "path": "tools/supabase-supabase-js/"
      },
      {
       "l": "In 93.7% of its projects",
       "v": "Next.js",
       "path": "tools/next/"
      },
      {
       "l": "In 82.9% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 75.2% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 75.5% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 96.5% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 96.5% of its projects",
       "v": "Tailwind CSS",
       "path": "tools/tailwindcss/"
      },
      {
       "l": "In 69.6% of its projects",
       "v": "Class Variance Authority",
       "path": "tools/class-variance-authority/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Supabase SSR in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Server and browser read one session",
       "v": "The session lives in cookies, so a server-rendered page sees the same logged-in user as the browser. The README says this is why the package exists."
      },
      {
       "l": "One package instead of four auth-helpers",
       "v": "The maintainers write that the Next.js, React, Remix and SvelteKit auth-helpers are deprecated and \"consolidated into <code>@supabase/ssr</code> for better maintenance and consistency.\""
      },
      {
       "l": "Not tied to one framework",
       "v": "The README's overview describes the package as \"a framework-agnostic way\" to use the Supabase JavaScript library in SSR frameworks."
      },
      {
       "l": "Full React Router middleware recipe",
       "v": "The README gives complete middleware code. It builds the server client with <code>parseCookieHeader</code>, calls <code>getClaims()</code> \"before any route code runs\", and appends each queued cookie as <code>Set-Cookie</code> with <code>serializeCookieHeader</code>."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "auth.storage is ignored",
       "v": "The README says passing <code>auth.storage</code> has no effect, and a one-time console warning is logged. The exception is <code>auth.userStorage</code>, which is still respected when <code>cookies.encode</code> is set to <code>\"tokens-only\"</code>."
      },
      {
       "l": "Wrong choice for browser-only apps",
       "v": "If the server never needs the session, the README points to <code>createClient</code> from <code>@supabase/supabase-js</code> with your own <code>storage</code>. It says there is \"no reason\" to use <code>@supabase/ssr</code> in that case."
      },
      {
       "l": "Racing refreshes can return a null session",
       "v": "Supabase refresh tokens are single-use. If two requests arrive at the same moment with the same expired cookie, such as two tabs opening together, the second refresh fails and that request gets <code>session: null</code>. The README says middleware mitigates this \"for the common case\". Parallel client <code>fetch()</code> calls still need to handle <code>null</code> sessions and retry or re-authenticate."
      }
     ]
    },
    {
     "t": "h3",
     "text": "React Router middleware: refresh the session before any route code runs"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Ts",
       "code": "export const supabaseMiddleware: MiddlewareFunction<Response> = async (\n  { request, context }, next,\n) => {\n  const pendingCookies: PendingCookie[] = [];\n  const pendingHeaders: Record<string, string> = {};\n  const supabase = createServerClient(\n    process.env.SUPABASE_URL!,\n    process.env.SUPABASE_PUBLISHABLE_KEY!,\n    {\n      cookies: {\n        getAll() {\n          return parseCookieHeader(request.headers.get(\"Cookie\") ?? \"\");\n        },\n        setAll(cookiesToSet, headers) {\n          pendingCookies.push(...cookiesToSet);\n          Object.assign(pendingHeaders, headers);\n        },\n      },\n    },\n  );\n  // Trigger lazy session init / refresh before any route code runs.\n  await supabase.auth.getClaims();\n  context.set(supabaseContext, supabase);\n  const response = await next();\n  for (const { name, value, options } of pendingCookies) {\n    response.headers.append(\n      \"Set-Cookie\",\n      serializeCookieHeader(name, value, options),\n    );\n  }\n  for (const [key, value] of Object.entries(pendingHeaders)) {\n    response.headers.set(key, value);\n  }\n  return response;\n};"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Supabase SSR",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/supabase",
        "18 GitHub sponsors"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "@supabase/supabase-js: Core Supabase client",
        "next: React framework",
        "lucide-react: Icon set",
        "clsx: Class name joiner",
        "tailwind-merge: Tailwind class merging",
        "class-variance-authority: Component variants"
       ]
      },
      {
       "title": "More in SDKs for hosted services",
       "path": "tools/service-sdks/",
       "items": [
        {
         "text": "Supabase JS",
         "path": "tools/supabase-supabase-js/"
        },
        {
         "text": "AWS SDK for JavaScript (S3)",
         "path": "tools/aws-sdk-client-s3/"
        },
        {
         "text": "Resend",
         "path": "tools/resend-npm/"
        },
        {
         "text": "Stripe (JavaScript)",
         "path": "tools/stripe-node/"
        },
        {
         "text": "Supabase CLI",
         "path": "tools/supabase-npm/"
        },
        {
         "text": "Firebase",
         "path": "tools/firebase-node/"
        },
        {
         "text": "Stripe.js",
         "path": "tools/stripe-npm/"
        },
        {
         "text": "Google APIs Client Library",
         "path": "tools/googleapis/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Supabase SSR",
       "me": true,
       "facts": [
        "MIT",
        "Gid 61",
        "14.6M/wk"
       ]
      }
     ],
     "more": "Compare Supabase SSR with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install @supabase/ssr"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Supabase SSR\n- Use `@supabase/ssr` only when server code needs the session. For browser-only session handling, use `createClient` from `@supabase/supabase-js` with your own `storage`.\n- Do not add `@supabase/auth-helpers-nextjs`, `-react`, `-remix` or `-sveltekit`. The README lists them as deprecated; depend on `@supabase/ssr` directly.\n- Do not pass `auth.storage` to `createBrowserClient` or `createServerClient`. It has no effect and logs a warning. `auth.userStorage` is respected only when `cookies.encode` is `\"tokens-only\"`.\n- Follow the README's middleware example. Give `createServerClient` a `cookies.getAll` that parses the request's `Cookie` header with `parseCookieHeader`. Add a `cookies.setAll` that queues cookies and headers. Append each queued cookie with `serializeCookieHeader` as `Set-Cookie` and set the queued headers on the response.\n- Refresh the session once per request in middleware with `await supabase.auth.getClaims()` before loaders and actions run.\n- When parallel client requests may race to refresh the same expired token, handle `session: null` and retry or re-authenticate.\n- For choosing between `getSession()`, `getUser()` and `getClaims()`, follow the official guides at https://supabase.com/docs/guides/auth/server-side.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm @supabase/ssr"
  ],
  [
   "Category",
   "SDKs for hosted services"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Latest version",
   "v0.12.7, September 8, 2026"
  ],
  [
   "On GitHub since",
   "May 2024"
  ],
  [
   "Gid Score",
   "60.6"
  ],
  [
   "Rank in category",
   "#2 of 287"
  ],
  [
   "GitHub",
   "supabase/ssr"
  ],
  [
   "Last change",
   "Nov 19, 2026"
  ]
 ],
 "good": [],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/supabase.png"
}