The UntraceableT
Convex Community5mo ago
11 replies
The Untraceable

Better Auth with MongoDB and Convex for client data

Hi all. I'm not sure if convex is going to work for my use case. I want to make a chat app with Convex storing only the user data (chats and messages), and Better Auth (my auth lib of choice) using MongoDB for user data. This is because I have a very large template that implements most of Better Auth, with SSR-CSR hybrid, some pages requiring the auth object that using Convex with Better Auth replaces with createAuth function requiring context. I want to just fucking list the users chats and messages in a reactive way without having to deal with all the fucking WS layer myself, persistence through pages, etc, hence I want to use convex. I need to do auth checks before reading the chats and messages in the convex query/function/whatever, but using NodeJS shit (like TLS, required by MongoDB) in Convex is a no go, so you cannot call auth.api.getSession({headers}). I don't know what to fucking do, this has honestly ruined my day as I was very excited to use Convex but haven't been able to get through this. I haven't ever used Convex, and I would honestly appreciate advice on what the fuck I should do to get this working. I tried to use an action but the issue there is that it's not reactive.
Was this page helpful?