timothymiller / t4-app

A powerful cross-platform UI toolkit for building actually native iOS, Android, macOS, Windows, Linux, and Progressive Web Apps with React (Native).
https://t4stack.com
MIT License
1.34k stars 71 forks source link

Add AuthJS support (NextAuth before) besides clerk/supabase. #16

Closed agustif closed 1 year ago

agustif commented 1 year ago

Although I'm happy to use supabase Auth for now, I think it sucks when having to start from templates to have to create SaaS accounts. free tiers can be nice at the start but are at the trap in the long road. (And yes, supabase is still FOSS and you can self-host your own instances if you need to)

Just saw another trpc example twitter clone project using prisma/supabase/next-auth, wondering if we would like this here.

Also would be nice if some of the options for each feature like auth, or else, are modular enough that you can choice from, no idea if there's any other way to do so without mantaining separte branches for them without the burdine that keeping them on sync with master would suppose feature-wise

https://authjs.dev/

The same feature choice could be nice for database/orm as not everyone would be OK using d1/sqlite based stuff for production yet. I for one plan to use prisma/postgres on my own codebase if possible!

timothymiller commented 1 year ago

NextAuth.js is web only, unfortunately.

timothymiller commented 1 year ago

I'm hoping D1 reaches a stable release soon. It's really the best option from a cost and latency point of view.

Prisma is not supported in Cloudflare Workers because it's a chunky boi in terms of bundle size.

agustif commented 1 year ago

NextAuth.js is web only, unfortunately.

Ooops, right, quite the oversight for my part, I assumed it would be by now let's hope some day they get there. Supabase auth works nicely for me and I always can self-host it.

I'm hoping D1 reaches a stable release soon. It's really the best option from a cost and latency point of view.

I will have to try it.

Prisma is not supported in Cloudflare Workers because it's a chunky boi in terms of bundle size.

I might check out using drizzle with pg for my needs, but I'm working alongside another project which already uses pg for now and not sqlite (medusajs, fwiw) and I think It would be best to keep things as simple as possible.

Looking into integrating the supabase auth into a medusa plugin for it to handle the auth of my frontend app built with t4

It's totally fine tho, the modular aspect of the codebase makes it easy to replace any package for whatever you want with your own dependencies, it's a marvel actually how modularly it all fits like lego's or puzzle pieces into ∑hatever you're building

For now I'll try to just re-use as much from medusa for the backend and see if I need more when I reach that.

rickylabs commented 1 year ago

NextAuth.js is web only, unfortunately.

Ooops, right, quite the oversight for my part, I assumed it would be by now let's hope some day they get there. Supabase auth works nicely for me and I always can self-host it.

I'm hoping D1 reaches a stable release soon. It's really the best option from a cost and latency point of view.

I will have to try it.

Prisma is not supported in Cloudflare Workers because it's a chunky boi in terms of bundle size.

I might check out using drizzle with pg for my needs, but I'm working alongside another project which already uses pg for now and not sqlite (medusajs, fwiw) and I think It would be best to keep things as simple as possible.

Looking into integrating the supabase auth into a medusa plugin for it to handle the auth of my frontend app built with t4

It's totally fine tho, the modular aspect of the codebase makes it easy to replace any package for whatever you want with your own dependencies, it's a marvel actually how modularly it all fits like lego's or puzzle pieces into ∑hatever you're building

For now I'll try to just re-use as much from medusa for the backend and see if I need more when I reach that.

We are trying to achieve exactly the same thing with medusa and supabase

We opened a discussion about that back in february (https://github.com/adrien2p/medusa-plugins/discussions/57).

@adrien2p first opened an issue for medusa-plugin-auth (https://github.com/adrien2p/medusa-plugins/issues/58) before closing it a few days ago.

I assume we'll need to implement it ourselves. I'll let you know if I have some time to take care of that, otherwise feel free to share your work I would be happy to help you on that !

adrien2p commented 1 year ago

@rickylabs indeed i wanted to implement it but i only have one request for it and not too much bandwidth, i ve asked multiple time for people if they would be willing to open a pr since i ve done the heavy lifting in the plugin, but nobody has done it so far 😅

agustif commented 1 year ago

Thank you @rickylabs I wasn't aware of this, happy to chat and share notes we'll be looking to implement this.

@rickylabs indeed i wanted to implement it but i only have one request for it and not too much bandwidth, i ve asked multiple time for people if they would be willing to open a pr since i ve done the heavy lifting in the plugin, but nobody has done it so far 😅

Hi Adrien I had not seen that, I'd be happy to open a PR myself and get any guidance from you we might need to get it merged.

It didn't occur to me that it might be already working on it

rickylabs commented 1 year ago

@rickylabs indeed i wanted to implement it but i only have one request for it and not too much bandwidth, i ve asked multiple time for people if they would be willing to open a pr since i ve done the heavy lifting in the plugin, but nobody has done it so far 😅

I totally understand, that's why I'm trying to put everyone in the same loop so we can manage together to implement it someday because I'm sure there are a lot of people that could benefit from it.

@agustif I'll keep you posted directly into @adrien2p issue.

@adrien2p any guidance on how we could start that implementation with your plugin ?

agustif commented 1 year ago

@rickylabs indeed i wanted to implement it but i only have one request for it and not too much bandwidth, i ve asked multiple time for people if they would be willing to open a pr since i ve done the heavy lifting in the plugin, but nobody has done it so far 😅

I totally understand, that's why I'm trying to put everyone in the same loop so we can manage together to implement it someday because I'm sure there are a lot of people that could benefit from it.

@agustif I'll keep you posted directly into @adrien2p issue.

@adrien2p any guidance on how we could start that implementation with your plugin ?

Thanks Ricky, appreciate you putting me in the radar of it, I will be trying to do this in an open repo, The plan is to copy the implementation for auth0 and go from there, adding one of the available passport-jwt npm packages for it.

I already spoke with Adrien and he advised me so, so we could probably collaborate on this if you're up for it. I'll try to push a starting PR today to my own for of medusa-plugins and we can see from there

PS: Added my email on my GH bio in case you want to reach.

Very much WIP haven't finished or tested it yet: https://github.com/agustif/medusa-plugins/tree/feat-supabase-auth

timothymiller commented 1 year ago

NextAuth.js is web only, unfortunately.

Ooops, right, quite the oversight for my part, I assumed it would be by now let's hope some day they get there. Supabase auth works nicely for me and I always can self-host it.

I'm hoping D1 reaches a stable release soon. It's really the best option from a cost and latency point of view.

I will have to try it.

Prisma is not supported in Cloudflare Workers because it's a chunky boi in terms of bundle size.

I might check out using drizzle with pg for my needs, but I'm working alongside another project which already uses pg for now and not sqlite (medusajs, fwiw) and I think It would be best to keep things as simple as possible.

Looking into integrating the supabase auth into a medusa plugin for it to handle the auth of my frontend app built with t4

It's totally fine tho, the modular aspect of the codebase makes it easy to replace any package for whatever you want with your own dependencies, it's a marvel actually how modularly it all fits like lego's or puzzle pieces into ∑hatever you're building

For now I'll try to just re-use as much from medusa for the backend and see if I need more when I reach that.

Are you making an ecommerce app with medusa backend and t4-app frontend?

agustif commented 1 year ago

NextAuth.js is web only, unfortunately.

Ooops, right, quite the oversight for my part, I assumed it would be by now let's hope some day they get there. Supabase auth works nicely for me and I always can self-host it.

I'm hoping D1 reaches a stable release soon. It's really the best option from a cost and latency point of view.

I will have to try it.

Prisma is not supported in Cloudflare Workers because it's a chunky boi in terms of bundle size.

I might check out using drizzle with pg for my needs, but I'm working alongside another project which already uses pg for now and not sqlite (medusajs, fwiw) and I think It would be best to keep things as simple as possible. Looking into integrating the supabase auth into a medusa plugin for it to handle the auth of my frontend app built with t4 It's totally fine tho, the modular aspect of the codebase makes it easy to replace any package for whatever you want with your own dependencies, it's a marvel actually how modularly it all fits like lego's or puzzle pieces into ∑hatever you're building For now I'll try to just re-use as much from medusa for the backend and see if I need more when I reach that.

Are you making an ecommerce app with medusa backend and t4-app frontend?

Yes, that's what I'm trying to do, looking into adding a supabase adapter to the medusa-plugin-auth repo to share auth between backend and frontend

timothymiller commented 1 year ago

I've added an FAQ page answering the main questions from this thread.

For additional discussion on medusa and supabase, feel free to open a thread in the Discord server.

Boscop commented 11 months ago

What about https://lucia-auth.com ? They also have adapters for D1 etc.