#tRPC + supabase with Nextjs

20 messages · Page 1 of 1 (latest)

limber stirrup
#

"I'm seeking assistance in integrating Supabase with tRPC and the Next.js app router. Any guidance on this matter would be greatly appreciated."

scenic egretBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

lunar reefBOT
# limber stirrup "I'm seeking assistance in integrating Supabase with tRPC and the Next.js app ro...
Please add more information to your question

Your question currently does not have sufficient information for people to be able to help. Please add more information to help us help you, for example: relevant code snippets, a reproduction repository, and/or more detailed error messages. See more info on how to ask a good question in https://discord.com/channels/752553802359505017/1138338531983491154 and #welcome message

limber stirrup
#

Like to use supabase i need to create a supabaseClient, which depends which type of client you need to create like for client component , server component , route handler https://supabase.com/docs/guides/auth/server-side/creating-a-client. so i am confused which client should be createad so that i can add supabaseClient to my tRPC context

#
export const createTRPCContext = async (opts: {
  headers: Headers;
  cookieStore: ReadonlyRequestCookies;
}) => {
  const supabase = serverClient(opts.cookieStore); // which supabase client to use

  return {
    db,
    ...opts,
    supabase,
  };
};
limber stirrup
limber stirrup
jovial shore
#

you don't need the browser one with trpc

limber stirrup
#

I will be using tRPC on browser too

jovial shore
#

unless you need to use subscribe the real time change on the table

jovial shore
limber stirrup
#

Like I'll be using the tRPC server client to query data from a react server component.

#

So should I go with the supabase route handler client and add it to my context?

jovial shore
#

import { createServerClient } from '@supabase/ssr' this one

limber stirrup
#

Thanks 😊

scenic egretBOT
#
✅ Success!

This question has been marked as answered! If you have any other questions, feel free to create another post

Jump to answer