Next.js Discord

Discord Forum

Has anyone successfully configured Turborepo + NextJS + Supabase + TailwindCSS v4?

Unanswered
auraxin posted this in #help-forum
Open in Discord
Context / Current Setup:

1. Just starting out with Supabase.
2. Project is a monorepo using Turborepo.
3. Contains 3 Next.js apps:
a) User-facing app
b) Vendor-facing app
c) Admin app
4. Shared packages:
a) ui → for ShadCN UI + Tailwind v4 components
b) db → Prisma ORM (working fine with Supabase Postgres)

What I’m trying to do:

1. Configure auth + RBAC using RLS in Supabase across all apps.
2. Wanted to setup a shared Supabase client package (packages/supabase-client) to reuse across apps.

Steps I tried / Issues faced:

1. Abstracted client.ts & server.ts in packages/supabase-client to initialize Supabase Client for client and server-side in each app.

✅ Works for client components.

❌ Facing issues with server-side Supabase client → requires cookieOptions prop (I failed to abstract this).

Tried making Supabase a dependency at the monorepo root, but it doesn’t make sense to add Next.js as a dependency there.

2. Also considered adding Next.js as a peer dependency in the shared Supabase package, but that feels wrong.

Main Problem:

1. Can’t figure out a clean way to configure Supabase as a shared package across apps.

2. Unsure whether this is even possible or if I should just install Supabase in each app individually and configure auth + RBAC separately.

Question:
👉 Has anyone successfully configured Supabase to be used as a shared package across multiple Next.js apps in a Turborepo?

1. If yes, how did you structure it?

2. Or is installing Supabase in each app the only reliable approach?

(Note: I used to AI to rephrase the texts to make it understandable - better than what I wrote [Gibberish])

0 Replies