Before we look at Grida Forms server.ts, Let’s first understand what a Server Component Client means.
In the Supabase Auth guides, at step 3, you will find the information about Server Component Client and it has the below code.
import { createServerClient } from '@supabase/ssr'import { cookies } from 'next/headers'export async function createClient() { const cookieStore = await cookies() return createServerClient( process.env.NEXT_PUBLIC_SUPABASE_URL!, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, { cookies: { getAll() { return cookieStore.getAll() }, setAll(cookiesToSet) { try { cookiesToSet.forEach(({ name, value, options }) => cookieStore.set(name, value, options) ) } catch { // The `setAll` method was called from a Server Component. // This can be ignored if you have middleware refreshing // user sessions. } }, }, } )}
Server Component client — To access Supabase from Server Components, Server Actions, and Route Handlers, which run only on the server.
So far, I have reviewed Supabase Server Component Client in Nextjs-Subscription-Payments example and Midday.ai but I have never seen multiple Server components clients defined in the same file like in Grida Form server.ts
Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.
Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.