header-langage
简体中文
繁體中文
English
Tiếng Việt
한국어
日本語
ภาษาไทย
Türkçe
Scan to Download the APP

Supabase launches @supabase/server to simplify SSR authentication boilerplate

According to Dongcha Beating monitoring, Supabase has released the npm package @supabase/server, version 0.1.4, under the MIT license. This package consolidates server-side rendering, API routes, Supabase client creation in edge function scenarios, cookie synchronization, and authentication session maintenance, eliminating the need for developers to do it themselves.

In terms of usage, it provides a higher-order function called withSupabase. Developers can provide an access policy (in the example, allow: 'user' is used to only allow logged-in users) to the function. The resulting handler function will attach the configured Supabase client to ctx.supabase, allowing the business logic to directly query the database using ctx.supabase.from('todos').select().

When announcing the news on X, Supabase co-founder Paul Copplestone mentioned that this is an early version and is currently seeking testers and feedback. The team is also working on adapters for various frameworks.

Prior to this, integrating Supabase in SSR frameworks like Next.js required developers to write code for cookie retrieval, session refreshing, and client-side passing, which has long been a pain point in the community.

举报 Correction/Report
Correction/Report
Submit
Add Library
Visible to myself only
Public
Save
Choose Library
Add Library
Cancel
Finish