Logo

dev-resources.site

for different kinds of informations.

Custom schema specific Supabase Client Component clients in Grida Form workspace

Published at
12/31/2024
Categories
opensource
nextjs
supabase
grida
Author
ramunarasinga-11
Categories
4 categories in total
opensource
open
nextjs
open
supabase
open
grida
open
Author
16 person written this
ramunarasinga-11
open
Custom schema specific Supabase Client Component clients in Grida Form workspace

In this article, we will review the Supabase Client Component clients in Grida Form workspace. In case you are wondering what a Supabase Client Component client is, Read the Supabase docs.

Client Component client — To access Supabase from Client Components, which run in the browser.

In the lib/supabase/client.ts, you have multiple clients defined depending on the schema.

Image description

Client Component

createClientFormsClient

You will find the below code at line 4

export const createClientFormsClient = () =>
  createClientComponentClient<Database, "grida_forms">({
    options: {
      db: {
        schema: "grida_forms",
      },
    },
  });
Enter fullscreen mode Exit fullscreen mode

createClientCommerceClient

You will find the below code at line 13

export const createClientCommerceClient = () =>
  createClientComponentClient<Database, "grida_commerce">({
    options: {
      db: {
        schema: "grida_commerce",
      },
    },
    isSingleton: false,
  });
Enter fullscreen mode Exit fullscreen mode

createClientWorkspaceClient

You will find the below code at line 23.

export const createClientWorkspaceClient = () =>
  createClientComponentClient<Database, "public">({
    options: {
      db: {
        schema: "public",
      },
    },
    isSingleton: false,
  });
Enter fullscreen mode Exit fullscreen mode

createClientComponentClient is imported from as shown below @supabase/auth-helpers-nextjs:

import { createClientComponentClient } from "@supabase/auth-helpers-nextjs";
Enter fullscreen mode Exit fullscreen mode

@supabase/auth-helpers-nextjs

You will find this package on npm registry — https://www.npmjs.com/package/@supabase/auth-helpers-nextjs

This below note is from npm registry:

This package is now deprecated — please use the @supabase/ssr *package instead.

There is also [legacy documentation]([*https://supabase.com/docs/guides/auth/auth-helpers/nextjs](https://supabase.com/docs/guides/auth/auth-helpers/nextjs)*), showing

a usage example.*

API changes over time, You have to accommodate these changes by bumping the dependency package and updating the relevant API. In this case, I would make a major release in my project that involves migration to @supabase/ssr instead of @supabase/auth-helpers-nextjs as this is deprecated, but I wouldn’t rush though unless it is breaking production, otherwise I would rather have some more updates along with

this version bump.

About me:

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.

I am open to work on interesting projects. Send me an email at [email protected]

My Github — https://github.com/ramu-narasinga

My website — https://ramunarasinga.com

My Youtube channel — https://www.youtube.com/@thinkthroo

Learning platform — https://thinkthroo.com

Codebase Architecture — https://app.thinkthroo.com/architecture

Best practices — https://app.thinkthroo.com/best-practices

Production-grade projects — https://app.thinkthroo.com/production-grade-projects

References

  1. https://supabase.com/docs/guides/api/using-custom-schemas

  2. https://github.com/orgs/supabase/discussions/21511

  3. https://supabase.com/docs/guides/auth/auth-helpers/nextjs

  4. https://www.npmjs.com/package/@supabase/auth-helpers-nextjs

  5. https://github.com/gridaco/grida/blob/main/apps/forms/lib/supabase/client.ts

  6. https://supabase.com/docs/guides/auth/server-side/nextjs?queryGroups=router&router=app

supabase Article's
30 articles in total
Favicon
Building Production-Grade Web Applications with Supabase – Part 1
Favicon
Tracing and Metrics in supabase/storage
Favicon
Understanding Storage backends in supabase/storage
Favicon
Auth in Supabase storage
Favicon
Overview of supabase storage repository
Favicon
Harnessing the Power of Self-Hosted Supabase on Coolify: A Complete Guide to Server Setup and OAuth Providers Integration
Favicon
checa como se hace una conexión entre nextjs y la autenticación de supabase
Favicon
Deploying an Existing Express API + Prisma + Supabase Project to Vercel
Favicon
Custom schema specific Supabase Server Component clients in Grida Form workspace
Favicon
Custom schema specific Supabase Client Component clients in Grida Form workspace
Favicon
Introducing Supabase Client Playground: The Ultimate Tool for Streamlined Query Testing
Favicon
hCaptcha, a bot detection tool, usage in Supabase and Chatwoot
Favicon
Securing Client-Side Routes in Next.js with Supabase
Favicon
How to Transfer PostgreSQL Database from Local to Supabase on macOS
Favicon
Supabase | My Way of Designing & Managing DB
Favicon
What does Supabase use for its Authentication?
Favicon
É seguro guardar dados do usuário no localStorage?
Favicon
Supabase RLS Alternative
Favicon
Build Queue Worker using Supabase Cron, Queue and Edge Function
Favicon
Supabase Just Got More Powerful: Queue, Cron, and Background Tasks in Edge Functions
Favicon
Comparison of the middleware implementation between Supabase Auth documentation and the nextjs-stripe-supabase.
Favicon
How Supabase implemented micro-frontends using Multi Zones in Next.js
Favicon
Unlocking User Data: Building a Secure Supabase Edge Function
Favicon
Usecase: TumbleLog
Favicon
Supabase Edge Functions
Favicon
Setup Astro With Supabase and Prisma
Favicon
We launched SupaCharts! Visualize Beautiful Charts from your Supabase Data.
Favicon
A Free Minimalistic SaaS Starter Kit for Fast MVP Building
Favicon
supabase注册并创建项目和添加数据表
Favicon
Integrating GitHub Authentication with NextAuth.js: A Step-by-Step Guide

Featured ones: