© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•13mo ago•
1 reply
Kobaru

Using Supabase in NextJS Server Side

Hi 👋
I have a question concerning how to use Supabase in NextJS env, especially on the server side.
Right now, every time I hit one of my API End Point I end up creating a new supabase client using
import { createClient } from "@supabase/supabase-js"
import { createClient } from "@supabase/supabase-js"

Is this considered ok or a bad practice ?
I know in front it is advised to create only one client and serve it among every components, but is it the same for backend ?
If I should use only one I'm not sure how to "share" this unique client with every end point
route.js
route.js
files
I feel like doing a Promise to init my
createClient
createClient
every time I hit a end point might not be right but I'm not sure.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Using Supabase in NextJS - Security
SupabaseSSupabase / help-and-questions
2y ago
getUser error in supabase-js v2 server side
SupabaseSSupabase / help-and-questions
4y ago
Using Supabase MCP Server in ChatGPT
SupabaseSSupabase / help-and-questions
5mo ago
Is it possible to have both server side auth and client side auth nextjs + supabase
SupabaseSSupabase / help-and-questions
4mo ago