#tRPC + supabase with Nextjs
20 messages · Page 1 of 1 (latest)
🔎 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)
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
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,
};
};
use the server one
Thanks for replying, like the client for server component or route handler because both are for the server right?
yes
You can see both the clients at https://supabase.com/docs/guides/auth/server-side/creating-a-client supa docs
you don't need the browser one with trpc
I will be using tRPC on browser too
unless you need to use subscribe the real time change on the table
yes I know
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?
what do you mean?
which client to use in here right?
import { createServerClient } from '@supabase/ssr' this one
Thanks 😊
This question has been marked as answered! If you have any other questions, feel free to create another post
[Click here](#1225413335181299722 message)