next-forge icon indicating copy to clipboard operation
next-forge copied to clipboard

Add documentation for switching to Supabase

Open dexsnake opened this issue 1 year ago • 4 comments

It would be great to see some documentation on swapping out Clerk and Neon to use Supabase for the auth and database.

dexsnake avatar Nov 12 '24 21:11 dexsnake

I agree, had a few folks ask for this! I contacted the Supabase team on X about working together on it, no reply. Maybe I'll try here.

@kiwicopple @MildTomato @saltcod keen to collab?

haydenbleasel avatar Nov 12 '24 22:11 haydenbleasel

ping @awalias

fmerian avatar Nov 13 '24 13:11 fmerian

@haydenbleasel I have a very similar monorepo setup with Supabase, so I can help with this. A bit short on time now but I'm happy to do it over the next 2 weeks

thedevdavid avatar Nov 14 '24 03:11 thedevdavid

missed the ping @haydenbleasel (I'm quicker on twitter (@saltcod)!) what were you thinking?

saltcod avatar Nov 14 '24 16:11 saltcod

Resolved by #312

haydenbleasel avatar Dec 04 '24 19:12 haydenbleasel

We're open to some more docs on switching Auth, Realtime, etc. Sounds like @sergical is keen to help there.

haydenbleasel avatar Dec 04 '24 19:12 haydenbleasel

Yup, wanted to put auth in at the same time but need some additional functionality to make sure there's feature parody with clerk's organization functionality

sergical avatar Dec 04 '24 19:12 sergical

I'm trying to add supabase auth. Can you elaborate on what additional functionality would be needed?

jorda0mega avatar Dec 26 '24 01:12 jorda0mega

I'm trying to add supabase auth. Can you elaborate on what additional functionality would be needed?

All of Clerk's organization functionality: for example https://github.com/haydenbleasel/next-forge/blob/7efa7572a5faab7c164575613bc063ffdd8809f1/apps/app/app/actions/users/get.ts#L61C27-L61C47

How far are you in the process? would love to help / collaborate!

sergical avatar Dec 26 '24 16:12 sergical

I am now working on mapping the clerk objects like auth, users, organizations, etc. So far I've changed the server, client and middleware to supabase ssr. Would love to collaborate. Would you like to me post a fork with what I have so far?

jorda0mega avatar Dec 26 '24 18:12 jorda0mega

yeah, i'd love to! not sure i have capacity in the next few days but let me know!

there's some realtime stuff as well that can be updated to supabase and obviously the db provider (not sure if you saw the docs for that https://docs.next-forge.com/migrations/database/supabase)

sergical avatar Dec 26 '24 18:12 sergical

yeah I was working off that documentation to change the db provider. I want to use drizzle as well so I was stripping that out for this branch but it should have a WIP https://github.com/jorda0mega/next-forge/tree/supabase-auth/packages/auth

jorda0mega avatar Dec 26 '24 19:12 jorda0mega

so I was playing with this a bit and I think creating a context provider, sign-in and sign-up components inside the auth package might be overkill. I would have to use native html elements (can't import design-system since it would introduce a circular dependency). Moreover, it would require adding props for additional styles similar to how Clerk does it. I think it would be easier to move those to the app package instead to keep it simpler and just expose the createClient functions for client/server instead. Thoughts?

jorda0mega avatar Dec 28 '24 23:12 jorda0mega

I'm easy - but I think that tracks - the consumer (app) should decide how to style the UI for auth (since it can be different for a web client vs native) but the common client can be exposed from auth. although technically the types / client will live in db so not even sure auth is needed 🤷

sergical avatar Dec 29 '24 01:12 sergical