Use NextAuth as a microservice

Hello guys, For a project I've decided to use a microservice architecture and I want to deploy a "nextauth API". I don't know if it's possible and I don't want to spend toomuch time in implementing it, if it's not possible. Thanks to those who will take time to anwser !
18 Replies
muddmaker
muddmaker17mo ago
The short answer is that the purpose of NextAuth is to run as part of your application, and not as a separate service. If you want to run authentication on a separate service, oauth2-proxy[1] is what you'll want to use. The T3 stack is not really designed around microservices. [1]: https://oauth2-proxy.github.io/oauth2-proxy/ May I ask why you wanted to use a microservice architecture?
hugolepot
hugolepot17mo ago
Ok that's what I taught 😦 i'll check oauth2-proxy Thank's for your anwser Using a microservice architecture was mandatory for a school project and since i already used the T3 Stack in the past, i wanted to use it for this project 👍
lanc3
lanc317mo ago
t3 is probably overkill for any school project. Maybe just use java?
muddmaker
muddmaker17mo ago
Why would t3 be overkill? It's probably best suited for school projects and prototypes because of the fast iteration times it enables. A microservice architecture is what is probably overkill, but if it's mandatory... Just make sure you use some of the --pass-* configs so that your API knows who is calling it You might still be able to get away with using Next.js, TailwindCSS and even tRPC. Using a microservice architecture might also change the way you store your data, which could make Prisma unusable
lanc3
lanc317mo ago
T3 too complex and niche to work with other typical CS students, no? Just assuming since my experience is that most projects are group based. But hey if it's an individual project I don't see a problem with it either.
hugolepot
hugolepot17mo ago
Yes microservice architecture IS overkill but since the project is cloning uber eats, we need to use a scalable architecture
muddmaker
muddmaker17mo ago
Did they specifically require you to use microservices, or did they just require you to make it "scalable"? Because microservices != scalability
hugolepot
hugolepot17mo ago
Microservice
muddmaker
muddmaker17mo ago
Ok
hugolepot
hugolepot17mo ago
It was in the specifications
muddmaker
muddmaker17mo ago
Did it give requirements for how many microservices need to be used?
hugolepot
hugolepot17mo ago
No not exactly because we need to be able to start new microservices from a back office I agree with you too guys. Knowing the basics is really important but I already did several projects with those languages to really understand things work. But here the goal of the project is to be at the end of the month as close as possible to a ubereats clone so winning time on API developpement is a must
muddmaker
muddmaker17mo ago
So an idea for the architecture could be that you still use Next.js+Tailwind+tRPC for the frontend and API service, and then oauth2-proxy for the auth, but then instead of then connecting that API service directly to a DB, you can then create an assortment of microservices behind that And those can be written in Go
hugolepot
hugolepot17mo ago
There are also other specifications like doing a load balancer manually and an api gatway that will redirect all the calls to the correct APIs Specifications also Say only ts
muddmaker
muddmaker17mo ago
Oh, ok
hugolepot
hugolepot17mo ago
But I understand your points when saying that we should the language that fit the most with the need
muddmaker
muddmaker17mo ago
If everything is going to be TypeScript, you could actually write your various microservices using tRPC+Express And use that to get them to talk to each other Unless it also specifies that they need to be REST or GraphQL or something like that
hugolepot
hugolepot17mo ago
That's what I did No it's as we want they just said APIs haha "modern" yess ...
Want results from more Discord servers?
Add your server