What is the best way to self host better-auth to use across microservices?

I would like to create an Auth0 alternative for my webapp and the microservices that sit behind it. This requires a lot of authN integration with a bunch of services, and the session management and OAuth stuff etc. from the Vercel webapp in the front-end app. What is the best approach to achieve this. Is it to host a separate auth service that runs better-auth with a prisma DB using express or fastify? What would I do for the other services, how can I leverage the betterAuth({}) client to use in my clients across the list of services I have?
5 Replies
lonelyplanet
lonelyplanet22h ago
@8_Stackz Check out https://discord.com/channels/1288403910284935179/1343928330046410835 They had a similar idea but instead of a email password they wanted to use aws cognito
lonelyplanet
lonelyplanet22h ago
Or if you are happy using something else checkout https://github.com/stack-auth/stack-auth
GitHub
GitHub - stack-auth/stack-auth: Open-source Auth0/Clerk alternative
Open-source Auth0/Clerk alternative. Contribute to stack-auth/stack-auth development by creating an account on GitHub.
lonelyplanet
lonelyplanet22h ago
A Open Source OAuth Alternative basically what you want except doesn't use betterauth
8_Stackz
8_StackzOP12h ago
What are the differences between Auth0 and better-auth explicitly? Is there no way to drop better-auth in as a direct replacement? From the documentation that's what I gathered the idea would be.
bekacru
bekacru8h ago
there shouldn't be a significant difference from the noraml setup. You can use better auth in your main backend service and allow other services to authenticate with it. You can always check out jwt plugin for authenticating using jwks and bearer plugin if you can't use cookies

Did you find this page helpful?